Making mobs with multiple textures?

Started by pretztail777 on

Topic category: Advanced modding

Joined Jan 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Making mobs with multiple textures?

Hello! I am making a mostly-animals mod, and most of them are going to have many different colors. Is there a way I could code one mob to load one of many different textures on spawning (kind of like vanilla cats) so I don't have to make a bunch of the same mob? Thank you in advance!

Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
if anyone still want know is…
Sun, 09/24/2023 - 18:35

if anyone still want know is really easy you just need open your entity render and in this part


    @Override

    public ResourceLocation getTextureLocation(Entity entity) {
                       return new ResourceLocation("mod:textures/entities/texture.png");

           }




you can change the if for what you want exemple but all ways remenber to use a Not Null Action or if you use a null action add checks for this null or your game will can easy crash
boolean a = entity.getPersistentData().getBoolean("BooleanNBT");
if (a = true) { 
        return new ResourceLocation("mod:textures/entities/othertexture.png");
}
double n = entity.getPersistentData().getDouble("NBT"); // can be int float or long//
if (n == 1) {
           return new ResourceLocation("mod:textures/entities/othertexture.png");
}
string b = entity.getPersistentData().getString("NBT")
if (b.equals("STRING")){
            return new ResourceLocation("mod:textures/entities/othertexture.png");
}