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/04/13 08:04] – map2fabricyarn daomephsta | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
- | Do you want your blocks and items blocks to have their own group in the creative | + | ==== Creating a simple Item Group ==== |
+ | To have your ''< | ||
+ | < | ||
+ | public class ExampleMod implements ModInitializer { | ||
- | public static final ItemGroup ITEM_GROUP; | + | |
- | | + | |
- | | + | |
- | ITEM_GROUP = FabricItemGroupBuilder.create(new Identifier("modid", "name")})).icon(() -> new ItemStack(block)).build(); | + | |
- | } | + | |
- | The modid is the id of your mod, name is the name of the creative tabs (must be lowercase to not crash). The icon is should be an itemstack, created with either an item or a block like in this case for example | + | public static final class_1761 OTHER_GROUP = FabricItemGroupBuilder.create( |
+ | new class_2960(" | ||
+ | .icon(() -> new class_1799(class_1802.field_8428)) | ||
+ | .build(); | ||
+ | | ||
+ | } | ||
+ | </yarncode> | ||
+ | Once '' | ||
- | | + | Make sure you replace the arguments |
- | Creating | + | === Adding your Items to your Item Group === |
+ | When creating a custom Item, call ''< | ||
+ | < | ||
+ | public static final class_1792 YOUR_ITEM = new class_1792(new class_1792.class_1793().method_7892(ExampleMod.ITEM_GROUP)); | ||
+ | </ | ||
+ | |||
+ | ==== Making | ||
+ | Call '' | ||
+ | < | ||
+ | public class ExampleMod implements ModInitializer { | ||
+ | |||
+ | public static final class_1761 ITEM_GROUP = FabricItemGroupBuilder.build( | ||
+ | new class_2960(" | ||
+ | () -> new class_1799(class_2246.field_10445)); | ||
+ | |||
+ | public static final class_1761 OTHER_GROUP = FabricItemGroupBuilder.create( | ||
+ | new class_2960(" | ||
+ | .icon(() -> new class_1799(class_1802.field_8428)) | ||
+ | .appendItems(stacks -> { | ||
+ | stacks.add(new class_1799(class_2246.field_10166)); | ||
+ | stacks.add(new class_1799(class_1802.field_8279)); | ||
+ | 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)); | ||
+ | }) | ||
+ | .build(); | ||
+ | // ... | ||
+ | } | ||
+ | </ | ||
+ | {{: |
tutorial/itemgroup.txt · Last modified: 2024/06/17 12:49 by solidblock