/** * SERVER: Called when being read from the save file. */ @Override public final void readFromNBT(@Nonnull NBTTagCompound tag) { super.readFromNBT(tag); readCustomNBT(NBTAction.SAVE, tag); }
@Override public final void onBlockPlacedBy(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull EntityLivingBase placer, @Nonnull ItemStack stack) { onBlockPlaced(worldIn, pos, state, placer, stack); T te = getTileEntity(worldIn, pos); if (te != null) { te.readCustomNBT(stack); onBlockPlaced(worldIn, pos, state, placer, te); } }
@Deprecated protected abstract void readCustomNBT(@Nonnull NBTAction action, @Nonnull NBTTagCompound root);
/** * CLIENT: Called when chunk data is received (client receiving chunks from server). */ @Override public final void handleUpdateTag(@Nonnull NBTTagCompound tag) { super.handleUpdateTag(tag); readCustomNBT(NBTAction.CLIENT, tag); if (isProgressTile) { // TODO: nicer way to do this? This is needed so players who enter a chunk get a correct progress. ((IProgressTile) this).setProgress(tag.getFloat("tileprogress")); } }
/** * CLIENT: Called when block data is received (client receiving blocks from server, via notifyBlockUpdate). */ @Override public final void onDataPacket(@Nonnull NetworkManager net, @Nonnull SPacketUpdateTileEntity pkt) { readCustomNBT(NBTAction.CLIENT, pkt.getNbtCompound()); if (isProgressTile) { // TODO: nicer way to do this? This is needed so players who enter a chunk get a correct progress. ((IProgressTile) this).setProgress(pkt.getNbtCompound().getFloat("tileprogress")); } }