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 [2020/06/09 23:44] – formatting changes (newline -> same line brackets) draylar | tutorial:itemgroup [2022/04/13 08:04] – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Item Groups ====== | ====== Item Groups ====== | ||
==== Creating a simple Item Group ==== | ==== Creating a simple Item Group ==== | ||
- | To have your '' | + | To have your '' |
- | <code java [enable_line_numbers=" | + | <yarncode |
public class ExampleMod implements ModInitializer { | public class ExampleMod implements ModInitializer { | ||
- | public static final ItemGroup | + | |
- | new Identifier(" | + | new class_2960(" |
- | () -> new ItemStack(Blocks.COBBLESTONE)); | + | () -> new class_1799(class_2246.field_10445)); |
- | + | ||
- | public static final ItemGroup | + | public static final class_1761 |
- | new Identifier(" | + | new class_2960(" |
- | .icon(() -> new ItemStack(Items.BOWL)) | + | .icon(() -> new class_1799(class_1802.field_8428)) |
- | .build(); | + | .build(); |
- | // ... | + | // ... |
} | } | ||
- | </code> | + | </yarncode> |
Once '' | Once '' | ||
- | Make sure you replace the arguments ((Remember that the arguments you pass to the '' | + | Make sure you replace the arguments ((Remember that the arguments you pass to the '' |
=== Adding your Items to your Item Group === | === Adding your Items to your Item Group === | ||
- | When creating a custom Item, call '' | + | When creating a custom Item, call '' |
- | <code java> | + | <yarncode |
- | public static final Item YOUR_ITEM = new Item(new Item.Settings().group(ExampleMod.ITEM_GROUP)); | + | public static final class_1792 |
- | </code> | + | </yarncode> |
==== Making an Item Group display specific Items in a particular order ==== | ==== Making an Item Group display specific Items in a particular order ==== | ||
- | Call '' | + | Call '' |
- | <code java [enable_line_numbers=" | + | <yarncode |
public class ExampleMod implements ModInitializer { | public class ExampleMod implements ModInitializer { | ||
- | + | ||
- | public static final ItemGroup | + | public static final class_1761 |
- | new Identifier(" | + | new class_2960(" |
- | () -> new ItemStack(Blocks.COBBLESTONE)); | + | () -> new class_1799(class_2246.field_10445)); |
- | + | ||
- | public static final ItemGroup | + | public static final class_1761 |
- | new Identifier(" | + | new class_2960(" |
- | .icon(() -> new ItemStack(Items.BOWL)) | + | .icon(() -> new class_1799(class_1802.field_8428)) |
- | .appendItems(stacks -> { | + | .appendItems(stacks -> { |
- | stacks.add(new | + | stacks.add(new |
- | stacks.add(new | + | stacks.add(new |
- | stacks.add(PotionUtil.setPotion(new ItemStack(Items.POTION), Potions.WATER)); | + | stacks.add(class_1844.method_8061(new class_1799(class_1802.field_8574), class_1847.field_8991)); |
- | stacks.add(ItemStack.EMPTY); | + | stacks.add(class_1799.field_8037); |
- | stacks.add(new | + | stacks.add(new |
- | }) | + | }) |
- | .build(); | + | .build(); |
- | // ... | + | // ... |
} | } | ||
- | </code> | + | </yarncode> |
{{: | {{: |
tutorial/itemgroup.txt · Last modified: 2023/10/01 03:21 by haykam