Salut tout le monde,
bon alors j'ai un gros problème. J'ai créer un mob et ce mob doit attaquer toutes les mobs. Sauf que lorsqu'il spawn il s'inflige des dégats à lui même et de plus il ne bouge pas. Voici une partie du code du mob.
bon alors j'ai un gros problème. J'ai créer un mob et ce mob doit attaquer toutes les mobs. Sauf que lorsqu'il spawn il s'inflige des dégats à lui même et de plus il ne bouge pas. Voici une partie du code du mob.
Code:
package net.minecraft.src;
import java.util.*;
import net.minecraft.client.Minecraft;
public class EntityGanondorf extends EntityCreature
{
public EntityGanondorf(World world)
{
super(world);
texture = "/mod_Zelda_mob/Ganondorf.png";
attackStrength = 10;
health = 70;
}
public ItemStack getHeldItem()
{
return new ItemStack(net.minecraft.src.mod_Zelda.EpeeDeLumiere);
}
protected int getDropItemId()
{
return mod_Zelda.GanondorfRecord.shiftedIndex;
}
protected Entity findPlayerToAttack()
{
double d = -1D;
EntityLiving entityliving = null;
for(int i = 0; i < worldObj.loadedEntityList.size(); i++)
{
Entity entity = (Entity)worldObj.loadedEntityList.get(i);
if(!(entity instanceof EntityLiving) || (entity instanceof EntityCreature) && !(entity instanceof EntityGanondorf))
{
continue;
}
double d1 = entity.getDistance(posX, posY, posZ);
if(d1 < 16D && (d == -1D || d1 < d) && ((EntityLiving)entity).canEntityBeSeen(this))
{
d = d1;
entityliving = (EntityLiving)entity;
}
}
return entityliving;
}
protected void attackEntity(Entity entity, float f)
{
if(attackTime <= 0 && f < 2.0F && entity.boundingBox.maxY > boundingBox.minY && entity.boundingBox.minY < boundingBox.maxY)
{
attackTime = 20;
entity.attackEntityFrom(this, attackStrength);
}
}
protected String getHurtSound()
{
return "mob_zelda.GanondorfHurt";
}
protected String getDeathSound()
{
return "mob_zelda.GanondorfDeath";
}
protected String getLivingSound()
{
return "mob_zelda.Ganondorf";
}
public int getMaxSpawnedInChunk()
{
return 1;
}
protected int attackStrength;
}