-
-
Notifications
You must be signed in to change notification settings - Fork 538
Robit Skins
Robits can have a lot of different skins, this document explains how you can make new ones:
Whenever something is formatted like this <abc>
it's intended to be replaced with something else.
ResourceLocations are something, that points to a resource. For our use case this means textures and models, but they can point to a lot of different resources. They are made out of 2 parts; the first is the namespace, a string that should be unique to your project that you are trying to make to prevent potential conflicts.
The second part is the path, also a text that points to a resource in your namespace and should be unique within your project. Both parts can only contain lowercase letters, numbers, underscore, minus and the dot. The path can also contain a forward slash (/
).
Skins have to be registered, that means in 1.20+ that means you need to make a datapack and in earlier versions of Minecraft that means that you either need to write a Java Mod, or register them using the CraftTweaker Integration. The most basic form of Robit skins is made out of a collection of textures with at least one. You can add more for animations. Usually Robits use it for moving the treads. Each texture is shown for 3 ticks (around 1/7th of a second) and updates when the Robit moves, so you might have to repeat a texture to slow down the animation.
You first have to create a Datapack (check the Minecraft Wiki for help on how to set it up). You then will need to create a json file with the path data/<your_namespace>/mekanism/robit_skin/<name>.json
Mekanism currently has two builtin types of Robit Skin serializers that can be specified in json by including one of the two following lines in the main json block:
"type": "mekanism:basic",
"type": "mekanism:advancement_based",
Both of these types require a "textures"
block with the textures you want the skin to use:
"textures": [
"<your_namespace>:<texture_name1>",
"<your_namespace>:<texture_name2>"
]
Both types also support an optional "custom_model"
field (in versions before 10.6.0, this was "customModel"
instead) that takes a resource location and specifies the location to look for the model at:
"custom_model": "<your_namespace>:<modelname>",
For the advancement_based
Robit skins you must also specify the resource location of an advancement that will be checked for to see if a player has access to the skin. An example of this can be seen in our Allay Robit skin.
More examples for of complete syntax for Robit skins via datapacks can be seen here.
Create a Minecraft Instance and add CraftTweaker. Launch the game, it should create a scripts
folder. In there you can create zenscript files to add custom Robits.
Create a zenscript file and name it however you like, making sure the file extension is .zs
. Add these lines at the top of the file:
#loader mekanismcontent
import mods.mekanism.content.builder.RobitSkinBuilder;
import crafttweaker.api.resource.ResourceLocation;
Now it's time to register the Skins. To register a skin with the default model you add lines like this:
RobitSkinBuilder.builder(new ResourceLocation("<your_namespace>", "<texturename>"))
.build("<name>");
The ResourceLocation, that is passed into the builder is the place where you put your texture. You can pass in multiple ResourceLocations separated by a comma (,
). You should change <name>
to the name of the skin you want to create. Make sure that you follow the requirements for the path.
To register a Skin with a custom model you have to add some lines like this instead:
RobitSkinBuilder.builder(new ResourceLocation("<your_namespace>", "<texturename1>"), new ResourceLocation("<your_namespace>", "<texturename2>"))
.customModel(new ResourceLocation("<your_namespace>", "<modelname>"))
.build("<name>");
This Skin has 2 textures that cycle through and a custom model. How to create a custom model is described later in this document.
This is an example you can try if you want to check everything is setup correctly.
RobitSkinBuilder.builder(new ResourceLocation("mekanism", "allay"), new ResourceLocation("mekanism", "allay2"))
.customModel(new ResourceLocation("mekanism", "item/robit_allay"))
.build("my_cool_allay_skin");
You first have to create a Resourcepack (check the Minecraft Wiki for help on how to set it up).
Model: Put your model here: assets/<your_namespace>/models/<modelname>.json
Textures: Put your textures here: assets/<your_namespace>/textures/entity/robit/<texturename>.png
Now let's name your skin, create a lang file at assets/<your_namespace>/lang/en_us.json
and if you are using a datapack put this into it:
{
"robit_skin.<your_namespace>.<name>": "<This is a really cool name>"
}
Otherwise, if you are using CraftTweaker put this into it:
{
"robit_skin.crafttweaker.<name>": "<This is a really cool name>"
}
You can also create a custom model by writing json item model by hand or by using tools like BlockBench. For the next part it's beneficial if you have a grasp on how json is structured (a short tutorial is available here) if you already know how json works, then you don't need this introduction.
Your texture reference should be called robit
for consistency. It's not needed, because all unresolved textures are changed to use the Robit assigned textures, but it should be done regardless. Remove the textures
json object if it only contains your robit
texture, or remove the robit
line, if the textures
json object contains some other textures that you don't want animated.
Set the loader field to mekanism:robit
by either changing it or adding this line into the main json object
"loader": "mekanism:robit",
This makes sure that the textures are properly applied to the model.
Set the parent field to mekanism:item/robit
by either changing it or adding this line into the main json object
"parent": "mekanism:item/robit",
This makes sure that the item is properly rotated in the GUI.