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
tutorial:items [2025/04/01 08:00] – [Next Steps] solidblocktutorial:items [2025/04/01 08:57] (current) – [Adding model, texture and model mapping] solidblock
Line 128: Line 128:
 In the method ''Items.register'', the registry key will be written in the ''settings'' first, and then use that ''settings'' to create the item. In the method ''Items.register'', the registry key will be written in the ''settings'' first, and then use that ''settings'' to create the item.
  
-===== Adding model, texture and model mapping =====+===== Adding model, texture and model definition =====
  
 If you registered your item properly in the first step, you can successfully get your item by typing command ''/give @s tutorial:custom_item''. You will find it has missing texture, and Minecraft will complain about a missing texture file in a fashion similar to this: If you registered your item properly in the first step, you can successfully get your item by typing command ''/give @s tutorial:custom_item''. You will find it has missing texture, and Minecraft will complain about a missing texture file in a fashion similar to this:
Line 134: Line 134:
     [Server-Worker-1/WARN]: Unable to load model: 'tutorial:custom_item#inventory' referenced from: tutorial:custom_item#inventory: java.io.FileNotFoundException: tutorial:models/item/custom_item.json     [Server-Worker-1/WARN]: Unable to load model: 'tutorial:custom_item#inventory' referenced from: tutorial:custom_item#inventory: java.io.FileNotFoundException: tutorial:models/item/custom_item.json
  
-That's because we haven't provided the item with **textures**, **baked models** (we call them "models" for short) and **model mapping**. Those files are located in the following places respectively:+That's because we haven't provided the item with **textures**, **baked models** (we call them "models" for short) and **model definition** (also called model mapping). Those files are located in the following places respectively:
  
   * Item model: ''.../resources/assets/tutorial/models/item/custom_item.json''   * Item model: ''.../resources/assets/tutorial/models/item/custom_item.json''
   * Item texture: ''.../resources/assets/tutorial/textures/item/custom_item.png''   * Item texture: ''.../resources/assets/tutorial/textures/item/custom_item.png''
-  * Item model mapping (since 1.21.4): ''.../resources/assets/tutorial/items/custom_item.json''+  * Item model definition (since 1.21.4): ''.../resources/assets/tutorial/items/custom_item.json''
  
 Our example texture can be found [[https://i.imgur.com/CqLSMEQ.png|here]]. Our example texture can be found [[https://i.imgur.com/CqLSMEQ.png|here]].
Line 153: Line 153:
 The ''parent'' of your item model changes how it's rendered in the hand and comes in useful for things like block items in the inventory. ''item/generated'' is used for many simple items. ''item/handheld'' is used for tools that are held from the bottom left of the texture. In the json, ''textures/layer0'' is the location of your image file. The ''parent'' of your item model changes how it's rendered in the hand and comes in useful for things like block items in the inventory. ''item/generated'' is used for many simple items. ''item/handheld'' is used for tools that are held from the bottom left of the texture. In the json, ''textures/layer0'' is the location of your image file.
  
-An item model mapping is also needed since 1.21.4 (not needed before 1.21.4), of which the content may be:+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 /resources/assets/tutorial/items/custom_item.json> <code javascript /resources/assets/tutorial/items/custom_item.json>
 { {
Line 163: Line 163:
 </code> </code>
  
-The item model mapping will define the item model that the item uses.+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 these files manually for each item can be tiring. You may refer to [[datagen_model]] for data generation.
tutorial/items.txt · Last modified: 2025/04/01 08:57 by solidblock