tutorial:items
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorial:items [2025/03/25 00:47] – solidblock | tutorial:items [2025/04/01 08:57] (current) – [Adding model, texture and model mapping] solidblock | ||
---|---|---|---|
Line 128: | Line 128: | ||
In the method '' | In the method '' | ||
- | ===== Adding model and textures | + | ===== Adding model, texture |
If you registered your item properly in the first step, you can successfully get your item by typing command ''/ | If you registered your item properly in the first step, you can successfully get your item by typing command ''/ | ||
Line 134: | Line 134: | ||
[Server-Worker-1/ | [Server-Worker-1/ | ||
- | That's because we haven' | + | That's because we haven' |
* Item model: '' | * Item model: '' | ||
* Item texture: '' | * Item texture: '' | ||
+ | * Item model definition (since 1.21.4): '' | ||
Our example texture can be found [[https:// | Our example texture can be found [[https:// | ||
A basic item model template is: | A basic item model template is: | ||
- | <code JavaScript> | + | <code JavaScript |
{ | { | ||
" | " | ||
Line 151: | Line 152: | ||
</ | </ | ||
The '' | The '' | ||
+ | |||
+ | An item model definition is also needed since 1.21.4 (not needed before 1.21.4), of which the content may be: | ||
+ | <code javascript / | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | The item model definition will define the item model that the item uses. | ||
+ | |||
+ | > :!: Creating these files manually for each item can be tiring. You may refer to [[datagen_model]] for data generation. | ||
===== Creating an Item class ===== | ===== Creating an Item class ===== | ||
Line 211: | Line 226: | ||
public static final CustomItem CUSTOM_ITEM = register(" | public static final CustomItem CUSTOM_ITEM = register(" | ||
.component(DataComponentTypes.UNBREAKABLE, | .component(DataComponentTypes.UNBREAKABLE, | ||
- | | + | |
+ | | ||
public static final Item CUSTOM_ITEM = register(" | public static final Item CUSTOM_ITEM = register(" | ||
.component(DataComponentTypes.UNBREAKABLE, | .component(DataComponentTypes.UNBREAKABLE, | ||
+ | | ||
+ | // For versions since 1.21.4: | ||
+ | public static final Item CUSTOM_ITEM = register(" | ||
+ | .component(DataComponentTypes.UNBREAKABLE, | ||
</ | </ | ||
Line 224: | Line 244: | ||
// For versions below 1.21.2: | // For versions below 1.21.2: | ||
public static final CustomItem CUSTOM_ITEM = register(" | public static final CustomItem CUSTOM_ITEM = register(" | ||
+ | | ||
// For versions since 1.21.2: | // For versions since 1.21.2: | ||
public static final Item CUSTOM_ITEM = register(" | public static final Item CUSTOM_ITEM = register(" | ||
Line 290: | Line 311: | ||
Similarly, you can use a '' | Similarly, you can use a '' | ||
===== Next Steps ===== | ===== Next Steps ===== | ||
- | [[tutorial:itemgroup|Add your item to your own ItemGroup]]. | + | Try [[itemgroup|adding |
tutorial/items.1742863622.txt.gz · Last modified: 2025/03/25 00:47 by solidblock