Jump to content

[1.14.4] how to use ItemHandler capability to insert item in slot?


Recommended Posts

Im exploring the 1.14.4 way of handle items with tileentities and containers. im able to build some chests for holding items etc., but i cant figure out how to generate items like a furnace in a result Slot.

i tried to use the insertItem method from the IItemHandler in the tick() method, but it takes no effect

handler.ifPresent(h -> h.insertItem(4, new ItemStack(Items.IRON_INGOT), false));


getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).map(h -> h.insertItem(4, new ItemStack(Items.IRON_INGOT), false));



whats the correct way?


thx for any hints

Link to comment
Share on other sites

ah ok thx.


i figured out, it needs a true condition in the isItemValid() method from IItemHandler for the result slot as well as for the Input Slots.


now its working… 


(Im porting my stuff from 1.13.2 where i used the ISidedInventory implementation, but the ItemHandler stuff seems to be more comfortable)



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.

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.


  • Create New...

Important Information

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