Merci!!
J’ai enfin réussi. Désolé pour avoir un niveau minable @robin4002 😕
Pour ceux qui veulent avoir des textures random pour leur mobs:
A ajouter dans la classe Entité:
private static final DataParameter<Integer> ASSASSIN_VARIANT = EntityDataManager.<Integer>createKey(EntityAssassin.class, DataSerializers.VARINT);
public int getVariant()
{
return MathHelper.clamp(((Integer)this.dataManager.get(ASSASSIN_VARIANT)).intValue(), 0, 4);
}
public void setVariant(int p_191997_1_)
{
this.dataManager.set(ASSASSIN_VARIANT, Integer.valueOf(p_191997_1_));
}
protected void entityInit()
{
super.entityInit();
this.dataManager.register(ASSASSIN_VARIANT, Integer.valueOf(0));
}
@Override
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata)
{
livingdata = super.onInitialSpawn(difficulty, livingdata);
this.setVariant(this.rand.nextInt(5));
this.setEquipmentBasedOnDifficulty(difficulty);
return livingdata;
}
Et dans la classe du Rendu:
package fr.hugo.hostile.renders;
import fr.hugo.hostile.Reference;
import fr.hugo.hostile.entity.EntityAssassin;
import fr.hugo.hostile.models.ModelAssassin;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.entity.RenderBiped;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.layers.LayerHeldItem;
import net.minecraft.entity.Entity;
import net.minecraft.entity.passive.EntityOcelot;
import net.minecraft.entity.passive.EntityParrot;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.SideOnly;
public class RenderAssassin extends RenderLiving<EntityAssassin>
{
public static final ResourceLocation[] ASSASSINS_TEXTURES = new ResourceLocation[] {new ResourceLocation(Reference.MOD_ID + ":textures/humans/assassin1.png"), new ResourceLocation(Reference.MOD_ID + ":textures/humans/assassin2.png"), new ResourceLocation(Reference.MOD_ID + ":textures/humans/assassin3.png"), new ResourceLocation(Reference.MOD_ID + ":textures/humans/assassin4.png"), new ResourceLocation(Reference.MOD_ID + ":textures/humans/assassin5.png")};
public RenderAssassin(RenderManager renderManagerIn)
{
super(renderManagerIn, new ModelBiped(), 0.5F);
this.addLayer(new LayerHeldItem(this));
}
protected ResourceLocation getEntityTexture(EntityAssassin entity)
{
return ASSASSINS_TEXTURES[entity.getVariant()];
}
}
Merci beaucoup!