hello guys, i have been trying this for couple of hours and i am really stuck. I tried to find some examples from the internet that would be helpfull but nothing helped. So i have my "customEntity" which extends simply EntityZombie .
public class EntityTest extends EntityZombie {
private double maxHealth = 100.0D;
public EntityTest(World par1World) {
super(par1World);
((PathNavigateGround)this.getNavigator()).func_179688_b(true);
this.tasks.addTask(0, new EntityAISwimming(this));
}
@Override
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.maxHealth);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D);
}
}
this should be really easy and there is nothing i can screw but propably i did.. When i spawn this entity by using my own command which is like:
EntityTest entit = new EntityTest(world);
entit.setPosition(player.posX+1, player.posY, player.posZ+1);
world.spawnEntityInWorld(entit);
player.addChatComponentMessage(new ChatComponentText("SUMMON!"));
Entity is spawned but it instantly die.
But when i change
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.maxHealth);
to
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D);
it works perfectly.. So i am asking where is the problem and why is this happening
and sorry for my English (not everyone is borned at the right place ).