tutorial:items
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:items [2019/06/30 23:04] – ` -> ' fixes draylar | tutorial:items [2019/08/13 14:48] – Add section showing how to set maximum stack size on custom item i509vcb | ||
---|---|---|---|
Line 11: | Line 11: | ||
{ | { | ||
// an instance of our new item | // an instance of our new item | ||
- | public static final Item FABRIC_ITEM = new Item(new Item.Settings().itemGroup(ItemGroup.MISC)); | + | public static final Item FABRIC_ITEM = new Item(new Item.Settings().group(ItemGroup.MISC)); |
[...] | [...] | ||
} | } | ||
Line 20: | Line 20: | ||
{ | { | ||
// an instance of our new item | // an instance of our new item | ||
- | public static final Item FABRIC_ITEM = new Item(new Item.Settings().itemGroup(ItemGroup.MISC)); | + | public static final Item FABRIC_ITEM = new Item(new Item.Settings().group(ItemGroup.MISC)); |
| | ||
@Override | @Override | ||
Line 98: | Line 98: | ||
{ | { | ||
// an instance of our new item | // an instance of our new item | ||
- | public static final FabricItem FABRIC_ITEM = new FabricItem(new Item.Settings().itemGroup(ItemGroup.MISC)); | + | public static final FabricItem FABRIC_ITEM = new FabricItem(new Item.Settings().group(ItemGroup.MISC)); |
[...] | [...] | ||
} | } | ||
</ | </ | ||
If you did everything correctly, using the item should now play a sound. | If you did everything correctly, using the item should now play a sound. | ||
+ | |||
+ | ==== What if I want to change the stack size of my item? ==== | ||
+ | |||
+ | For this you would use '' | ||
+ | <code java [enable_line_numbers=" | ||
+ | public class ExampleMod implements ModInitializer | ||
+ | { | ||
+ | // an instance of our new item, where the maximum stack size is 16 | ||
+ | public static final FabricItem FABRIC_ITEM = new FabricItem(new Item.Settings().group(ItemGroup.MISC).maxCount(16)); | ||
+ | [...] | ||
+ | } | ||
+ | </ | ||
+ | ==== Next Steps ==== | ||
+ | [[tutorial: |
tutorial/items.txt · Last modified: 2022/12/18 04:09 by m4x