User Tools

Site Tools


tutorial:itemgroup

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
Next revisionBoth sides next revision
tutorial:itemgroup [2022/12/11 22:06] – Update to 1.19.3 item group API haykamtutorial:itemgroup [2023/06/11 08:33] – Add link to 1.19 version mcrafterzz
Line 1: Line 1:
 ====== Item Groups ====== ====== Item Groups ======
 +
 +//This is the 1.20+ version of this tutorial. For the 1.19 version, see [[tutorial:1.19:itemgroup|Creating an itemgroup (1.19)]].//
  
 So far, you have used ''/give @s tutorial:custom_item'' to obtain your item. To make obtaining your item easier, you can add it to item groups within the creative inventory. You can also add your own item group. All items added to any group will also be searchable within the creative inventory. So far, you have used ''/give @s tutorial:custom_item'' to obtain your item. To make obtaining your item easier, you can add it to item groups within the creative inventory. You can also add your own item group. All items added to any group will also be searchable within the creative inventory.
Line 7: Line 9:
 First, choose the item group that the item should be added to. For this example, that item group will be the building blocks group. The vanilla item groups are stored in the ''<yarn class_7706>'' class. First, choose the item group that the item should be added to. For this example, that item group will be the building blocks group. The vanilla item groups are stored in the ''<yarn class_7706>'' class.
  
-Next, in your ''onInitialize'' methodadd the event handler for that item group. Each item group that you would like to modify requires its own event handler, but the same event handler can be used to add multiple items to one item group.+Next, you can simply use ''group'' method in ''FabricItemSettings'' with Fabric API. This will locate your custom item on last of item group.  
 + 
 +But if you want to put your custom item in other location(eg. after of ''<yarn field_8691>'') or other advanced modificationyou can register the event handler for each item group that you would like to modify in your ''onInitialize'' method. Each item group that you would like to modify requires its own event handler, but the same event handler can be used to add multiple items to one item group.
  
 Items can be positioned relative to the existing vanilla items. Think carefully about where your mod's users would expect the item to be. For example, if you are adding a new type of wood, placing your item after the existing types of wood would make the most sense. Items can be positioned relative to the existing vanilla items. Think carefully about where your mod's users would expect the item to be. For example, if you are adding a new type of wood, placing your item after the existing types of wood would make the most sense.
tutorial/itemgroup.txt · Last modified: 2024/07/03 06:57 by solidblock