tutorial:armor_trim
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorial:armor_trim [2024/05/12 15:13] – used yarn code correctly, fr this time herr_chaos | tutorial:armor_trim [2024/08/26 01:26] (current) – solidblock | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Adding an Armor Trim ===== | + | ====== Adding an Armor Trim ====== |
- | === Introduction === | + | ===== Introduction |
- | In this page you will learn how to add a new armor trim. For this tutorial | + | In this page you will learn how to add a new armor trim. As many other tutorials, |
If you, and lets be real that's most of you, are just here to copy and paste, don't worry all important things are in big nice code blocks and the GitHub repo is at the end of this page. :) | If you, and lets be real that's most of you, are just here to copy and paste, don't worry all important things are in big nice code blocks and the GitHub repo is at the end of this page. :) | ||
- | === 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.\\ | ||
- | To register this item we need to register it as a new | ||
- | ''< | ||
- | 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: | ||
- | < | ||
- | // adding a new SmithingTemplateItem named " | ||
- | public static final class_1792 TUTORIAL_ARMOR_TRIM = class_8052.method_48418(new class_2960(" | ||
- | // registering said Item with MODID " | + | ===== Register the item ===== |
- | public static | + | 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. |
- | class_2378.method_10230(class_7923.field_41178, | + | |
+ | To register this item we need to register it as a new '' | ||
+ | |||
+ | < | ||
+ | public final class TutorialItems { | ||
+ | | ||
+ | public static | ||
} | } | ||
</ | </ | ||
- | and in the ModInitializer class: | + | |
+ | and in the '' | ||
< | < | ||
- | // calling Item registration | + | public class ExampleMod implements ModInitializer { |
- | @Override | + | @Override |
- | public void onInitialize() { | + | public void onInitialize() { |
- | | + | |
+ | } | ||
} | } | ||
</ | </ | ||
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 | + | |
+ | ===== Make it compatible with smithing table compatible | ||
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 | + | ==== 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/ | + | |
- | </ | + | |
- | these and any following names and paths have to be **exactly** like displayed (obviously you need to change | + | |
- | Into this file we need to put these three things:\\ | + | Into this file we need to put these three things: |
- | asset_id, which is the before mentioned | + | * '' |
- | description, | + | * '' |
- | and the template_item, | + | * '' |
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 |
{ | { | ||
" | " | ||
Line 54: | Line 48: | ||
" | " | ||
} | } | ||
- | </ | ||
- | |||
- | 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: | + | |
- | <file> | + | ==== Add smithing recipe ==== |
- | resources/ | + | The second file we need, is the smithing trim recipe. |
- | </ | + | |
- | 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 '' |
- | <code JavaScript> | + | <file JavaScript |
{ | { | ||
" | " | ||
Line 79: | Line 67: | ||
} | } | ||
} | } | ||
- | </ | ||
- | Take note that only the last parameter ever changes and the first three stay the same.\\ | ||
- | |||
- | The third file is technically optional, but we will still make it, because it's needed for the tag search in the creative inventory and maybe something else (idk, haven' | ||
- | It is named: | ||
- | < | ||
- | trim_templates.json | ||
- | </ | ||
- | and goes to: | ||
- | < | ||
- | resources/ | ||
</ | </ | ||
+ | Take note that only the last parameter ever changes and the first three stay the same. | ||
+ | |||
+ | ==== 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. It is named '' | ||
+ | |||
Inside the file is: | Inside the file is: | ||
- | <code JavaScript> | + | <file JavaScript |
{ | { | ||
" | " | ||
Line 99: | 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.\\ | + | 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 |
Lets begin with making the trim textures first and then do the lang. | Lets begin with making the trim textures first and then do the lang. | ||
- | == Trim textures == | + | |
- | The first file we need just points to the different texture locations and that's pretty much it.\\ | + | ==== Add textures |
- | The file is named: | + | The first file we need just points to the different texture locations and that's pretty much it. |
- | < | + | |
- | armor_trims.json | + | The file is named '' |
- | </ | + | <file JavaScript |
- | and belongs into the directory: | + | |
- | < | + | |
- | resources/ | + | |
- | </ | + | |
- | Inside is: | + | |
- | <code JavaScript> | + | |
{ | { | ||
" | " | ||
Line 178: | 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: |
- | < | + | |
- | " | + | |
- | " | + | |
- | </ | + | |
- | The rest is just vanilla code we cant go around.\\ | + | |
- | The last two files we need for textures are: | + | * '' |
- | < | + | |
- | tutorial_armor_trim.png | + | |
- | </file> | + | |
- | and: | + | |
- | < | + | |
- | tutorial_armor_trim_leggings.png | + | |
- | </file> | + | |
- | just like we've changed above. And that's also where they go. Both go into this directory: | + | |
- | < | + | |
- | resources/ | + | |
- | </ | + | |
- | But now the question is: | + | |
- | == How do I create these textures == | + | |
- | 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 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: < | + | The rest is just vanilla code we cant go around. |
- | But this is an easy fix with some: | + | |
- | == Translation == | + | The last two files we need for textures are '' |
- | In the < | + | |
- | <code JavaScript> | + | But now the question is: //How do I create these textures?// |
+ | |||
+ | 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 be modified, or better said where it should. | ||
+ | |||
+ | ==== Add translations ==== | ||
+ | With that done the trim effectively works, but in the tooltip of the armor trim and trimmed item we will have this ugly text: '' | ||
+ | |||
+ | In the '' | ||
+ | <file JavaScript | ||
{ | { | ||
" | " | ||
} | } | ||
- | </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:// | 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:// |
tutorial/armor_trim.1715526791.txt.gz · Last modified: 2024/05/12 15:13 by herr_chaos