tutorial:itemgroup
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
tutorial:itemgroup [2022/04/13 08:04] – external edit 127.0.0.1 | tutorial:itemgroup [2022/12/11 22:06] – Update to 1.19.3 item group API haykam | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Item Groups ====== | ====== Item Groups ====== | ||
- | ==== Creating a simple Item Group ==== | ||
- | To have your ''< | ||
- | < | ||
- | public class ExampleMod implements ModInitializer { | ||
- | public static final class_1761 ITEM_GROUP = FabricItemGroupBuilder.build( | + | So far, you have used ''/ |
- | new class_2960(" | + | |
- | () -> new class_1799(class_2246.field_10445)); | + | |
- | public static final class_1761 OTHER_GROUP | + | ==== Adding |
- | new class_2960(" | + | |
- | .icon(() -> new class_1799(class_1802.field_8428)) | + | |
- | .build(); | + | |
- | // ... | + | |
- | } | + | |
- | </ | + | |
- | Once '' | + | |
- | Make sure you replace | + | First, choose |
- | === Adding | + | Next, in your '' |
- | When creating | + | |
- | < | + | Items can be positioned relative |
- | public static final class_1792 YOUR_ITEM = new class_1792(new class_1792.class_1793().method_7892(ExampleMod.ITEM_GROUP)); | + | |
+ | 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, | ||
+ | }); | ||
</ | </ | ||
- | ==== Making | + | ==== Creating |
- | Call '' | + | |
- | < | + | |
- | public class ExampleMod implements ModInitializer { | + | |
- | public static final class_1761 ITEM_GROUP = FabricItemGroupBuilder.build( | + | Before you create an item group, determine whether it would have enough content to warrant its own group. Your item group will be placed on a separate page of tabs, impacting its discoverability, and users may be confused if the item is not where similar items are in the creative inventory. |
- | new class_2960(" | + | |
- | () -> new class_1799(class_2246.field_10445)); | + | |
- | public | + | If you think that your own item group is needed, you can use the '' |
- | | + | |
- | .icon(() -> new class_1799(class_1802.field_8428)) | + | < |
- | | + | private |
- | stacks.add(new class_1799(class_2246.field_10166)); | + | .icon(() -> new class_1799(CUSTOM_ITEM)) |
- | stacks.add(new class_1799(class_1802.field_8279)); | + | .build(); |
- | stacks.add(class_1844.method_8061(new class_1799(class_1802.field_8574), | + | |
- | stacks.add(class_1799.field_8037); | + | |
- | stacks.add(new class_1799(class_1802.field_8699)); | + | |
- | }) | + | |
- | | + | |
- | // ... | + | |
- | } | + | |
</ | </ | ||
+ | |||
+ | You can use '' | ||
+ | |||
+ | < | ||
+ | ItemGroupEvents.modifyEntriesEvent(ITEM_GROUP).register(content -> { | ||
+ | content.add(CUSTOM_ITEM); | ||
+ | }); | ||
+ | </ | ||
+ | |||
{{: | {{: |
tutorial/itemgroup.txt · Last modified: 2023/10/01 03:21 by haykam