Posted December 3, 20168 yr Hey there, So I'm having an issue saving connections between tile entities, they save when disconnect + reconnect, however, when I close the game completely the connections seems to get reset. Anything I could do? Here is how I'm reading/writing the NBT: @Override public void readSyncableNBT(NBTTagCompound compound, NBTType type){ super.readSyncableNBT(compound, type); if(type == NBTType.SYNC){ PlentifulMiscAPI.connectionHandler.removeRelayFromNetwork(this.pos, this.worldObj); NBTTagList list = compound.getTagList("Connections", 10); if(!list.hasNoTags()){ for(int i = 0; i < list.tagCount(); i++){ ConnectionPair pair = new ConnectionPair(); pair.readFromNBT(list.getCompoundTagAt(i)); PlentifulMiscAPI.connectionHandler.addConnection(pair.getPositions()[0], pair.getPositions()[1], this.type, this.worldObj, pair.doesSuppressRender()); } } } } @Override public void writeSyncableNBT(NBTTagCompound compound, NBTType type){ super.writeSyncableNBT(compound, type); if(type == NBTType.SYNC){ NBTTagList list = new NBTTagList(); ConcurrentSet<IConnectionPair> connections = PlentifulMiscAPI.connectionHandler.getConnectionsFor(this.pos, this.worldObj); if(connections != null && !connections.isEmpty()){ for(IConnectionPair pair : connections){ NBTTagCompound tag = new NBTTagCompound(); pair.writeToNBT(tag); list.appendTag(tag); } } compound.setTag("Connections", list); } } Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
December 5, 20168 yr Author So how would I read from the world? Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
December 5, 20168 yr So how would I read from the world? First update tick if you need to access the blocks/other TEs otherwise onLoad() is what you should use. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
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.