User Tools

Site Tools


tutorial:enchantments

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
tutorial:enchantments [2019/07/02 20:13] – finished class creation section draylartutorial:enchantments [2019/07/02 20:17] – finished registry section draylar
Line 81: Line 81:
 </code> </code>
  
 +==== Registering Enchantment ====
 +Registering enchantments follows the same process as usual:
 +<code java [enable_line_numbers="false"]>
 +private static Enchantment WRATH;
  
 +@Override
 +public void onInitialize()
 +{
 +    WRATH = Registry.register(
 +        Registry.ENCHANTMENT,
 + new Identifier("tutorial", "wrath"),
 + new WrathEnchantment(
 +     Enchantment.Weight.VERY_RARE,
 +     0,
 +     EquipmentSlot.MAINHAND
 + )
 +    );
 +}
 +</code>
 +
 +This registers our enchantment under the namespace ''tutorial:wrath'', sets it as a very rare enchantment, and only allows it on main hand tools.
tutorial/enchantments.txt · Last modified: 2023/01/04 13:52 by datsuns