package valina02.mods.animalia.common;
import net.minecraft.client.model.ModelBase;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIFollowParent;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIMate;
import net.minecraft.entity.ai.EntityAIPanic;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAITempt;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
public class EntityDeer extends EntityAnimal
{
public EntityDeer(World world)
{
super(world);
this.setSize(0.8F, 1.0F);
this.getNavigator().setAvoidsWater(true);
this.tasks.addTask(0, new EntityAISwimming(this));
this.tasks.addTask(1, new EntityAIPanic(this, 1.25D));
this.tasks.addTask(2, new EntityAIMate(this, 1.0D));
this.tasks.addTask(3, new EntityAITempt(this, 1.2D, Items.wheat, false));
this.tasks.addTask(4, new EntityAIFollowParent(this, 1.1D));
this.tasks.addTask(5, new EntityAIWander(this, 1.0D));
this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
this.tasks.addTask(7, new EntityAILookIdle(this));
}
protected void entityInit()
{
super.entityInit();
this.dataWatcher.addObject(18, (byte)this.worldObj.rand.nextInt(2));
}
public boolean isAIEnabled()
{
return true;
}
public void applyEntityAttributes()
{
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10D);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D);
}
public EntityDeer createChild(EntityAgeable entity)
{
return new EntityDeer(this.worldObj);
}
public boolean isBreedingItem(ItemStack breed)
{
return breed != null && breed.getItem() == Items.wheat;
}
public void writeEntityToNBT (NBTTagCompound tag)
{
super.writeEntityToNBT(tag);
tag.setInteger("DeerType", this.getSkin());
}
public void readEntityFromNBT(NBTTagCompound tag)
{
super.readEntityFromNBT(tag);
this.setSkin(tag.getInteger("DeerType"));
}
public int getSkin()
{
return this.dataWatcher.getWatchableObjectByte(18);
}
public void setSkin(int skin)
{
this.dataWatcher.updateObject(18, Byte.valueOf((byte)skin));
}
}
Il y avait un problème avec la fonction setSkin.
Tu peux retirer le debug de la classe du rendu.