tutorial:itemgroup
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorial:itemgroup [2024/07/04 16:33] – mineblock11 | tutorial:itemgroup [2024/08/23 13:03] (current) – solidblock | ||
---|---|---|---|
Line 45: | Line 45: | ||
</ | </ | ||
- | In practice, considering items you register | + | In practice, considering items you register |
< | < | ||
Line 51: | Line 51: | ||
// [...] | // [...] | ||
| | ||
- | public static void registerItemGroups() { | + | public static void registerToVanillaItemGroups() { |
ItemGroupEvents.modifyEntriesEvent(class_7706.field_40195).register(content -> { | ItemGroupEvents.modifyEntriesEvent(class_7706.field_40195).register(content -> { | ||
content.addAfter(class_1802.field_8691, | content.addAfter(class_1802.field_8691, | ||
Line 63: | Line 63: | ||
@Override | @Override | ||
public void onInitialize() { | public void onInitialize() { | ||
- | TutorialItems.registerItemGroups(); | + | TutorialItems.registerToVanillaItemGroups(); |
} | } | ||
} | } | ||
Line 75: | Line 75: | ||
< | < | ||
- | public | + | public final class TutorialItemGroups { |
public static final class_1761 TEST_GROUP = FabricItemGroup.builder() | public static final class_1761 TEST_GROUP = FabricItemGroup.builder() | ||
- | .icon(() -> new class_1799(CUSTOM_ITEM)) | + | .icon(() -> new class_1799(TutorialItems.CUSTOM_ITEM)) |
.displayName(class_2561.method_43469(" | .displayName(class_2561.method_43469(" | ||
.entries((context, | .entries((context, | ||
- | entries.add(CUSTOM_ITEM); | + | entries.add(TutorialItems.CUSTOM_ITEM); |
}) | }) | ||
.build(); | .build(); | ||
Line 93: | Line 93: | ||
< | < | ||
- | public | + | public final class TutorialItemGroups { |
// .... | // .... | ||
| | ||
Line 108: | Line 108: | ||
Of course, you can directly register them when assigning the fields: | Of course, you can directly register them when assigning the fields: | ||
< | < | ||
- | public | + | public final class TutorialItemGroups { |
public static final class_1761 TEST_GROUP = class_2378.method_10230(class_7923.field_44687, | public static final class_1761 TEST_GROUP = class_2378.method_10230(class_7923.field_44687, | ||
.icon(() -> new class_1799(CUSTOM_ITEM)) | .icon(() -> new class_1799(CUSTOM_ITEM)) | ||
.displayName(class_2561.method_43469(" | .displayName(class_2561.method_43469(" | ||
.entries((context, | .entries((context, | ||
- | entries.add(CUSTOM_ITEM); | + | entries.add(TutorialItems.CUSTOM_ITEM); |
}) | }) | ||
.build()); | .build()); | ||
Line 131: | Line 131: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | :!: The screenshot below is outdated. | ||
{{: | {{: |
tutorial/itemgroup.1720110782.txt.gz · Last modified: 2024/07/04 16:33 by mineblock11