Jump to content

[1.16.5] TileEntity don't save data (inventory)


Luis_ST

Recommended Posts

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.