Posted January 14, 20187 yr Hi, I'm currently working on a block that stores it's orientation in a TileEntity (metadata hs not enough states). This is quite simple, I have two enum fields that store the orientation and save those with NBT. public class TileEntityCablecarTrack extends TileEntity { private EnumFacingExtended first_end = EnumFacingExtended.NORTH; private EnumFacingExtended second_end = EnumFacingExtended.SOUTH; @Override public NBTTagCompound writeToNBT(NBTTagCompound nbt) { nbt.setInteger("first_end", first_end.getID()); nbt.setInteger("second_end", second_end.getID()); System.out.println("Serialize first_end: " + first_end + " second_end: " + second_end); return super.writeToNBT(nbt); } @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); this.first_end = EnumFacingExtended.fromID(nbt.getInteger("first_end")); this.second_end = EnumFacingExtended.fromID(nbt.getInteger("second_end")); System.out.println("Deserialize first_end: " + first_end + " second_end: " + second_end); } } But this does not work for the client on load: [14:26:04] [Server thread/INFO] [STDOUT]: [techmod.cablecar.TileEntityCablecarTrack:readFromNBT:23]: Deserialize first_end: EAST second_end: WEST [14:26:04] [Server thread/INFO] [STDOUT]: [techmod.cablecar.TileEntityCablecarTrack:readFromNBT:23]: Deserialize first_end: EAST second_end: WEST [14:26:04] [Server thread/INFO] [STDOUT]: [techmod.cablecar.TileEntityCablecarTrack:readFromNBT:23]: Deserialize first_end: NORTH second_end: SOUTH [14:26:04] [Server thread/INFO] [STDOUT]: [techmod.cablecar.TileEntityCablecarTrack:readFromNBT:23]: Deserialize first_end: EAST second_end: WEST [14:26:04] [Server thread/INFO] [STDOUT]: [techmod.cablecar.TileEntityCablecarTrack:readFromNBT:23]: Deserialize first_end: NORTH second_end: SOUTH [14:26:04] [Server thread/INFO] [STDOUT]: [techmod.cablecar.TileEntityCablecarTrack:readFromNBT:23]: Deserialize first_end: EAST second_end: WEST [14:26:04] [Server thread/INFO] [STDOUT]: [techmod.cablecar.TileEntityCablecarTrack:readFromNBT:23]: Deserialize first_end: NORTH second_end: SOUTH [14:26:04] [Server thread/INFO] [STDOUT]: [techmod.cablecar.TileEntityCablecarTrack:readFromNBT:23]: Deserialize first_end: NORTH second_end: SOUTH [14:26:04] [Server thread/INFO]: Changing view distance to 12, from 10 [14:26:04] [Netty Local Client IO #3/INFO] [FML]: Server protocol version 2 [14:26:04] [Netty Server IO #7/INFO] [FML]: Client protocol version 2 [14:26:04] [Netty Server IO #7/INFO] [FML]: Client attempting to join with 5 mods : [email protected],[email protected],[email protected],[email protected],[email protected] [14:26:04] [Netty Local Client IO #3/INFO] [FML]: [Netty Local Client IO #3] Client side modded connection established [14:26:04] [Server thread/INFO] [FML]: [Server thread] Server side modded connection established [14:26:04] [Server thread/INFO]: Player317[local:E:b50b1f90] logged in with entity id 90 at (240.36660389147244, 52.0, 343.8283291103376) [14:26:04] [Server thread/INFO]: Player317 joined the game [14:26:04] [Server thread/INFO]: Saving and pausing game... [14:26:04] [Server thread/INFO]: Saving chunks for level 'Superflat'/overworld [14:26:04] [Server thread/INFO] [STDOUT]: [techmod.cablecar.TileEntityCablecarTrack:writeToNBT:14]: Serialize first_end: EAST second_end: WEST [14:26:04] [Server thread/INFO] [STDOUT]: [techmod.cablecar.TileEntityCablecarTrack:writeToNBT:14]: Serialize first_end: EAST second_end: WEST [14:26:04] [Server thread/INFO] [STDOUT]: [techmod.cablecar.TileEntityCablecarTrack:writeToNBT:14]: Serialize first_end: NORTH second_end: SOUTH [14:26:04] [Server thread/INFO] [STDOUT]: [techmod.cablecar.TileEntityCablecarTrack:writeToNBT:14]: Serialize first_end: EAST second_end: WEST [14:26:04] [Server thread/INFO] [STDOUT]: [techmod.cablecar.TileEntityCablecarTrack:writeToNBT:14]: Serialize first_end: NORTH second_end: SOUTH [14:26:04] [Server thread/INFO] [STDOUT]: [techmod.cablecar.TileEntityCablecarTrack:writeToNBT:14]: Serialize first_end: EAST second_end: WEST [14:26:04] [Server thread/INFO] [STDOUT]: [techmod.cablecar.TileEntityCablecarTrack:writeToNBT:14]: Serialize first_end: NORTH second_end: SOUTH [14:26:04] [Server thread/INFO] [STDOUT]: [techmod.cablecar.TileEntityCablecarTrack:writeToNBT:14]: Serialize first_end: NORTH second_end: SOUTH [14:26:04] [Server thread/INFO]: Saving chunks for level 'Superflat'/the_nether [14:26:04] [Server thread/INFO]: Saving chunks for level 'Superflat'/the_end [14:26:04] [main/INFO]: Loaded 5 advancements [14:26:04] [main/INFO] [STDOUT]: [techmod.cablecar.TileEntityCablecarTrack:readFromNBT:23]: Deserialize first_end: NORTH second_end: NORTH [14:26:04] [main/INFO] [STDOUT]: [techmod.cablecar.TileEntityCablecarTrack:readFromNBT:23]: Deserialize first_end: NORTH second_end: NORTH [14:26:04] [main/INFO] [STDOUT]: [techmod.cablecar.TileEntityCablecarTrack:readFromNBT:23]: Deserialize first_end: NORTH second_end: NORTH [14:26:04] [main/INFO] [STDOUT]: [techmod.cablecar.TileEntityCablecarTrack:readFromNBT:23]: Deserialize first_end: NORTH second_end: NORTH [14:26:04] [main/INFO] [STDOUT]: [techmod.cablecar.TileEntityCablecarTrack:readFromNBT:23]: Deserialize first_end: NORTH second_end: NORTH [14:26:04] [main/INFO] [STDOUT]: [techmod.cablecar.TileEntityCablecarTrack:readFromNBT:23]: Deserialize first_end: NORTH second_end: NORTH [14:26:04] [main/INFO] [STDOUT]: [techmod.cablecar.TileEntityCablecarTrack:readFromNBT:23]: Deserialize first_end: NORTH second_end: NORTH [14:26:04] [main/INFO] [STDOUT]: [techmod.cablecar.TileEntityCablecarTrack:readFromNBT:23]: Deserialize first_end: NORTH second_end: NORTH Why doesnt the client load these values correctly? Edited January 14, 20187 yr by SuperManitu
January 14, 20187 yr I'm not that good to explain it, but take a look at this post and all the answers, you will find what you need here:
January 14, 20187 yr Author Thanks, I solved the problem by overwriting getUpdateTag @Override public NBTTagCompound getUpdateTag() { NBTTagCompound tag = super.getUpdateTag(); this.writeToNBT(tag); return tag; } as I dont need dynamic behavior (yet) I do not use the other methods
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.