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 [2022/12/11 21:24] – Remove item group haykamtutorial:items [2022/12/18 04:09] – Include command to give newly created item, and syntax formatting on the same line. m4x
Line 7: Line 7:
 ==== Registering an Item ==== ==== Registering an Item ====
  
-First, create an instance of <yarn class_1792> and store it as a static final field. The constructor takes in an ''<yarn class_1792>.<yarn class_1793>'' (or a ''FabricItemSettings'') instance, which is used to set item properties such as the inventory category, durability, and stack count. +First, create an instance of <yarn class_1792> and store it as a static final field. The constructor takes in an ''<yarn class_1792>.<yarn class_1793>'' (or a ''FabricItemSettings'') instance, which is used to set item properties such as the durability, and stack count. 
  
 <yarncode java [enable_line_numbers="true"]> <yarncode java [enable_line_numbers="true"]>
Line 18: Line 18:
 </yarncode> </yarncode>
  
-You'll use the vanilla registry system for registering new content. The basic syntax is ''<yarn class_2378>#<yarn method_10230>(Registry Type, <yarn class_2960>, Content)''. Registry types are stored as static fields in the ''<yarn class_2378>'' class, 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 ''<yarn class_2378>#<yarn method_10230>(Registry Type, <yarn class_2960>, Content)''. Registry types are stored as static fields in the ''<yarn class_7923>'' or ''<yarn class_2378>'' class, 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.
  
 <yarncode java [enable_line_numbers="true"]> <yarncode java [enable_line_numbers="true"]>
Line 32: Line 32:
 } }
 </yarncode> </yarncode>
-Your new item has now been added to Minecraft. Run the run config ``Minecraft Client`` or ''runClient'' Gradle task to see it in action.+Your new item has now been added to Minecraft. Run the run config ''Minecraft Client'' or ''runClient'' Gradle task to see it in action, execute the command ''/give @s tutorial:custom_item'' in game.
  
 {{:tutorial:2019-02-17_16.50.44.png?400|}} {{:tutorial:2019-02-17_16.50.44.png?400|}}
tutorial/items.txt · Last modified: 2024/04/20 08:05 by ryhon