Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void setSkullBlock(final Location blockLocation) {
- final BlockPosition position = new BlockPosition(blockLocation.getX(), blockLocation.getY(), blockLocation.getZ());
- final net.minecraft.server.v1_8_R3.World nmsWorld = ((CraftWorld) blockLocation.getWorld()).getHandle();
- final BlockPosition blockPosition = new BlockPosition(blockLocation.getBlock().getX(), blockLocation.getBlock().getY(), blockLocation.getBlock().getZ());
- final IBlockData ibd = net.minecraft.server.v1_8_R3.Block.getByCombinedId(144);
- //blockLocation.getBlock().setTypeIdAndData(144, (byte) 1, true);
- nmsWorld.setTypeAndData(blockPosition, ibd, (byte) 1);
- final Skull skullBlock = (Skull) blockLocation.getBlock().getState();
- skullBlock.setSkullType(SkullType.PLAYER);
- skullBlock.update();
- final TileEntity tileEntity = ((CraftWorld) blockLocation.getWorld()).getHandle().getTileEntity(position);
- final NBTTagCompound compound = new NBTTagCompound();
- tileEntity.b(compound);
- final NBTTagCompound tagCompound = new NBTTagCompound();
- final NBTTagCompound compoundOwner = new NBTTagCompound();
- final NBTTagCompound compoundProperties = new NBTTagCompound();
- compoundOwner.set("Properties", compoundProperties);
- tagCompound.setString("id", "Skull");
- tagCompound.setByte("Rot", (byte) 0);
- tagCompound.setInt("x", position.getX());
- tagCompound.setInt("y", position.getY());
- tagCompound.setInt("z", position.getZ());
- tagCompound.setByte("SkullType", (byte) 3);
- tileEntity.a(tagCompound);
- tileEntity.update();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement