User Tools

Site Tools


tutorial:armor_trim

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
tutorial:armor_trim [2024/07/03 06:36] – [Register the item] solidblocktutorial:armor_trim [2024/08/26 01:26] (current) solidblock
Line 8: Line 8:
 In theory we don't need to add a new item since this is more data packed than it is modded, but if you would do this using only a data pack we would be missing the nice tooltip in the description of the armor trim item. In theory we don't need to add a new item since this is more data packed than it is modded, but if you would do this using only a data pack we would be missing the nice tooltip in the description of the armor trim item.
  
-To register this item we need to register it as a new ''%%<yarn class_8052>.<yarn method_48418>(Identifier.of("tutorial", trimId))%%'', where the ''trimId'' can be separate from the actual item name, but for ease of making we will use the same for both. For the rest we will just need the basic thingamajig of [[item]] registration. Here we assume you have written a convenient static ''register'' method (see [[items]] tutorial).+To register this item we need to register it as a new ''%%<yarn class_8052>.<yarn method_48418>(Identifier.of("tutorial", trimId))%%'', where the ''trimId'' can be separate from the actual item name, but for ease of making we will use the same for both. For the rest we will just need the basic thingamajig of [[items|item]] registration. Here we assume you have written a convenient static ''register'' method (see [[items]] tutorial).
  
 <yarncode java [enable_line_numbers="true"]> <yarncode java [enable_line_numbers="true"]>
 public final class TutorialItems { public final class TutorialItems {
     // adding a new SmithingTemplateItem named "TUTORIAL_ARMOR_TRIM" with the MODID as "tutorial" and trimid as "tutorial_trim"      // adding a new SmithingTemplateItem named "TUTORIAL_ARMOR_TRIM" with the MODID as "tutorial" and trimid as "tutorial_trim" 
-    public static final class_1792 TUTORIAL_ARMOR_TRIM = register(class_8052.method_48418(new class_2960("tutorial", "tutorial_armor_trim")), "tutorial_item_trim");+    public static final class_1792 TUTORIAL_ARMOR_TRIM = register("tutorial_item_trim", class_8052.method_48418(new class_2960("tutorial", "tutorial_armor_trim")));
 } }
 </yarncode> </yarncode>
Line 32: Line 32:
 To make it work with the smithing table, which is the goal, we need to create three files. To make it work with the smithing table, which is the goal, we need to create three files.
 ==== Define the armor trim ==== ==== Define the armor trim ====
-First we need to create a armor trim info file. This file is named ''tutorial_armor_trim.json'' and goes under ''resources/data/minecraft/trim_pattern/''. These and any following names and paths have to be **exactly** like displayed (obviously you need to change namespace and item name, but you get what I mean).+First we need to create a armor trim info file. This file is named ''tutorial_armor_trim.json'' and goes under ''resources/data/<namespace>/trim_pattern/''. These and any following names and paths have to be **exactly** like displayed (obviously you need to change namespace and item name, but you get what I mean).
  
 Into this file we need to put these three things: Into this file we need to put these three things:
Line 40: Line 40:
  
 And this is what that looks like in the json file: And this is what that looks like in the json file:
-<code JavaScript>+<file JavaScript resources/data/tutorial/trim_pattern/tutorial_armor_trim.json>
 {   {  
   "asset_id": "minecraft:tutorial_armor_trim",     "asset_id": "minecraft:tutorial_armor_trim",  
Line 48: Line 48:
   "template_item": "tutorial:tutorial_armor_trim"     "template_item": "tutorial:tutorial_armor_trim"  
 } }
-</code>+</file>
  
 ==== Add smithing recipe ==== ==== Add smithing recipe ====
 The second file we need, is the smithing trim recipe. The second file we need, is the smithing trim recipe.
  
