Started by
pretztail777
on
Topic category: Advanced modding
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!
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");
}