Advertisement
JackOUT

Untitled

Sep 10th, 2022
758
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.54 KB | None | 0 0
  1.     public static void setSkullBlock(final Location blockLocation) {
  2.         final BlockPosition position = new BlockPosition(blockLocation.getX(), blockLocation.getY(), blockLocation.getZ());
  3.         final net.minecraft.server.v1_8_R3.World nmsWorld = ((CraftWorld) blockLocation.getWorld()).getHandle();
  4.         final BlockPosition blockPosition = new BlockPosition(blockLocation.getBlock().getX(), blockLocation.getBlock().getY(), blockLocation.getBlock().getZ());
  5.         final IBlockData ibd = net.minecraft.server.v1_8_R3.Block.getByCombinedId(144);
  6.  
  7.         //blockLocation.getBlock().setTypeIdAndData(144, (byte) 1, true);
  8.         nmsWorld.setTypeAndData(blockPosition, ibd, (byte) 1);
  9.  
  10.         final Skull skullBlock = (Skull) blockLocation.getBlock().getState();
  11.  
  12.         skullBlock.setSkullType(SkullType.PLAYER);
  13.         skullBlock.update();
  14.  
  15.         final TileEntity tileEntity = ((CraftWorld) blockLocation.getWorld()).getHandle().getTileEntity(position);
  16.         final NBTTagCompound compound = new NBTTagCompound();
  17.  
  18.         tileEntity.b(compound);
  19.  
  20.         final NBTTagCompound tagCompound = new NBTTagCompound();
  21.         final NBTTagCompound compoundOwner = new NBTTagCompound();
  22.         final NBTTagCompound compoundProperties = new NBTTagCompound();
  23.  
  24.         compoundOwner.set("Properties", compoundProperties);
  25.         tagCompound.setString("id", "Skull");
  26.         tagCompound.setByte("Rot", (byte) 0);
  27.         tagCompound.setInt("x", position.getX());
  28.         tagCompound.setInt("y", position.getY());
  29.         tagCompound.setInt("z", position.getZ());
  30.         tagCompound.setByte("SkullType", (byte) 3);
  31.  
  32.         tileEntity.a(tagCompound);
  33.         tileEntity.update();
  34.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement