User Tools

Site Tools


tutorial:items

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
tutorial:items [2019/06/30 23:04] – small refactoring draylartutorial:items [2019/08/03 22:28] – Added “next steps” fudge
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));
     [...]     [...]
 } }
 </code> </code>
-You'll use the vanilla ``Registry`` system for registering new content. The basic syntax is ``Registry#register(Registry Type, Identifier, Content)``. Registry types are stored as static fields in the ``Registry`` object, and the identifier is what labels your content. Content is an instance of whatever you're adding. This can be called anywhere as long as it occurs during initialization.+You'll use the vanilla registry system for registering new content. The basic syntax is ''Registry#register(Registry Type, Identifier, Content)''. Registry types are stored as static fields in the ''Registry'' object, and the identifier is what labels your content. Content is an instance of whatever you're adding. This can be called anywhere as long as it occurs during initialization.
 <code java [enable_line_numbers="true"]> <code java [enable_line_numbers="true"]>
 public class ExampleMod implements ModInitializer public class ExampleMod implements ModInitializer
 { {
     // 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));
     [...]     [...]
 } }
 </code> </code>
 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.
 +
 +==== Next Steps ====
 +[[tutorial:itemgroup|Add your item to your own ItemGroup]].
tutorial/items.txt · Last modified: 2024/04/15 01:24 by solidblock