Animation d'un mob !
-
J’imagine que tu n’as pas vu l’edit^^ Euh mon mob bouge ,ils bougent ses bras en marchant, ils bougent ses pieds en marchants mais je voudrai une animation d’attaque peut être me suis je mal exprimer dans mon post^^
EDIT :
Voici ma classe Render au complet tous en bas se trouve se que je pense être les rotations des bras pour l’attaque et aussi mon mob a tendense a marcher en diagonale et attaquer en diagonale aussi
:::package Entity; import com.mod2.Reference; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.entity.RenderBiped; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EnumCreatureAttribute; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class RenderMod2 extends RenderBiped { public final ResourceLocation texture = new ResourceLocation(Reference.MOD_ID, "textures/entity/MonMobl.png"); public RenderMod2(RenderManager rendermanager, ModelBiped model, float shadow) { super (rendermanager, model, shadow); // TODO Auto-generated constructor stub } protected ResourceLocation getEntityTexture(EntityLiving living) { return this.getMobTutorielTexture((MonMob1)living); } private ResourceLocation getMobTutorielTexture(MonMob1 mobTutoriel) { return texture; } public int getMaxHealth() { return 100; } public int getAttackStrength(Entity par1Entity) { return 10; } public EnumCreatureAttribute getCreatureAttribute() { return EnumCreatureAttribute.UNDEFINED; } @SideOnly(Side.CLIENT) public class ModelMonMob1 extends ModelBiped { public ModelMonMob1() { this(0.0F, false); } protected ModelMonMob1(float p_i1167_1_, float p_i1167_2_, int p_i1167_3_, int p_i1167_4_) { super(p_i1167_1_, p_i1167_2_, p_i1167_3_, p_i1167_4_); } public ModelMonMob1(float p_i1168_1_, boolean p_i1168_2_) { super(p_i1168_1_, 0.0F, 64, p_i1168_2_ ? 32 : 64); } public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity p_78087_7_) { super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, p_78087_7_); float f6 = MathHelper.sin(this.swingProgress * (float)Math.PI); float f7 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * (float)Math.PI); this.bipedRightArm.rotateAngleZ = 0.0F; this.bipedLeftArm.rotateAngleZ = 0.0F; this.bipedRightArm.rotateAngleY = -(0.1F - f6 * 0.6F); this.bipedLeftArm.rotateAngleY = 0.1F - f6 * 0.6F; this.bipedRightArm.rotateAngleX = -((float)Math.PI / 2F); this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F); this.bipedRightArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F; this.bipedLeftArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F; this.bipedRightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; this.bipedRightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; this.bipedLeftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; } } }:::
-
Effectivement j’avais pas compris
du coup créer une classe ModelMonMob1
[font=Ubuntu, sans-serifVoila la classe du Model du zombie]
Code :
public class ModelZombie extends ModelBiped { private static final String __OBFID = "CL_00000869"; public ModelZombie() { this(0.0F, false); } protected ModelZombie(float p_i1167_1_, float p_i1167_2_, int p_i1167_3_, int p_i1167_4_) { super(p_i1167_1_, p_i1167_2_, p_i1167_3_, p_i1167_4_); } public ModelZombie(float p_i1168_1_, boolean p_i1168_2_) { super(p_i1168_1_, 0.0F, 64, p_i1168_2_ ? 32 : 64); } /** * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how * "far" arms and legs can swing at most. */ public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity p_78087_7_) { super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, p_78087_7_); float f6 = MathHelper.sin(this.onGround * (float)Math.PI); float f7 = MathHelper.sin((1.0F - (1.0F - this.onGround) * (1.0F - this.onGround)) * (float)Math.PI); this.bipedRightArm.rotateAngleZ = 0.0F; this.bipedLeftArm.rotateAngleZ = 0.0F; this.bipedRightArm.rotateAngleY = -(0.1F - f6 * 0.6F); this.bipedLeftArm.rotateAngleY = 0.1F - f6 * 0.6F; this.bipedRightArm.rotateAngleX = -((float)Math.PI / 2F); this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F); this.bipedRightArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F; this.bipedLeftArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F; this.bipedRightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; this.bipedRightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; this.bipedLeftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; } }[font=Ubuntu, sans-serifChange par le nom de ton mob ModelMob1 et ensuite change dans ta classe tout les ModelZombie]
[font=Ubuntu, sans-serifQuand tu a fais ca dis moi :)]
-
je l’avais fait^^
Mot pour mot ce que tu as dis^^
Mais sa n’avais pas marcher pour ça que je t’ai demande ou enregistrer la classe model pour qu’elle soit reconu -
Bah dans tes deux classes Entity et Render lorsque tu vois ModelZombie tu remplace par ModelMonMob …
-
Je n’ai marque nul part ModelZombie
Voici la classe principale de mon mob :
:::package Entity; import javax.swing.text.html.parser.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.ai.EntityMoveHelper; import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.entity.monster.EntityIronGolem; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.monster.IMob; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.pathfinding.PathNavigateGround; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class MonMob1 extends EntityMob { public MonMob1(World worldIn) { super(worldIn); ((PathNavigateGround)this.getNavigator()).func_179688_b(true); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 0.3D,false)); this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityEnderman.class, 0.3D, false)); this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityZombie.class, 0.3D, false)); this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntitySkeleton.class, 0.3D, false)); this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityMob.class, 0.3D, false)); this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 0.3D)); this.tasks.addTask(7, new EntityAIWander(this, 0.3D)); this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, false)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityMob.class, false)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityEnderman.class, false)); } public void applyEntityAttributes1() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(20D); this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(10D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.3); this.worldObj.spawnEntityInWorld( attackingPlayer ); this.setCurrentItemOrArmor(4, new ItemStack(this.rand.nextFloat() < 0.1F ? Blocks.lit_pumpkin : Blocks.pumpkin)); } protected void addRandomArmor() { switch (this.rand.nextInt(3)) { case 0: this.dropItem(Items.iron_ingot, 1); break; case 1: this.dropItem(Items.carrot, 1); break; case 2: this.dropItem(Items.potato, 1); } } protected Item getDropItem() { return Items.boat; } public boolean attackEntityFrom(DamageSource source, float amount) { if (super.attackEntityFrom(source, amount)) { EntityLivingBase entitylivingbase = this.getAttackTarget(); if (entitylivingbase == null && source.getEntity() instanceof EntityLivingBase) { entitylivingbase = (EntityLivingBase)source.getEntity(); } int i = MathHelper.floor_double(this.posX); int j = MathHelper.floor_double(this.posY); int k = MathHelper.floor_double(this.posZ); } return isDead; } }:::
La classe Render :
:::package Entity; import com.mod2.Reference; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.entity.RenderBiped; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EnumCreatureAttribute; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class RenderMod2 extends RenderBiped { public final ResourceLocation texture = new ResourceLocation(Reference.MOD_ID, "textures/entity/MonMobl.png"); public RenderMod2(RenderManager rendermanager, ModelBiped model, float shadow) { super (rendermanager, model, shadow); // TODO Auto-generated constructor stub } protected ResourceLocation getEntityTexture(EntityLiving living) { return this.getMobTutorielTexture((MonMob1)living); } private ResourceLocation getMobTutorielTexture(MonMob1 mobTutoriel) { return texture; } public int getMaxHealth() { return 100; } public int getAttackStrength(Entity par1Entity) { return 10; } public EnumCreatureAttribute getCreatureAttribute() { return EnumCreatureAttribute.UNDEFINED; } }:::
La classe Model :
:::package Entity; import net.minecraft.client.model.ModelBiped; import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class ModelMonMob1 extends ModelBiped { private static final String __OBFID = "CL_00000869"; public ModelMonMob1() { this(0.0F, false); } protected ModelMonMob1(float p_i1167_1_, float p_i1167_2_, int p_i1167_3_, int p_i1167_4_) { super(p_i1167_1_, p_i1167_2_, p_i1167_3_, p_i1167_4_); } public ModelMonMob1(float p_i1168_1_, boolean p_i1168_2_) { super(p_i1168_1_, 0.0F, 64, p_i1168_2_ ? 32 : 64); } /** * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how * "far" arms and legs can swing at most. */ public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity p_78087_7_) { super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, p_78087_7_); float f6 = MathHelper.sin(this.swingProgress * (float)Math.PI); float f7 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * (float)Math.PI); this.bipedRightArm.rotateAngleZ = 0.0F; this.bipedLeftArm.rotateAngleZ = 0.0F; this.bipedRightArm.rotateAngleY = -(0.1F - f6 * 0.6F); this.bipedLeftArm.rotateAngleY = 0.1F - f6 * 0.6F; this.bipedRightArm.rotateAngleX = -((float)Math.PI / 2F); this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F); this.bipedRightArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F; this.bipedLeftArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F; this.bipedRightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; this.bipedRightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; this.bipedLeftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; } }:::
-
Je comprend plus rien , la si tu lance le jeu ton mob ressemble a quoi ? Car y a aucun extends de Model donc il doit pas apparaître ? Si je ne me trompe pas. Sinon dans le proxy
RenderingRegistry.registerEntityRenderingHandler(EntityMobTutoriel.class, new RenderMobTutoriel(new ModelBiped(), 0.5F));Ta juste a remplacer
-
J’ai déjà cette ligne^^ Mon mob apparait en jeu avec sa texture, il bouge , tape les autres mobs, me tape mais sans animation au moment de taper il leve pas les bras il se colle juste et sa fait des degats
-
Essaye ça dans la class de ton mob:
setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
ventre.render(par7);
pied1.render(par7);
pied2.render(par7);
pied3.render(par7);
pied4.render(par7);
tour.render(par7);
dos.render(par7);
tete.render(par7);
}private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity){
//Head Movement:
this.tete.rotateAngleY = par4 / (190F / (float)Math.PI);
this.tete.rotateAngleX = par5 / (180F / (float)Math.PI);
//Head Movement END////Rightarm Movement:
this.pied1.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 2.0F * par2 * 0.5F;
this.pied1.rotateAngleZ = 0.0F;
//Rightarm Movement END////Leftarm Movement:
this.pied2.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 2.0F * par2 * 0.5F;
this.pied2.rotateAngleZ = 0.0F;
//Leftarm Movement END////Rightleg Movement:
this.pied3.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2;
this.pied3.rotateAngleZ = 0.0F;
//Rightleg Movement END////LeftLeg Movement:
this.pied4.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2;
//LeftLeg Movement END//
}Remplace pied 1 , pied 2 , pied 3 , pied 4 , tete , ventre , tour et dos par les nom de ta classe.
-
@‘Kriksou’:
J’ai déjà cette ligne^^ Mon mob apparait en jeu avec sa texture, il bouge , tape les autres mobs, me tape mais sans animation au moment de taper il leve pas les bras il se colle juste et sa fait des degats
Ok je pensais que ModelBipied était une classe à part donc ton ModelBipied doit etre remplacer par ton propre model , sinon tu pourra pas l’animer lorsqu’il te tape ^^ Donc dans la déclaration dans le proxy met ton ModelMob1
ensuite faut chercher pour que lorsque ton mob attaque tu fais l’annimation , dans le model bipied y a des trucs comme
if (this.aimedBow) { f6 = 0.0F; f7 = 0.0F; this.bipedRightArm.rotateAngleZ = 0.0F; this.bipedLeftArm.rotateAngleZ = 0.0F; this.bipedRightArm.rotateAngleY = -(0.1F - f6 * 0.6F) + this.bipedHead.rotateAngleY; this.bipedLeftArm.rotateAngleY = 0.1F - f6 * 0.6F + this.bipedHead.rotateAngleY + 0.4F; this.bipedRightArm.rotateAngleX = -((float)Math.PI / 2F) + this.bipedHead.rotateAngleX; this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F) + this.bipedHead.rotateAngleX; this.bipedRightArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F; this.bipedLeftArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F; this.bipedRightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; this.bipedRightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; this.bipedLeftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; }cherche si il y a un this. pour vérifier l’attaque.
-
Euh je n’ai pas tres bien compris Legrandfifou ^^ Florian je n’ai pas compris par quoi remplacer les pieds et autres je n’ai pas cree mon propre model du coups je n’ai pas de pieds et de mains a moi dites le moi si se que je dis ne parait pas claire^^ même moi j’ai du mal a me comprendre
