Posted April 19, 20214 yr I have created a tileentity which should add items to an ItemStackHandler when you right-click. if after adding the item I check whether the item is present in the ItemStackHandler, It returns false. this is my TE I suspect it is due to the synchronization between client and server, but I'm not sure, because it could be something else does anyone have any idea what I have to change?
April 19, 20214 yr Author 2 hours ago, diesieben07 said: You have to only change the inventory server side. okay i'm now checking whether the world is a ServerWorld but this has not fixed the error, if I print the inventory on the console after interacting, every slot is empty this is the updated class Edited April 19, 20214 yr by Luis_ST
April 19, 20214 yr Author 19 minutes ago, diesieben07 said: You are setting simulate to true. So, the item handler complies and simulates the insertion. What did you expect? I changed it, but the inventory remains empty Edited April 19, 20214 yr by Luis_ST
April 19, 20214 yr Author Update: I'm trying to adapt my TileEntity, I used the CampfireTileEntity as an example because it actually works the same way Edited April 19, 20214 yr by Luis_ST
April 19, 20214 yr Author 43 minutes ago, diesieben07 said: Your getNextSlot function is pointless. Simply keep calling insertItem until it manages to insert something and keep increasing the slot number. You must not modify the ItemStack after you have given it to the IItemHandler, otherwise you will modify it inside the item handler. The IItemHandler takes care of any stack math and stack merging, it will simply give you the result back (whatever could not be inserted). Simply give that back to the player. i try that thanks
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.