Posted January 7, 20187 yr Hey all, I've got 2 issues that I think are most likely related. First is that my Tileenttity "Jar" is sharing its NBT with other instances of "Jar", seemingly at random, whenever one sends a new packet. Next is that the NBT is being found at world load, but then not being applied, until the "Jar" is being updated. See below Loading world Spoiler //WORLD LOADED [19:29:55] [Server thread/INFO] [arcanacraft]: Compoud did not save (empty) //Placed Jar in world [19:29:55] [main/INFO] [arcanacraft]: Compoud failed to load //readFromNBT [19:30:03] [Server thread/INFO] [arcanacraft]: Added tinkture: rebus, Current Amount: 8 //Added tinkture to Jar, marking dirty and notifying world of block update. [19:30:03] [Server thread/INFO] [arcanacraft]: Compoud save: {amount:8,x:269,y:71,z:278,id:"minecraft:arcanacraft.jar",type:"rebus"} //writeToNBT [19:30:03] [main/INFO] [arcanacraft]: Compoud load: {amount:8,x:269,y:71,z:278,id:"minecraft:arcanacraft.jar",type:"rebus"} //readFromNBT [19:30:16] [Server thread/INFO] [arcanacraft]: Compoud save: {amount:8,x:269,y:71,z:278,id:"minecraft:arcanacraft.jar",type:"rebus"} //writeToNBT [19:30:22] [Server thread/INFO] [arcanacraft]: Added tinkture: rebus, Current Amount: 16 //Added another tinkture to Jar, to show amount goes up [19:30:22] [Server thread/INFO] [arcanacraft]: Compoud save: {amount:16,x:269,y:71,z:278,id:"minecraft:arcanacraft.jar",type:"rebus"} //writeToNBT [19:30:22] [main/INFO] [arcanacraft]: Compoud load: {amount:16,x:269,y:71,z:278,id:"minecraft:arcanacraft.jar",type:"rebus"} //readFromNBT [19:30:34] [Server thread/INFO]: Saving and pausing game... [19:30:34] [Server thread/INFO]: Saving chunks for level 'New World'/overworld [19:30:34] [Server thread/INFO] [arcanacraft]: Compoud save: {amount:16,x:269,y:71,z:278,id:"minecraft:arcanacraft.jar",type:"rebus"} //writeToNBT [19:30:34] [Server thread/INFO]: Saving chunks for level 'New World'/the_nether [19:30:34] [Server thread/INFO]: Saving chunks for level 'New World'/the_end [19:30:39] [Server thread/INFO]: Stopping server And reloading world Spoiler //WORLD LAODING [19:36:37] [Server thread/INFO] [arcanacraft]: Compoud load: {amount:16,x:269,y:71,z:278,id:"minecraft:arcanacraft.jar",type:"rebus"} //readFromNBT [19:36:37] [Server thread/INFO]: Player296[local:E:78af2ee6] logged in with entity id 5131 at (267.6679107901526, 71.0, 278.9398614026179) [19:36:37] [Server thread/INFO]: Player296 joined the game [19:36:38] [Server thread/INFO] [arcanacraft]: Compoud save: {amount:0,x:269,y:71,z:278,id:"minecraft:arcanacraft.jar",type:"empty"} //writeToNBT [19:36:38] [Server thread/INFO]: Saving and pausing game... [19:36:38] [Server thread/INFO]: Saving chunks for level 'New World'/overworld [19:36:38] [main/INFO] [arcanacraft]: Compoud load: {amount:0,x:269,y:71,z:278,id:"minecraft:arcanacraft.jar",type:"empty"} //readFromNBT [19:36:38] [Server thread/INFO] [arcanacraft]: Compoud save: {amount:0,x:269,y:71,z:278,id:"minecraft:arcanacraft.jar",type:"empty"} //writeToNBT [19:36:38] [Server thread/INFO]: Saving chunks for level 'New World'/the_nether [19:36:38] [Server thread/INFO]: Saving chunks for level 'New World'/the_end [19:36:42] [main/INFO] [arcanacraft]: TinktureType: empty, Amount: 0 //Checking current amount stored [19:36:42] [Server thread/INFO] [arcanacraft]: TinktureType: empty, Amount: 0 //Checking current amount stored [19:36:44] [Server thread/INFO] [arcanacraft]: Added tinkture: rebus, Current Amount: 24 //Added tinkture to Jar, marking dirty and notifying world of block update. [19:36:44] [Server thread/INFO] [arcanacraft]: Compoud save: {amount:24,x:269,y:71,z:278,id:"minecraft:arcanacraft.jar",type:"rebus"} //writeToNBT [19:36:44] [main/INFO] [arcanacraft]: Compoud load: {amount:24,x:269,y:71,z:278,id:"minecraft:arcanacraft.jar",type:"rebus"} //readFromNBT [19:37:22] [Server thread/INFO] [arcanacraft]: Compoud save: {amount:24,x:269,y:71,z:278,id:"minecraft:arcanacraft.jar",type:"rebus"} //writeToNBT [19:38:07] [Server thread/INFO] [arcanacraft]: Compoud save: {amount:24,x:269,y:71,z:278,id:"minecraft:arcanacraft.jar",type:"rebus"} //wri Here is the code for my TileEntityJar //ModTileEntityBase extends TilEntity @Override public NBTTagCompound getUpdateTag() { return writeToNBT(new NBTTagCompound()); } @Nullable @Override public SPacketUpdateTileEntity getUpdatePacket() { NBTTagCompound nbtTag = new NBTTagCompound(); this.writeToNBT(nbtTag); return new SPacketUpdateTileEntity(getPos(), 1, nbtTag); } @Override public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) { this.readFromNBT(packet.getNbtCompound()); } //This is called whenever the contained TinktureStacks amount/type is changed public void markForClean(){ markDirty(); if (world != null){ IBlockState state = getWorld().getBlockState(getPos()); getWorld().notifyBlockUpdate(getPos(), state, state, 3); } } //TileEntityJar @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); if(compound.hasKey(TAG_TYPE)){ Arcanacraft.logger.info("Compoud load: " + compound); TinktureType type = TinktureStackUtil.getTinktureTypeFromString(compound.getString(TAG_TYPE)); int amount = compound.getInteger(TAG_AMOUNT); tinktureStack = new TinktureStack(type, amount); } else{ Arcanacraft.logger.info("Compoud failed to load"); } } @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); if(!tinktureStack.isEmpty()){ compound.setString(TAG_TYPE, tinktureStack.getTinktureType().getTinktureName()); compound.setInteger(TAG_AMOUNT, tinktureStack.getAmount()); Arcanacraft.logger.info("Compoud save: " + compound); } else{ Arcanacraft.logger.info("Compoud did not save (empty)"); } return compound; } Any help would be greatly appreciated, I dont have any of these issues with other TileEntities that contain ItemStacks and whatnot Edit: Github link for Jarhttps://github.com/The-PurpleOrange/Arcanacraft/blob/master/src/main/java/com/tyhone/arcanacraft/common/tileentity/TileEntityJar.java Edit Edit: Oh my god. I was comparing two strings with "==" instead of ".equals", I thought I was going insane, that's what 14 straight hours of coding does to you, second time ive made that mistake, eclipse should flag it as an error honestly. Can someone lock this please? Edited January 7, 20187 yr by Tyhone
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.