TitanChase

Untitled

Mar 7th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.88 KB | None | 0 0
  1.     @Override
  2.     public void readEntityFromNBT(NBTTagCompound compound)
  3.     {
  4.         super.readEntityFromNBT(compound);
  5.         inventory.readFromNBT(compound);
  6.         if (compound.hasKey(Names.NBT.TileEntityPosition))
  7.         {
  8.             int[] pos = compound.getIntArray(Names.NBT.TileEntityPosition);
  9.             BlockPos blockPos = new BlockPos(pos[0], pos[1], pos[2]);
  10.             building = (TileEntityBuilding) world.getTileEntity(blockPos);
  11.         }
  12.     }
  13.  
  14.     @Override
  15.     public void writeEntityToNBT(NBTTagCompound compound)
  16.     {
  17.         super.writeEntityToNBT(compound);
  18.         inventory.writeToNBT(compound);
  19.         if (building != null)
  20.         {
  21.             int[] pos =
  22.             { building.getPos().getX(), building.getPos().getY(), building.getPos().getZ() };
  23.             compound.setIntArray(Names.NBT.TileEntityPosition, pos);
  24.         }
  25.     }
Add Comment
Please, Sign In to add comment