Jump to content

Recommended Posts

Posted

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?

Posted (edited)
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 by Luis_ST
Posted (edited)
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 by Luis_ST
Posted (edited)

Update: I'm trying to adapt my TileEntity, I used the CampfireTileEntity as an example
because it actually works the same way

Edited by Luis_ST
Posted
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.

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.