LimpLungs Posted August 5, 2015 Share Posted August 5, 2015 So here is the section that is giving me problems: http://pastebin.com/LGj2xqBV Basically, it prints the correct integer for entry in the update entity, but when I go to write it, it prints incorrect. I commented //this.sendInventory(); and //this.entry = -1; but it still doesn't work. The value printed in updateEntity still prints correct, but when I go to write it, it prints wrong before write. I did the same thing that I did to store values in 2 other tile entities, and I can't seem to find anything different going on here. Am I overlooking something, or is this just being obnoxiously picky and not working for some reason? Quote Link to comment Share on other sites More sharing options...
delpi Posted August 5, 2015 Share Posted August 5, 2015 Everything in "public void updateEntity()" should be in "if (!worldObj.isRemote)" . Might be wrong on your "this.updateBlock();" since its code isn't shown. The redundant "this.markDirty();" is excessive. how do you think this will work? you are never saving your items NBT to the main nbt. NBTTagList items = new NBTTagList(); for (int i = 0; i < getSizeInventory(); i++) { ItemStack stack = this.getStackInSlot(i); if (stack != null) { NBTTagCompound item = new NBTTagCompound(); item.setByte("Slot", (byte) i); stack.writeToNBT(item); items.appendTag(item); } } [\spoiler] What is "entry". Its not defined anywhere so hard to tell what it is or what you meant to do. If at this point, it doens't print the right value, then 'entry' is the wrong variables in your code. System.out.println(entry); compound.setInteger("intEntry", this.entry); [\spoiler] Quote Long time Bukkit & Forge Programmer Happy to try and help Link to comment Share on other sites More sharing options...
LimpLungs Posted August 5, 2015 Author Share Posted August 5, 2015 Oh wow, I feel like an idiot now. Yes, the problem was both the not running the code in (!worldObj.isRemote) like my other two tile entities, and I completely forgot the compound.setTag("Items", items); As for the this.entry, I have it being declared as -1 to start, and then whenever an itemstack enters the block, it changes it to the side it entered from. Basically, I'm making a transport block similar to pipes and it needs to lock behind it when it goes through so it doesn't head backwards. It all is working now thank you so much for proofreading that! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.