1. 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 comminuty!

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

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Rotating player skull

Discussion in 'Skript' started by GlitchedExploit, Jul 28, 2020.

Thread Status:
Not open for further replies.
  1. GlitchedExploit

    Joined:
    Dec 24, 2017
    Messages:
    1
    Likes Received:
    0
    Version: https://prnt.sc/tpxc3j

    Code (Text):
    1.  
    2. import:
    3.     org.bukkit.Material
    4.     org.bukkit.block.BlockFace
    5.     org.bukkit.block.Block
    6.     org.bukkit.block.Skull
    7. function setToSkull(owner: string, value: string, loc: location, against: location):
    8. # owner: owner id, value: the texture, loc: location of skull, against: block skull will be placed against
    9.   set block at {_loc} to player wall head
    10.   set {_block} to {_loc}.getBlock().getState()
    11.   set {_face} to {_against}.getBlock().getFace({_loc}.getBlock())
    12.   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""}"
    13.   broadcast "face: %{_face}%"
    14.   {_block}.setRotation({_face})
    15.   {_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
    --- Double Post Merged, Jul 28, 2020, Original Post Date: Jul 28, 2020 ---
    Got it working! Here's my code if anyone finds this on google:
    Code (Text):
    1. function setToSkull(owner: string, value: string, loc: location, against: location):
    2. # owner: owner id, value: the texture, loc: location of skull, against: block skull will be placed against
    3.   set block at {_loc} to player wall head
    4.   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""}"
    5.   set {_face} to {_against}.getBlock().getFace({_loc}.getBlock())
    6.   if "%{_face}%" is "NORTH":
    7.     set facing of block at {_loc} to north
    8.   if "%{_face}%" is "EAST":
    9.     set facing of block at {_loc} to east
    10.   if "%{_face}%" is "SOUTH":
    11.     set facing of block at {_loc} to south
    12.   if "%{_face}%" is "WEST":
    13.     set facing of block at {_loc} to west
     
Thread Status:
Not open for further replies.

Share This Page

Loading...