tutorial:tools
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
tutorial:tools [2023/09/07 05:26] – Add suggestion to make an enum for multiple tool materials drakonkinst | tutorial:tools [2023/09/07 05:32] (current) – [Creating Tools] drakonkinst | ||
---|---|---|---|
Line 92: | Line 92: | ||
==== Creating Tools ==== | ==== Creating Tools ==== | ||
- | All base tool classes (''< | + | **In newer versions, all base tool class constructors are public and can be used directly to register the item.** This constructor lets you specify attack damage and attack speed of the tool. |
- | < | + | < |
- | public static class_1831 | + | public static class_1831 |
- | public static class_1831 | + | public static class_1831 POTATO_AXE = new AxeItem(PotatoToolMaterial.INSTANCE, |
+ | public static class_1831 | ||
</ | </ | ||
+ | |||
+ | === Creating Tool Subclasses === | ||
+ | |||
+ | **This section is not necessary in the current version of Fabric.** This is a good way to implement special attributes or behaviors for your tool, however. | ||
+ | |||
+ | In older versions, all base tool classes (''< | ||
''< | ''< | ||
Line 114: | Line 121: | ||
public static class_1831 POTATO_HOE = new CustomHoeItem(PotatoToolMaterial.INSTANCE, | public static class_1831 POTATO_HOE = new CustomHoeItem(PotatoToolMaterial.INSTANCE, | ||
</ | </ | ||
- | |||
- | If you want to add any special attributes or behaviors to your tool, create a subclass that extends one of the base tool classes, and override any required methods. | ||
==== Registering Tools ==== | ==== Registering Tools ==== |
tutorial/tools.txt · Last modified: 2023/09/07 05:32 by drakonkinst