TUTORIAL: Multiple textures in same mob

Started by Travesurasrojas on

Topic category: Help with Minecraft modding (Java Edition)

Joined Oct 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
TUTORIAL: Multiple textures in same mob
Sat, 08/23/2025 - 17:43 (edited)

This guide shows you how to create a single mob with multiple textures, without needing to make a separate entity for each one. 

(I'm also writing it as a reminder for myself!)

Initially, configure all the data and specifications for your mob within MCreator. We will then lock the code and insert four lines of code that will allow you to dynamically switch textures for that single mob.

After we save, we'll click on "open mod element in code editor."

Now we need to open these two files.

We need to place this line of code in the entity file. Here, we're specifying the number of textures that we'll use as variants for our mob.

    private final int textureVariant;
private static final int NUM_VARIANTS = 49;
        this.textureVariant = random.nextInt(NUM_VARIANTS);
}

public int getTextureVariant() {
return textureVariant;
}

In my case, I'll be using 49 texture variants, which is why I've entered the number 49. Remember that it's actually 50 textures, but they should always be named from 0 to 49.

And finally, this is how the entity file should look. Analyze where I've placed each line of code; they must be placed this way, or it won't work.

Now let's move on to the next file, renderer. This is the line of code we need to add.

 

    @Override
public ResourceLocation getTextureLocation(SoldadorojoespadaEntity entity) {
return new ResourceLocation("king_of_kings:textures/entities/soldadorojocuero" + entity.getTextureVariant() + ".png");
}

}

This part of the code is from my mod, so remember to replace it with your own mod's data, including the texture name, which in my case is "soldadorojocuero." With this line of code, you only need to specify the numbers for your textures (e.g., soldadorojocuero0, soldadorojocuero1, soldadorojocuero2, etc.).

Finally, it should look like this.

Lastly, we just need to save and lock the code so it isn't replaced by MCreator's support data.

If any errors appear, it could be because you incorrectly specified the location of your mod or maybe you forgot to place a symbol. I made this tutorial while performing this exact modification, and this is the final result.

The same guide but in video format (coming soon).

Edited by Travesurasrojas on Sat, 08/23/2025 - 17:43