Bonjour,
Je travaille depuis quelques jours sur l’ajout d’un nouveau mob avec un model Techne.
C’est un mob Biped (enfin, pour moi biped ça veut dire qui a deux jambes, j’espère ne pas me tromper) c’est un grand mob (une sorte de Yéti)
J’ai suivi les deux tutos sur le site pour la création d’un mob et l’application d’un modèle techne à celui-ci
Malheureusement dès que je tente de faire spawner le mob une erreur apparait dans la console (mais le jeu continue de tourner) :
Skipping Entity with id 2
J’ai donc remplacé l’id obtenu par le “getunicentity” par un autre id, mais toujours le même problème avec l’id que je choisis.
Après multiples tests je n’arrive toujours pas à régler ce problème….
Je vous donne donc mes codes pour voir si vous vous y voyez clair :
La classe du model “Abominable” :
//
package mes.mod.client;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class Abominable extends ModelBiped
{
//fields
ModelRenderer Shape1;
ModelRenderer Shape2;
ModelRenderer Shape3;
ModelRenderer Shape4;
ModelRenderer Shape5;
ModelRenderer Shape6;
ModelRenderer Shape7;
ModelRenderer Shape8;
ModelRenderer Shape9;
ModelRenderer Shape10;
ModelRenderer Shape11;
ModelRenderer Shape12;
ModelRenderer Shape13;
ModelRenderer Shape14;
ModelRenderer Shape15;
public Abominable()
{
textureWidth = 128;
textureHeight = 64;
Shape1 = new ModelRenderer(this, 59, 0);
Shape1.addBox(0F, 0F, 0F, 5, 3, 9);
Shape1.setRotationPoint(1F, 21F, -6F);
Shape1.setTextureSize(128, 64);
Shape1.mirror = true;
setRotation(Shape1, 0F, 0F, 0F);
Shape2 = new ModelRenderer(this, 59, 0);
Shape2.addBox(0F, 0F, 0F, 5, 3, 9);
Shape2.setRotationPoint(-6F, 21F, -6F);
Shape2.setTextureSize(128, 64);
Shape2.mirror = true;
setRotation(Shape2, 0F, 0F, 0F);
Shape3 = new ModelRenderer(this, 0, 32);
Shape3.addBox(0F, 0F, 0F, 5, 14, 5);
Shape3.setRotationPoint(1F, 7F, -2F);
Shape3.setTextureSize(128, 64);
Shape3.mirror = true;
setRotation(Shape3, 0F, 0F, 0F);
Shape4 = new ModelRenderer(this, 0, 32);
Shape4.addBox(0F, 0F, 0F, 5, 14, 5);
Shape4.setRotationPoint(-6F, 7F, -2F);
Shape4.setTextureSize(128, 64);
Shape4.mirror = true;
setRotation(Shape4, 0F, 0F, 0F);
Shape5 = new ModelRenderer(this, 32, 30);
Shape5.addBox(0F, 0F, 0F, 10, 15, 7);
Shape5.setRotationPoint(-5F, -8F, -3F);
Shape5.setTextureSize(128, 64);
Shape5.mirror = true;
setRotation(Shape5, 0F, 0F, 0F);
Shape6 = new ModelRenderer(this, 34, 0);
Shape6.addBox(0F, 0F, 0F, 8, 8, 1);
Shape6.setRotationPoint(-4F, -2F, -4F);
Shape6.setTextureSize(128, 64);
Shape6.mirror = true;
setRotation(Shape6, 0F, 0F, 0F);
Shape7 = new ModelRenderer(this, 77, 32);
Shape7.addBox(0F, 0F, 0F, 6, 6, 6);
Shape7.setRotationPoint(-3F, -14F, -4F);
Shape7.setTextureSize(128, 64);
Shape7.mirror = true;
setRotation(Shape7, 0F, 0F, 0F);
Shape8 = new ModelRenderer(this, 93, 0);
Shape8.addBox(0F, 0F, 0F, 5, 1, 5);
Shape8.setRotationPoint(-9F, -9F, -2F);
Shape8.setTextureSize(128, 64);
Shape8.mirror = true;
setRotation(Shape8, 0F, 0F, 0.0523599F);
Shape9 = new ModelRenderer(this, 106, 31);
Shape9.addBox(0F, 0F, 0F, 4, 13, 5);
Shape9.setRotationPoint(-9F, -8F, -2F);
Shape9.setTextureSize(128, 64);
Shape9.mirror = true;
setRotation(Shape9, 0F, 0F, 0.0523599F);
Shape10 = new ModelRenderer(this, 106, 31);
Shape10.addBox(0F, 0F, 0F, 4, 13, 5);
Shape10.setRotationPoint(5F, -8F, -2F);
Shape10.setTextureSize(128, 64);
Shape10.mirror = true;
setRotation(Shape10, 0F, 0F, -0.0523599F);
Shape11 = new ModelRenderer(this, 93, 0);
Shape11.addBox(0F, 0F, 0F, 5, 1, 5);
Shape11.setRotationPoint(4F, -9F, -2F);
Shape11.setTextureSize(128, 64);
Shape11.mirror = true;
setRotation(Shape11, 0F, 0F, -0.0523599F);
Shape12 = new ModelRenderer(this, 0, 14);
Shape12.addBox(0F, 0F, 0F, 4, 1, 2);
Shape12.setRotationPoint(3F, -13F, -2F);
Shape12.setTextureSize(128, 64);
Shape12.mirror = true;
setRotation(Shape12, 0F, 0F, 0F);
Shape13 = new ModelRenderer(this, 0, 0);
Shape13.addBox(0F, 0F, 0F, 2, 2, 2);
Shape13.setRotationPoint(5F, -15F, -2F);
Shape13.setTextureSize(128, 64);
Shape13.mirror = true;
setRotation(Shape13, 0F, 0F, 0F);
Shape14 = new ModelRenderer(this, 0, 14);
Shape14.addBox(0F, 0F, 0F, 4, 1, 2);
Shape14.setRotationPoint(-7F, -13F, -2F);
Shape14.setTextureSize(128, 64);
Shape14.mirror = true;
setRotation(Shape14, 0F, 0F, 0F);
Shape15 = new ModelRenderer(this, 0, 0);
Shape15.addBox(0F, 0F, 0F, 2, 2, 2);
Shape15.setRotationPoint(-7F, -15F, -2F);
Shape15.setTextureSize(128, 64);
Shape15.mirror = true;
setRotation(Shape15, 0F, 0F, 0F);
}
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
super.render(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
Shape1.render(f5);
Shape2.render(f5);
Shape3.render(f5);
Shape4.render(f5);
Shape5.render(f5);
Shape6.render(f5);
Shape7.render(f5);
Shape8.render(f5);
Shape9.render(f5);
Shape10.render(f5);
Shape11.render(f5);
Shape12.render(f5);
Shape13.render(f5);
Shape14.render(f5);
Shape15.render(f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
}
}
Ensuite il y a la classe De l’entité : “MobAbominable”
package mes.mod.client;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.world.World;
public class MobAbominable extends EntityCreature {
public MobAbominable(World world)
{
super(world);
}
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(70D);
this.getEntityAttribute(SharedMonsterAttributes.followRange).setAttribute(40.0D);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.4D);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(15.0D);
}
}
Ensuite la classe “Render” du mob : “RenderAbominable” :
package mes.mod;
import mes.mod.client.Abominable;
import mes.mod.client.MobAbominable;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.entity.RenderBiped;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
public class RenderAbominable extends RenderBiped {
protected static final ResourceLocation texture = new ResourceLocation("abominable.png");
public RenderAbominable(ModelBiped abominable, float par2) {
super(abominable, par2);
// TODO Auto-generated constructor stub
}
protected ResourceLocation getAbominableTextures(MobAbominable abominable)
{
return texture;
}
protected ResourceLocation getEntityTexture(Entity par1Entity)
{
return this.getAbominableTextures((MobAbominable)par1Entity);
}
}
Puis le “ClientProxy” :
package mes.mod.client ;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import mes.mod.EntityExcalibur;
import mes.mod.ExcaliburRender;
import mes.mod.RenderAbominable;
import mes.mod.common.CommonProxy;
public class ClientProxy extends CommonProxy
{
@Override
public void registerRender()
{
RenderingRegistry.registerEntityRenderingHandler(MobAbominable.class, new RenderAbominable(new Abominable(), 0.5F));
}
}
Et enfin les lignes concernant le mob dans ma classe principale :
//Mobs
proxy.registerRender();
EntityRegistry.registerGlobalEntityID(MobAbominable.class, "Abominable", 355, 24, 30);
EntityRegistry.registerModEntity(MobAbominable.class, "Abominable", 2030, this, 40, 1, true);
EntityRegistry.addSpawn(MobAbominable.class, 1, 4, 4, EnumCreatureType.creature);
LanguageRegistry.instance().addStringLocalization("entity.Abominable.name", "Abominable");
Voilà voilà, je n’y arrive vraiment pas
Merci à l’avance de votre aide