User Tools

Site Tools


tutorial:armor_trim

Differences

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

Link to this comparison view

Next revision
Previous revision
tutorial:armor_trim [2024/05/12 11:37] – created herr_chaostutorial:armor_trim [2024/05/12 15:13] (current) – used yarn code correctly, fr this time herr_chaos
Line 1: Line 1:
-===== Adding a custom Armor Trim =====+===== Adding an Armor Trim =====
 === Introduction === === Introduction ===
 In this page you will learn how to add a new armor trim. For this tutorial we will be using ''tutorial'' as the mod id. This page is really a heavy spell check since we need to make a lot of files with specific names.\\  In this page you will learn how to add a new armor trim. For this tutorial we will be using ''tutorial'' as the mod id. This page is really a heavy spell check since we need to make a lot of files with specific names.\\ 
Line 5: Line 5:
 === Registering the Item === === Registering the 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.\\  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 <file>SmithingTemplateItem.of(new Identifier(MOD_IDTRIM_ID))</file> The TrimId can be separate from the actual item name, but for ease of making we will use the same for both.\\ +To register this item we need to register it as a new  
 +''<yarn class_8052.method_48418(new class_2960(MODIDTRIMID)>'' 
 +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: For the rest we will just need the basic thingamajig of item registration:
 <yarncode java [enable_line_numbers="true"]> <yarncode java [enable_line_numbers="true"]>
 // 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 Item TUTORIAL_ARMOR_TRIM = SmithingTemplateItem.of(new Identifier("tutorial", "tutorial_armor_trim"));  +public static final class_1792 TUTORIAL_ARMOR_TRIM = class_8052.method_48418(new class_2960("tutorial", "tutorial_armor_trim")); 
 // registering said Item with MODID "tutorial" and name "tutorial_armor_trim"  // registering said Item with MODID "tutorial" and name "tutorial_armor_trim" 
 public static void registerModItems() { public static void registerModItems() {
-    Registry.register(Registries.ITEM, new Identifier("tutorial", "tutorial_armor_trim"), TUTORIAL_ARMOR_TRIM);  +    class_2378.method_10230(class_7923.field_41178, new class_2960("tutorial", "tutorial_armor_trim"), TUTORIAL_ARMOR_TRIM);
 } }
 </yarncode> </yarncode>
Line 25: Line 28:
  
 And then just normal item textures if you desire so, but **NO LANG**, that comes later. And then just normal item textures if you desire so, but **NO LANG**, that comes later.
-=== Making it smithing table compatible. //(drawing the rest of the owl)// ===+=== Making it smithing table compatible. (drawing the rest of the owl) ===
 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.
 First we need to create a armor trim info file. This file is named First we need to create a armor trim info file. This file is named
Line 35: Line 38:
 resources/data/minecraft/trim_pattern/ resources/data/minecraft/trim_pattern/
 </file> </file>
-these and any following names and paths have to be **exactly** like displayed (obviously you need to change modid and item name, but you get what I mean).+these and any following names and paths have to be **exactly** like displayed (obviously you need to change ModId 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:\\ 
-asset_id, wich is the bevor mentioned TrimId,\\ +asset_id, which is the before mentioned TrimId\\ 
 description, which links to the lang file (we'll get to that later)\\  description, which links to the lang file (we'll get to that later)\\ 
 and the template_item, which is the item we're using.\\  and the template_item, which is the item we're using.\\ 
Line 62: Line 65:
 resources/data/minecraft/recipes/ resources/data/minecraft/recipes/
 </file> </file>
-Other than that, this is just recipe file and nothing interesting:+Other than that, this is just recipe file and nothing interesting:
 <code JavaScript> <code JavaScript>
 {   {  
Line 98: Line 101:
 </code> </code>
  
-Now if we would theoretically test this. It would workbut we would be greeted by the beautiful missing texture texture.\\ +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: So we need to:
 == Make assets == == Make assets ==
Line 104: Line 107:
 == Trim textures == == Trim textures ==
 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 name:+The file is named:
 <file> <file>
 armor_trims.json armor_trims.json
Line 177: Line 180:
 </code> </code>
  
-Now, the file has as lot inside but the only change is this tiny part:\\  +Now, the file has lot inside but the only change is this tiny part:\\  
-<file>"trims/models/armor/tutorial_armor_trim",</file> \\  +<file> 
-<file>"trims/models/armor/tutorial_armor_trim_leggings"</file>\\ +"trims/models/armor/tutorial_armor_trim",\\  
 +"trims/models/armor/tutorial_armor_trim_leggings" 
 +</file>\\ 
 The rest is just vanilla code we cant go around.\\  The rest is just vanilla code we cant go around.\\ 
  
-The last two file we need for textures are:+The last two files we need for textures are:
 <file> <file>
 tutorial_armor_trim.png tutorial_armor_trim.png
Line 190: Line 195:
 tutorial_armor_trim_leggings.png tutorial_armor_trim_leggings.png
 </file> </file>
-just like we change above. And that's also where they go. Both go into this directory:+just like we've changed above. And that's also where they go. Both go into this directory:
 <file> <file>
 resources/assets/minecraft/textures/trims/models/armor/ resources/assets/minecraft/textures/trims/models/armor/
 </file> </file>
 But now the question is: But now the question is:
-= How do I create these textures+== How do I create these textures ==
 There are a lot of ways you could do this. For example you could: \\  There are a lot of ways you could do this. For example you could: \\ 
-Use skindex or any other skineditor to have a 3d view of what you're doing, but that would give you one texture and you need two or you could edit existing trims and go free style, but the best way I've found so far is to take one of the armor textures and put it into a pixel editing tool of your choice and then also get the color palette and paint over the armor texture. Then, when you're finished drawing, you just erase the original armor texture. By doing it this way you know where the armor can even be modified, or better said where it should. \\ +Use skindex or any other skineditor to have a 3d view of what you're doing, but that would give you one texture and you need two or you could edit existing trims and go free style, but the best way I've found so far is to take one of the armor textures and put it into a pixel editing tool of your choice and then also get the color palette and paint over the armor texture. Then, when you're finished drawing, you just erase the original armor texture. By doing it this way you know where the armor can be modified, or better said where it should. \\ 
  
 With that done the trim effectively works, but in the tooltip of the armor trim and trimmed item we will have this ugly text: <file>trim_pattern.tutorial.tutorial_armor_trim</file>\\  With that done the trim effectively works, but in the tooltip of the armor trim and trimmed item we will have this ugly text: <file>trim_pattern.tutorial.tutorial_armor_trim</file>\\ 
 But this is an easy fix with some: But this is an easy fix with some:
 == Translation == == Translation ==
-In the <file>en_us.json</file> file under: <file>resources/assets/tutorial/lang/</file> we need to put this just mentioned ugly text. Like this:+In the <file>en_us.json</file> file under: <file>resources/assets/tutorial/lang/</file> we need to put thisjust mentionedugly text. Like this:
 <code JavaScript> <code JavaScript>
 {   {  
tutorial/armor_trim.1715513820.txt.gz · Last modified: 2024/05/12 11:37 by herr_chaos