User Tools

Site Tools


tutorial:inventory

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tutorial:inventory [2024/08/26 06:41] – update solidblocktutorial:inventory [2025/03/30 22:06] (current) – [Storing items in a block as an Inventory] technici4n
Line 2: Line 2:
 Make sure you've [[tutorial:blockentity|made a block entity]] before reading this tutorial.   Make sure you've [[tutorial:blockentity|made a block entity]] before reading this tutorial.  
  
-The standard way to store items in a BlockEntity is to make it an ''Inventory''. This allows hoppers (or other mods) to insert and extract items from your BlockEntity without any extra work.+The simplest way to store items in a BlockEntity is to make it an ''Inventory''. This allows hoppers (or other mods) to insert and extract items from your BlockEntity without any extra work. For more flexible and complex ways to store items, refer to the [[tutorial:transfer-api_item_storage|Item transfer with Storage<ItemVariant>]] tutorial.
  
 This tutorial is written for 1.21. For older versions, some methods may change. This tutorial is written for 1.21. For older versions, some methods may change.
Line 210: Line 210:
  
  
-We'll have the opposite behavior when the player is not holding an item. We'll take the item from the second slot, and then the first one of the second is empty. +We'll have the opposite behavior when the player is not holding an item. We'll take the item from the second slot, and then the first one if the second is empty. 
 If the first is empty we pass it to default behavior. If the first is empty we pass it to default behavior.
 <code java DemoBlock.java> <code java DemoBlock.java>
tutorial/inventory.1724654467.txt.gz · Last modified: 2024/08/26 06:41 by solidblock