-The file can be named whatever, but it's recommended to name it something related like ''tutorial_armor_trim_smithing_trim.json'' and it is placed at ''resources/data/minecraft/recipes/''. Other than that, this is just a recipe file and nothing interesting: +The file can be named whatever, but it's recommended to name it something related like ''tutorial_armor_trim_smithing_trim.json'' and it is placed at ''resources/data/<namespace>/recipe/'' (since 1.21) or ''resources/data/<namespace>/recipes/'' (before 1.21). Other than that, this is just a recipe file and nothing interesting: 
-<code JavaScript>+<file JavaScript resources/data/tutorial/recipe/tutorial_armor_trim_smithing_trim.json>
 {   {  
   "type": "minecraft:smithing_trim",     "type": "minecraft:smithing_trim",  
Line 67: Line 67:
   }     }  
 } }
-</code>+</file>
 Take note that only the last parameter ever changes and the first three stay the same. Take note that only the last parameter ever changes and the first three stay the same.
  
 ==== Add it to tags ==== ==== Add it to tags ====
-The third file is technically optional, but we will still make it, because it's needed for the [[tags|tag]] search in the creative inventory and maybe something else (idk, haven't checked). It is named ''trim_templates.json'' and goes to ''resources/data/minecraft/tags/items/''.+The third file is technically optional, but we will still make it, because it's needed for the [[tags|tag]] search in the creative inventory and maybe something else. It is named ''trim_templates.json'' and goes to ''resources/data/<namespace>/tags/item/'' (since 1.21) or ''resources/data/<namespace>/tags/items/'' (before 1.21).
  
 Inside the file is: Inside the file is:
-<code JavaScript>+<file JavaScript resources/data/minecraft/tags/item/trim_templates.json>
 {   {  
   "replace": false,     "replace": false,  
Line 81: Line 81:
   ]     ]  
 } }
-</code>+</file>
  
 Now if we would theoretically test this, it would work but we would be greeted by the beautiful missing texture texture. So we need to: Now if we would theoretically test this, it would work but we would be greeted by the beautiful missing texture texture. So we need to:
Line 91: Line 91:
 The first file we need just points to the different texture locations and that's pretty much it. The first file we need just points to the different texture locations and that's pretty much it.
  
-The file is named ''armor_trims.json'' and belongs into the directory ''resources/assets/minecraft/atlases/''. Inside is: +The file is named ''armor_trims.json'' and belongs into the directory ''resources/assets/<namespace>/atlases/''. Inside is: 
-<code JavaScript>+<file JavaScript resources/assets/minecraft/atlases/armor_trims.json>
 {   {  
   "sources": [     "sources": [  
Line 154: Line 154:
   ]     ]  
 } }
-</code>+</file>
  
 Now, the file has a lot inside but the only change is this tiny part: Now, the file has a lot inside but the only change is this tiny part:
Line 173: Line 173:
  
 In the ''en_us.json'' file under: ''resources/assets/tutorial/lang/'', we need to put this, just mentioned, ugly text. Like this: In the ''en_us.json'' file under: ''resources/assets/tutorial/lang/'', we need to put this, just mentioned, ugly text. Like this:
-<code JavaScript>+<file JavaScript resources/assets/tutorial/lang/en_us.json>
 {   {  
   "trim_pattern.tutorial.tutorial_armor_trim": "Tutorial Armor Trim"     "trim_pattern.tutorial.tutorial_armor_trim": "Tutorial Armor Trim"  
 } }
-</code>+</file>
 But with this final step, we are done. Have fun with your new armor trims. But with this final step, we are done. Have fun with your new armor trims.
  
 If you have any more questions you can ask them on the Farbic discord and ping me @herrchaos or just look at the source code of this tutorial at:  [[https://github.com/HerrChaos/smithing-template-tutorial-mod|GitHub]] If you have any more questions you can ask them on the Farbic discord and ping me @herrchaos or just look at the source code of this tutorial at:  [[https://github.com/HerrChaos/smithing-template-tutorial-mod|GitHub]]
tutorial/armor_trim.1719988594.txt.gz · Last modified: 2024/07/03 06:36 by solidblock