Solved Rotating player skull

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.
Dec 24, 2017
1
0
1
Version: https://prnt.sc/tpxc3j

Code:
import:
    org.bukkit.Material
    org.bukkit.block.BlockFace
    org.bukkit.block.Block
    org.bukkit.block.Skull
function setToSkull(owner: string, value: string, loc: location, against: location):
# owner: owner id, value: the texture, loc: location of skull, against: block skull will be placed against
  set block at {_loc} to player wall head
  set {_block} to {_loc}.getBlock().getState()
  set {_face} to {_against}.getBlock().getFace({_loc}.getBlock())
  set nbt of block at {_loc} to "{Owner:{Id:""%{_owner}%"",Properties:{textures:[{Value:""%{_value}%""}]},Name:""Notch""},x:%x coord of {_loc}%,y:%y coord of {_loc}%,z:%z coord of {_loc}%,id:""minecraft:skull""}"
  broadcast "face: %{_face}%"
  {_block}.setRotation({_face})
  {_block}.update(true, false)

No errors on reload, or in console.

Trying to rotate a player skull, it's placing the skull with correct nbt, broadcasting correct blockface, but isn't setting it. The skull is always facing north.

Spent over an hour trying to figure this out lol
[doublepost=1595951583,1595943567][/doublepost]Got it working! Here's my code if anyone finds this on google:
Code:
function setToSkull(owner: string, value: string, loc: location, against: location):
# owner: owner id, value: the texture, loc: location of skull, against: block skull will be placed against
  set block at {_loc} to player wall head
  set nbt of block at {_loc} to "{Owner:{Id:""%{_owner}%"",Properties:{textures:[{Value:""%{_value}%""}]},Name:""Notch""},x:%x coord of {_loc}%,y:%y coord of {_loc}%,z:%z coord of {_loc}%,id:""minecraft:skull""}"
  set {_face} to {_against}.getBlock().getFace({_loc}.getBlock())
  if "%{_face}%" is "NORTH":
    set facing of block at {_loc} to north
  if "%{_face}%" is "EAST":
    set facing of block at {_loc} to east
  if "%{_face}%" is "SOUTH":
    set facing of block at {_loc} to south
  if "%{_face}%" is "WEST":
    set facing of block at {_loc} to west
 
Status
Not open for further replies.