tutorial:itemgroup
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
tutorial:itemgroup [2019/02/21 13:17] – mcrafterzz | tutorial:itemgroup [2022/12/11 22:06] – Update to 1.19.3 item group API haykam | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
- | Do you want your blocks and items blocks to have their own group in the creative inventory? Then that can easly be fixed. The most common way to create one is to use // | + | |
- | | + | So far, you have used ''/ |
- | @Override | + | |
- | | + | |
- | | + | |
- | } | + | |
- | The modid is the id of your mod, name is the name of the creative tabs (must be lowercase | + | ==== Adding |
- | | + | 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 ''< |
- | Creating an item group is as easy as that! | + | Next, in your '' |
+ | |||
+ | 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. | ||
+ | |||
+ | For example, this event handler will place your mod's item after the oak door in the building blocks item group: | ||
+ | |||
+ | < | ||
+ | ItemGroupEvents.modifyEntriesEvent(class_7706.field_40195).register(content -> { | ||
+ | content.addAfter(class_1802.field_8691, | ||
+ | }); | ||
+ | </ | ||
+ | |||
+ | ==== Creating | ||
+ | |||
+ | Before you create | ||
+ | |||
+ | If you think that your own item group is needed, you can use the '' | ||
+ | |||
+ | < | ||
+ | private static final class_1761 ITEM_GROUP = FabricItemGroup.builder(new class_2960(" | ||
+ | .icon(() -> new class_1799(CUSTOM_ITEM)) | ||
+ | .build(); | ||
+ | </ | ||
+ | |||
+ | You can use '' | ||
+ | |||
+ | < | ||
+ | ItemGroupEvents.modifyEntriesEvent(ITEM_GROUP).register(content -> { | ||
+ | content.add(CUSTOM_ITEM); | ||
+ | }); | ||
+ | </ | ||
+ | |||
+ | {{: |
tutorial/itemgroup.txt · Last modified: 2024/06/17 12:49 by solidblock