Posted June 9, 201510 yr Hello, I'm making a furnace style tileEntity which takes the input of an item and then turns it into another or several other items, all inside a GUI. Everything works perfectly, the input gets consumed and then the outputs are placed on the output slots. But the problem comes along when the user clicks on a empty output slot, somehow making the some of the size of the ItemStacks inside the output itemstacks list become of amount 0 (ItemStack.stackSize becomes 0). I've been looking around the code and can't figure out how is this happening. Even made the output list final and also made a copy of it which is never used and they all turn 0... Here's the relevant part of the code of my tileEntity That the item.uraniumpowder2 turned into a stack size of 0 (0xitem.uraniumpowder2..) in BOTH the listOut and the aux lists! I even checked and the outputList[][] is also changed! So how the heck is this happening?
June 9, 201510 yr Is it happening at the point when you click on a slot? Then post the code for your container and/or slot (whole class please) that does the processing of the click. I usually make a custom slot for the output slots, as that can allow flexibility in behavior. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
June 9, 201510 yr Author Well, if you directly take the ItemStack out of the list and pass it around, that ItemStack is still in your List! And if someone modifies it, it will be modified in your List as well, since it's the same ItemStack! Whenever you pass one of them out, copy it (ItemStack has a copy method). Wow it actually was that, using the copy() on the moment I place the item fixed it >.<. Didn't know that the setInventorySlotContents placed the actual stack and not simply its information! Thank you!
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.