Oh yeah, I forgot to mention; all my entites are spawning as blocks, here are the code for an entity called Zertum:
EntityFile
public class EntityZertum extends EntityCustomTameable
{
private float headRotationCourse;
private float headRotationCourseOld;
private boolean isWet;
private boolean isShaking;
private float timeWolfIsShaking;
private float prevTimeWolfIsShaking;
public static final double maxHealth = 25;
public static final double attackDamage = 6;
public static final double speed = 0.30000001192092896;
public static final double maxHealthTamed = 35;
public static final double attackDamageTamed = 8;
public static final double maxHealthBaby = 10;
public static final double attackDamageBaby = 2;
public EntityZertum(World worldIn)
{
super(worldIn);
this.setSize(0.6F, 1.5F);
((PathNavigateGround)this.getNavigator()).func_179690_a(true);
this.tasks.addTask(1, new EntityAISwimming(this));
this.tasks.addTask(2, this.aiSit);
this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F));
this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, true));
this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F));
this.tasks.addTask(6, new EntityAIMate(this, 1.0D));
this.tasks.addTask(6, aiFetchBone);
this.tasks.addTask(7, new EntityAIWander(this, 1.0D));
this.tasks.addTask(8, new EntityCustomZAIBeg(this, 8.0F));
this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
this.tasks.addTask(9, new EntityAILookIdle(this));
this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this));
this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true, new Class[0]));
this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntityAnimal.class, false, new Predicate()
{
private static final String __OBFID = "CL_00002229";
public boolean func_180094_a(Entity p_180094_1_)
{
return p_180094_1_ instanceof EntitySheep || p_180094_1_ instanceof EntityRabbit;
}
public boolean apply(Object p_apply_1_)
{
return this.func_180094_a((Entity)p_apply_1_);
}
}));
this.targetTasks.addTask(5, new EntityAINearestAttackableTarget(this, EntitySkeleton.class, false));
this.setTamed(false);
this.inventory = new InventoryPack(this);
}
@Override
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxHealth);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(attackDamage);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(speed);
if (this.isTamed())
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxHealthTamed);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(attackDamageTamed);
}
else if (this.isChild())
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxHealthBaby);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(attackDamageBaby);
}
}
/**
* Sets the active target the Task system uses for tracking
*/
@Override
public void setAttackTarget(EntityLivingBase p_70624_1_)
{
super.setAttackTarget(p_70624_1_);
if (p_70624_1_ == null)
{
this.setAngry(false);
}
else if (!this.isTamed())
{
this.setAngry(true);
}
}
@Override
protected void updateAITasks()
{
this.dataWatcher.updateObject(18, Float.valueOf(this.getHealth()));
}
@Override
protected void entityInit()
{
super.entityInit();
this.dataWatcher.addObject(18, new Float(this.getHealth()));
this.dataWatcher.addObject(19, new Byte((byte)0));
this.dataWatcher.addObject(20, new Byte((byte)EnumDyeColor.RED.func_176765_a()));
}
@Override
protected void func_180429_a(BlockPos p_180429_1_, Block p_180429_2_)
{
this.playSound("mob.wolf.step", 0.15F, 1.0F);
}
@Override
public void writeEntityToNBT(NBTTagCompound tagCompound)
{
super.writeEntityToNBT(tagCompound);
tagCompound.setBoolean("Angry", this.isAngry());
tagCompound.setByte("CollarColor", (byte)this.func_175546_cu().getDyeColorDamage());
}
@Override
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
super.readEntityFromNBT(tagCompund);
this.setAngry(tagCompund.getBoolean("Angry"));
if (tagCompund.hasKey("CollarColor", 99))
{
this.func_175547_a(EnumDyeColor.func_176766_a(tagCompund.getByte("CollarColor")));
}
}
/**
* Returns the sound this mob makes while it's alive.
*/
@Override
protected String getLivingSound()
{
return this.canSeeCreeper ? "mob.wolf.growl" : this.isAngry() ? "mob.wolf.growl" :
(this.rand.nextInt(3) == 0 ?
(this.isTamed() && this.getHealth() <= 10.0F ? "mob.wolf.whine"
: "mob.wolf.panting")
: "mob.wolf.bark");
}
/**
* Returns the sound this mob makes when it is hurt.
*/
@Override
protected String getHurtSound()
{
return "mob.wolf.hurt";
}
/**
* Returns the sound this mob makes on death.
*/
@Override
protected String getDeathSound()
{
return "mob.wolf.death";
}
/**
* Returns the volume for the sounds this mob makes.
*/
@Override
protected float getSoundVolume()
{
return 0.5F;
}
/**
* Get number of ticks, at least during which the living entity will be silent.
*/
@Override
public int getTalkInterval() {
if(this.canSeeCreeper){
return 40;
}else if(this.getHealth() <=10){
return 20;
}else{
return 200;
}
}
/**
* Returns the item ID for the item the mob drops on death.
*/
@Override
protected void dropFewItems(boolean par1, int par2)
{
rare = rand.nextInt(20);
{
if (this.isBurning())
{
this.dropItem(ModItems.zertumMeatCooked, 1);
}
else if (rare <= 12)
{
this.dropItem(ModItems.zertumMeatRaw, 1);
}
if(rare <= 6 && !this.isTamed())
{
this.dropItem(ModItems.nileGrain, 1);
}
/*if(this.hasRadarCollar())
{
this.dropItem(ModItems.radioCollar, 1);
}*/
/*if(rare >= 17)
{
this.dropItem(ModItems.darkDust.itemID, 1);
}*/
else
{
}
}
}
/**
* Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
* use this to react to sunlight and start to burn.
*/
@Override
public void onLivingUpdate() //TODO
{
super.onLivingUpdate();
if (isServer() && this.isWet && !this.isShaking && !this.hasPath() && this.onGround)
{
this.isShaking = true;
this.timeWolfIsShaking = 0.0F;
this.prevTimeWolfIsShaking = 0.0F;
this.worldObj.setEntityState(this, (byte);
}
if (isServer() && this.getAttackTarget() == null && this.isAngry())
{
this.setAngry(false);
}
if(Constants.DEF_HEALING == true && !this.isChild() && this.getHealth() <=10 && this.isTamed())
{
this.addPotionEffect(new PotionEffect(10, 200));
}
if (this.getAttackTarget() == null && isTamed() && 15 > 0) {
List list1 = worldObj.getEntitiesWithinAABB(EntityCreeper.class, AxisAlignedBB.fromBounds(posX, posY, posZ, posX + 1.0D, posY + 1.0D, posZ + 1.0D).expand(sniffRange(), 4D, sniffRange()));
if (!list1.isEmpty() && !isSitting() && this.getHealth() > 1 && !this.isChild()) {
canSeeCreeper = true;
}
else {
canSeeCreeper = false;
}
}
}
/**
* Called to update the entity's position/logic.
*/
@Override
public void onUpdate()
{
super.onUpdate();
this.headRotationCourseOld = this.headRotationCourse;
if (this.func_70922_bv())
{
this.headRotationCourse += (1.0F - this.headRotationCourse) * 0.4F;
}
else
{
this.headRotationCourse += (0.0F - this.headRotationCourse) * 0.4F;
}
if (this.isWet())
{
this.isWet = true;
this.isShaking = false;
this.timeWolfIsShaking = 0.0F;
this.prevTimeWolfIsShaking = 0.0F;
}
else if ((this.isWet || this.isShaking) && this.isShaking)
{
if (this.timeWolfIsShaking == 0.0F)
{
this.playSound("mob.wolf.shake", this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
}
this.prevTimeWolfIsShaking = this.timeWolfIsShaking;
this.timeWolfIsShaking += 0.05F;
if (this.prevTimeWolfIsShaking >= 2.0F)
{
this.isWet = false;
this.isShaking = false;
this.prevTimeWolfIsShaking = 0.0F;
this.timeWolfIsShaking = 0.0F;
}
if (this.timeWolfIsShaking > 0.4F)
{
float f = (float)this.getEntityBoundingBox().minY;
int i = (int)(MathHelper.sin((this.timeWolfIsShaking - 0.4F) * (float)Math.PI) * 7.0F);
for (int j = 0; j < i; ++j)
{
float f1 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F;
float f2 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F;
this.worldObj.spawnParticle(EnumParticleTypes.WATER_SPLASH, this.posX + (double)f1, (double)(f + 0.8F), this.posZ + (double)f2, this.motionX, this.motionY, this.motionZ, new int[0]);
}
}
}
if(this.isTamed()) { //TODO
EntityPlayer player = (EntityPlayer)this.getOwner();
if(player != null) {
float distanceToOwner = player.getDistanceToEntity(this);
if (distanceToOwner <= 2F && this.hasBone()) {
if(isServer()) {
this.entityDropItem(new ItemStack(ModItems.toy, 1, 1), 0.0F);
}
this.setHasBone(false);
}
}
}
}
@SideOnly(Side.CLIENT)
public boolean isWolfWet()
{
return this.isWet;
}
@SideOnly(Side.CLIENT)
public float getShadingWhileWet(float p_70915_1_)
{
return 0.75F + (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * p_70915_1_) / 2.0F * 0.25F;
}
@SideOnly(Side.CLIENT)
public float getShakeAngle(float p_70923_1_, float p_70923_2_)
{
float f2 = (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * p_70923_1_ + p_70923_2_) / 1.8F;
if (f2 < 0.0F)
{
f2 = 0.0F;
}
else if (f2 > 1.0F)
{
f2 = 1.0F;
}
return MathHelper.sin(f2 * (float)Math.PI) * MathHelper.sin(f2 * (float)Math.PI * 11.0F) * 0.15F * (float)Math.PI;
}
@SideOnly(Side.CLIENT)
public float getInterestedAngle(float p_70917_1_)
{
return (this.headRotationCourseOld + (this.headRotationCourse - this.headRotationCourseOld) * p_70917_1_) * 0.15F * (float)Math.PI;
}
public float getEyeHeight()
{
return this.height * 0.8F;
}
public int getVerticalFaceSpeed()
{
return this.isSitting() ? 20 : super.getVerticalFaceSpeed();
}
/**
* Called when the entity is attacked.
*/
@Override
public boolean attackEntityFrom(DamageSource source, float amount)
{
if (this.func_180431_b(source))
{
return false;
}
else
{
Entity entity = source.getEntity();
this.aiSit.setSitting(false);
if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow))
{
amount = (amount + 1.0F) / 2.0F;
}
return super.attackEntityFrom(source, amount);
}
}
public boolean attackEntityAsMob(Entity par1Entity)
{
float damage = (float)this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
int i = 0;
int critChance = 5;
critChance += 2;
if (rand.nextInt(6) < critChance) { //TODO
damage += (damage + 3) / 2;
double d0 = this.rand.nextGaussian() * 0.02D;
double d1 = this.rand.nextGaussian() * 0.02D;
double d2 = this.rand.nextGaussian() * 0.02D;
worldObj.spawnParticle(EnumParticleTypes.CRIT, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) -
(double)this.width, this.posY + 0.5D + (double)(this.rand.nextFloat() * this.height), this.posZ +
(double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, d0, d1, d2);
}
boolean flag = par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), damage);
if (flag)
{
if (i > 0)
{
par1Entity.addVelocity((double)(-MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F) * (float)i * 0.5F), 0.1D, (double)(MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F) * (float)i * 0.5F));
this.motionX *= 0.6D;
this.motionZ *= 0.6D;
}
}
return flag;
}
/**
* Called when the mob's health reaches 0.
*/
@Override //TODO
public void onDeath(DamageSource par1DamageSource)
{
super.onDeath(par1DamageSource);
if (par1DamageSource.getEntity() instanceof EntityPlayer)
{
EntityPlayer entityplayer = (EntityPlayer)par1DamageSource.getEntity();
{
entityplayer.triggerAchievement(ModAchievements.ZertKill);
this.dropChestItems();
}
}
}
/**
* Gets the pitch of living sounds in living entities.
*/
@Override
protected float getPitch() {
if(!this.isChild())
return super.getSoundPitch();
else{
return super.getSoundPitch() * 1;
}
}
/**
* Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
*/
public boolean interact(EntityPlayer par1EntityPlayer)
{
ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem();
if (this.isTamed())
{
if (itemstack != null)
{
if (itemstack.getItem() instanceof ItemFood)
{
ItemFood itemfood = null;
if(getHealthRelative() < 1)
{
itemfood = (ItemFood) ItemUtils.consumeEquipped(par1EntityPlayer, Items.fish,
Items.porkchop, Items.beef, Items.chicken, Items.rabbit, Items.mutton, Items.cooked_porkchop, Items.cooked_beef,
Items.cooked_chicken, Items.cooked_fish, Items.cooked_rabbit, Items.cooked_mutton, ModItems.jakanMeatRaw, ModItems.jakanMeatCooked,
ModItems.zertumMeatRaw, ModItems.zertumMeatCooked);
if (itemfood != null) {
float volume = getSoundVolume() * 1.0f;
float pitch = getPitch();
worldObj.playSoundAtEntity(this, Sound.Chew, volume, pitch);
this.heal((float)itemfood.getHealAmount(itemstack));
}
return true;
}
}
else if(itemstack.getItem() == Items.stick && canInteract(par1EntityPlayer)) //TODO
{
if(isServer()){
par1EntityPlayer.openGui(ZeroQuest.instance, CommonProxy.PetPack, this.worldObj, this.getEntityId(), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ));
this.worldObj.playSoundEffect(this.posX, this.posY + 0.5D, this.posZ, "random.chestopen", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
return true;
}
}
else if (itemstack.getItem() == Items.dye)
{
EnumDyeColor enumdyecolor = EnumDyeColor.func_176766_a(itemstack.getMetadata());
if (enumdyecolor != this.func_175546_cu())
{
this.func_175547_a(enumdyecolor);
if (!par1EntityPlayer.capabilities.isCreativeMode && --itemstack.stackSize <= 0)
{
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
}
return true;
}
}
}
if (canInteract(par1EntityPlayer) && isServer() && !this.isBreedingItem(itemstack))
{
this.aiSit.setSitting(!this.isSitting());
this.isJumping = false;
this.navigator.clearPathEntity();
this.setAttackTarget((EntityLivingBase)null);
}
}
else if (ItemUtils.consumeEquipped(par1EntityPlayer, ModItems.nileBone) && !this.isAngry())
{
if (isServer())
{
tamedFor(par1EntityPlayer, rand.nextInt(3) == 0);
par1EntityPlayer.triggerAchievement(ModAchievements.ZertTame);
}
return true;
}
return super.interact(par1EntityPlayer);
}
@SideOnly(Side.CLIENT)
public void handleHealthUpdate(byte p_70103_1_)
{
if (p_70103_1_ ==
{
this.isShaking = true;
this.timeWolfIsShaking = 0.0F;
this.prevTimeWolfIsShaking = 0.0F;
}
else
{
super.handleHealthUpdate(p_70103_1_);
}
}
/**
* Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on
* the animal type)
*/
public boolean isBreedingItem(ItemStack itemstack)
{
return itemstack == null ? false : itemstack.getItem() == ModItems.dogTreat;
}
public int getMaxSpawnedInChunk()
{
return 8;
}
public boolean isAngry()
{
return (this.dataWatcher.getWatchableObjectByte(16) & 2) != 0;
}
public void setAngry(boolean p_70916_1_)
{
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
if (p_70916_1_)
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2)));
}
else
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3)));
}
}
public EnumDyeColor func_175546_cu()
{
return EnumDyeColor.func_176766_a(this.dataWatcher.getWatchableObjectByte(20) & 15);
}
public void func_175547_a(EnumDyeColor p_175547_1_)
{
this.dataWatcher.updateObject(20, Byte.valueOf((byte)(p_175547_1_.getDyeColorDamage() & 15)));
}
/**
* This function is used when two same-species animals in 'love mode' breed to generate the new baby animal.
*/
public EntityCustomTameable spawnBabyAnimal(EntityAgeable par1EntityAgeable)
{
double chance = Math.random();
if (chance < 0.5){
EntityZertum var3 = new EntityZertum(this.worldObj);
var3.func_152115_b(this.func_152113_b());
var3.setTamed(true);
return var3;
}else if (chance < 0.7){
EntityRedZertum var4 = new EntityRedZertum(this.worldObj);
var4.func_152115_b(this.func_152113_b());
var4.setTamed(true);
return var4;
}else{
EntityDestroZertum var2 = new EntityDestroZertum(this.worldObj);
var2.func_152115_b(this.func_152113_b());
var2.setTamed(true);
return var2;
}
}
@Override
public EntityAgeable createChild(EntityAgeable entityageable) {
return spawnBabyAnimal(entityageable);
}
public void func_70918_i(boolean p_70918_1_)
{
if (p_70918_1_)
{
this.dataWatcher.updateObject(19, Byte.valueOf((byte)1));
}
else
{
this.dataWatcher.updateObject(19, Byte.valueOf((byte)0));
}
}
/**
* Returns true if the mob is currently able to mate with the specified mob.
*/
public boolean canMateWith(EntityAnimal p_70878_1_)
{
if (p_70878_1_ == this)
{
return false;
}
else if (!this.isTamed())
{
return false;
}
else if (!(p_70878_1_ instanceof EntityZertum))
{
return false;
}
else
{
EntityZertum entitywolf = (EntityZertum)p_70878_1_;
return !entitywolf.isTamed() ? false : (entitywolf.isSitting() ? false : this.isInLove() && entitywolf.isInLove());
}
}
public boolean func_70922_bv()
{
return this.dataWatcher.getWatchableObjectByte(19) == 1;
}
/**
* Determines if an entity can be despawned, used on idle far away entities
*/
protected boolean canDespawn()
{
return !this.isTamed() && this.ticksExisted > 2400;
}
public boolean allowLeashing()
{
return !this.isAngry() && super.allowLeashing();
}
}
Render File
@SideOnly(Side.CLIENT)
public class RenderZertum extends RenderLiving
{
private static final ResourceLocation zertumTextures = new ResourceLocation(ZeroQuest.modid + ":" + "textures/entity/zertum/zertum.png");
private static final ResourceLocation tamedZertumTextures = new ResourceLocation(ZeroQuest.modid + ":" + "textures/entity/zertum/zertum_tame.png");
private static final ResourceLocation angryZertumTextures = new ResourceLocation(ZeroQuest.modid + ":" + "textures/entity/zertum/zertum_angry.png");
public RenderZertum(RenderManager p_i46128_1_, ModelZertum p_i46128_2_, float p_i46128_3_){
super(p_i46128_1_, p_i46128_2_, p_i46128_3_);
this.addLayer(new LayerZertumCollarDying(this));
}
public void func_177135_a(EntityZertum p_177135_1_, double p_177135_2_, double p_177135_4_, double p_177135_6_, float p_177135_8_, float p_177135_9_)
{
if (p_177135_1_.isWolfWet())
{
float f2 = p_177135_1_.getBrightness(p_177135_9_) * p_177135_1_.getShadingWhileWet(p_177135_9_);
GlStateManager.color(f2, f2, f2);
}
super.doRender((EntityLiving)p_177135_1_, p_177135_2_, p_177135_4_, p_177135_6_, p_177135_8_, p_177135_9_);
}
protected ResourceLocation getEntityTexture(EntityZertum p_110775_1_)
{
return p_110775_1_.isTamed() ? tamedZertumTextures : (p_110775_1_.isAngry() ? angryZertumTextures : zertumTextures);
}
public void doRender(EntityLiving p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
this.func_177135_a((EntityZertum)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
public void doRender(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
this.func_177135_a((EntityZertum)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
protected ResourceLocation getEntityTexture(Entity p_110775_1_)
{
return this.getEntityTexture((EntityZertum)p_110775_1_);
}
}
Model
@SideOnly(Side.CLIENT)
public class ModelZertum extends ModelBase
{
//fields
ModelRenderer Nose;
ModelRenderer Ear2;
ModelRenderer Ear1;
ModelRenderer Head;
ModelRenderer LeftHindLeg2;
ModelRenderer LeftHindLeg1;
ModelRenderer RightHindLeg2;
ModelRenderer RightHindLeg1;
ModelRenderer Mane1;
ModelRenderer RightLeg;
ModelRenderer LeftLeg;
ModelRenderer Tail1;
ModelRenderer Mane2;
ModelRenderer Torso;
ModelRenderer Tail2;
ModelRenderer Neck;
private float rightLegStartingRotation = -0.2974289F;
private float lightLegStartingRotation = -0.2974289F;
public ModelZertum()
{
textureWidth = 128;
textureHeight = 64;
Nose = new ModelRenderer(this, 25, 27);
Nose.addBox(-1.5F, 0F, -3F, 3, 3, 4);
Nose.setRotationPoint(0F, 2.5F, -15F);
Nose.setTextureSize(64, 32);
Nose.mirror = true;
setRotation(Nose, 0F, 0F, 0F);
Ear2 = new ModelRenderer(this, 40, 28);
Ear2.addBox(-1F, -3F, 0F, 2, 3, 1);
Ear2.setRotationPoint(2F, -0.5F, -10.5F);
Ear2.setTextureSize(64, 32);
Ear2.mirror = true;
setRotation(Ear2, 0F, 0F, 0F);
Ear1 = new ModelRenderer(this, 40, 28);
Ear1.addBox(-1F, -3F, 0F, 2, 3, 1);
Ear1.setRotationPoint(-2F, -0.5F, -10.5F);
Ear1.setTextureSize(64, 32);
Ear1.mirror = true;
setRotation(Ear1, 0F, 0F, 0F);
Head = new ModelRenderer(this, 25, 15);
Head.addBox(-3F, -0.5F, -14F, 6, 6, 5);
Head.setRotationPoint(-0.5F, 6F, -3F);
Head.setTextureSize(64, 32);
Head.mirror = true;
setRotation(Head, 0F, 0F, 0F);
LeftHindLeg1 = new ModelRenderer(this, 11, 18);
LeftHindLeg1.addBox(-1F, 0F, -1F, 2, 5, 3);
LeftHindLeg1.setRotationPoint(1.5F, 13F, 5F);
LeftHindLeg1.setTextureSize(128, 64);
LeftHindLeg1.mirror = true;
setRotation(LeftHindLeg1, -0.2974289F, 0F, 0F);
LeftHindLeg2 = new ModelRenderer(this, 9, 44);
LeftHindLeg2.addBox(-1F, 0F, -1F, 2, 8, 2);
LeftHindLeg2.setRotationPoint(0F, 3F, 0.5F);
LeftHindLeg2.setTextureSize(128, 64);
LeftHindLeg2.mirror = true;
setRotation(LeftHindLeg2, 0.2974289F, 0F, 0F);
RightHindLeg1 = new ModelRenderer(this, 11, 31);
RightHindLeg1.addBox(-1F, 0F, -1F, 2, 5, 3);
RightHindLeg1.setRotationPoint(-2.5F, 13F, 5F);
RightHindLeg1.setTextureSize(128, 64);
RightHindLeg1.mirror = true;
setRotation(RightHindLeg1, -0.2974289F, 0F, 0F);
RightHindLeg2 = new ModelRenderer(this, 0, 44);
RightHindLeg2.addBox(-1F, 0F, -1F, 2, 8, 2);
RightHindLeg2.setRotationPoint(0F, 3F, 0.5F);
RightHindLeg2.setTextureSize(128, 64);
RightHindLeg2.mirror = true;
setRotation(RightHindLeg2, 0.2974289F, 0F, 0F);
Mane1 = new ModelRenderer(this, 43, 0);
Mane1.addBox(-3F, -3F, -3F, 6, 6, 7);
Mane1.setRotationPoint(-0.5F, 14F, -3F);
Mane1.setTextureSize(128, 64);
Mane1.mirror = true;
setRotation(Mane1, 1.496439F, 0F, 0F);
Neck = new ModelRenderer(this, 0, 0);
Neck.addBox(-2.5F, -12F, -4F, 4, 7, 4);
Neck.setRotationPoint(0.5F, 0F, 0F);
Neck.setTextureSize(64, 32);
Neck.mirror = true;
setRotation(Neck, -0.6015813F, 0F, 0F);
Mane2 = new ModelRenderer(this, 18, 0);
Mane2.addBox(-2.5F, -7F, -3.6F, 5, 6, 7);
Mane2.setRotationPoint(0F, 0F, 0F);
Mane2.setTextureSize(64, 32);
Mane2.mirror = true;
setRotation(Mane2, -0.34653F, 0F, 0F);
RightLeg = new ModelRenderer(this, 0, 30);
RightLeg.addBox(-1F, 0F, -1F, 2, 10, 2);
RightLeg.setRotationPoint(-3F, 14F, -4F);
RightLeg.setTextureSize(128, 64);
RightLeg.mirror = true;
setRotation(RightLeg, 0F, 0F, 0F);
LeftLeg = new ModelRenderer(this, 0, 16);
LeftLeg.addBox(-1F, 0F, -1F, 2, 10, 2);
LeftLeg.setRotationPoint(2F, 14F, -4F);
LeftLeg.setTextureSize(128, 64);
LeftLeg.mirror = true;
setRotation(LeftLeg, 0F, 0F, 0F);
Tail1 = new ModelRenderer(this, 91, 0);
Tail1.addBox(-1.5F, 0F, -1F, 4, 8, 4);
Tail1.setRotationPoint(-1F, 14F, 5F);
Tail1.setTextureSize(128, 64);
Tail1.mirror = true;
setRotation(Tail1, 1.315962F, 0F, 0F);
Tail2 = new ModelRenderer(this, 110, 0);
Tail2.addBox(-1.5F, 0F, -1F, 3, 8, 3);
Tail2.setRotationPoint(0.5F, 6F, 0F);
Tail2.setTextureSize(64, 32);
Tail2.mirror = true;
setRotation(Tail2, 0.141605F, 0F, 0F);
Torso = new ModelRenderer(this, 69, 0);
Torso.addBox(-2.5F, -3F, -3F, 5, 9, 5);
Torso.setRotationPoint(-0.5F, 12.5F, 1F);
Torso.setTextureSize(128, 64);
Torso.mirror = true;
setRotation(Torso, 1.496439F, 0F, 0F);
Head.addChild(Nose);
Head.addChild(Ear1);
Head.addChild(Ear2);
LeftHindLeg1.addChild(LeftHindLeg2);
RightHindLeg1.addChild(RightHindLeg2);
Mane1.addChild(Mane2);
Mane1.addChild(Neck);
Tail1.addChild(Tail2);
}
public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
{
super.render(par1Entity, par2, par3, par4, par5, par6, par7);
this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
if (this.isChild)
{
float f6 = 2.0F;
GL11.glPushMatrix();
GL11.glTranslatef(0.0F, 5.0F * par7, 6.0F * par7);
Head.render(par7);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(1.0F / f6, 1.0F / f6, 1.0F / f6);
GL11.glTranslatef(0.0F, 24.0F * par7, 0.0F);
LeftHindLeg1.render(par7);
RightHindLeg1.render(par7);
Mane1.render(par7);
RightLeg.render(par7);
LeftLeg.render(par7);
Tail1.render(par7);
Torso.render(par7);
GL11.glPopMatrix();
}
else
{
GL11.glPushMatrix();
GL11.glScalef(1.5F, 1.5F, 1.5F);
GL11.glTranslatef(0.0F, -0.5F, 0.0F);
Head.render(par7);
LeftHindLeg1.render(par7);
RightHindLeg1.render(par7);
Mane1.render(par7);
RightLeg.render(par7);
LeftLeg.render(par7);
Tail1.render(par7);
Torso.render(par7);
GL11.glPopMatrix();
}
}
/**
* Used for easily adding entity-dependent animations. The second and third float params here are the same second
* and third as in the setRotationAngles method.
*/
public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4)
{
EntityZertum entityzertum = (EntityZertum)par1EntityLivingBase;
if (entityzertum.isAngry())
{
this.Ear1.rotateAngleX = -0.5948578F;
this.Ear2.rotateAngleX = -0.5948578F;
}else if (entityzertum.getHealth() <=10){
this.Ear1.rotateAngleX = -0.9948578F;
this.Ear2.rotateAngleX = -0.9948578F;
}else{
this.Ear1.rotateAngleX = 0.0F;
this.Ear2.rotateAngleX = 0.0F;
}
if (entityzertum.isSitting()) //TODO
{
LeftHindLeg1.setRotationPoint(1.5F, 18F, 5F);
LeftHindLeg1.rotateAngleX = -2.082003F;
LeftHindLeg2.setRotationPoint(0F, 3.7F, 0F);//
LeftHindLeg2.rotateAngleX = 2.082003F;
RightHindLeg1.setRotationPoint(-2.5F, 18F, 5F);
RightHindLeg1.rotateAngleX = -2.082003F;
RightHindLeg2.setRotationPoint(0F, 3.7F, 0F);//
RightHindLeg2.rotateAngleX = 2.082003F;
Torso.setRotationPoint(-0.5F, 15F, 1F);
Torso.rotateAngleX = 0.9759358F;
Tail1.setRotationPoint(-1F, 19.5F, 5F);
Tail1.rotateAngleX = 1.055712F;
}
else
{
LeftHindLeg1.setRotationPoint(1.5F, 13F, 5F);
LeftHindLeg1.rotateAngleX = -0.2974289F;
LeftHindLeg2.setRotationPoint(0F, 3F, 0.5F);
LeftHindLeg2.rotateAngleX = 0.2974289F;
RightHindLeg1.setRotationPoint(-2.5F, 13F, 5F);
RightHindLeg1.rotateAngleX = -0.2974289F;
RightHindLeg2.setRotationPoint(0F, 3F, 0.5F);
RightHindLeg2.rotateAngleX = 0.2974289F;
Torso.setRotationPoint(-0.5F, 12.5F, 1F);
Torso.rotateAngleX = 1.496439F;
Tail1.setRotationPoint(-1F, 14F, 5F);
Tail1.rotateAngleX = 1.315962F;
this.RightHindLeg1.rotateAngleX = rightLegStartingRotation + MathHelper.cos(par2 * 0.6662F) * 1.4F * par3;
this.LeftHindLeg1.rotateAngleX = lightLegStartingRotation + MathHelper.cos(par2 * 0.6662F + (float)Math.PI) * 1.4F * par3;
this.RightLeg.rotateAngleX = MathHelper.cos(par2 * 0.6662F + (float)Math.PI) * 1.4F * par3;
this.LeftLeg.rotateAngleX = MathHelper.cos(par2 * 0.6662F) * 1.4F * par3;
}
this.Head.rotateAngleZ = entityzertum.getInterestedAngle(par4) + entityzertum.getShakeAngle(par4, 0.0F);
this.Mane1.rotateAngleZ = entityzertum.getShakeAngle(par4, -0.08F);
this.Torso.rotateAngleZ = entityzertum.getShakeAngle(par4, -0.16F);
this.Tail1.rotateAngleZ = entityzertum.getShakeAngle(par4, -0.32F);
}
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)
{
super.setRotationAngles(par1, par2, par3, par4, par5, par6, par7Entity);
this.Head.rotateAngleX = par5 / (280F / (float)Math.PI);
this.Head.rotateAngleY = par4 / (180F / (float)Math.PI);
this.Mane1.rotateAngleY = par4 / (180F / (float)Math.PI);
}
}
Add Layer file
@SideOnly(Side.CLIENT)
public class LayerZertumCollarDying implements LayerRenderer
{
private static final ResourceLocation field_177147_a = new ResourceLocation(ZeroQuest.modid + ":" + "textures/entity/zertum/zertum_collar.png");
private static final ResourceLocation ZertumDyingTextures = new ResourceLocation(ZeroQuest.modid + ":" + "textures/entity/zertum/zertum_dying.png");
private final RenderZertum field_177146_b;
private static final String __OBFID = "CL_00002405";
public LayerZertumCollarDying(RenderZertum p_177145_1_)
{
this.field_177146_b = p_177145_1_;
}
public void func_177145_a(EntityZertum p_177145_1_, float p_177145_2_, float p_177145_3_, float p_177145_4_, float p_177145_5_, float p_177145_6_, float p_177145_7_, float p_177145_8_)
{
if (p_177145_1_.isTamed() && !p_177145_1_.isInvisible())
{
this.field_177146_b.bindTexture(field_177147_a);
EnumDyeColor enumdyecolor = EnumDyeColor.func_176764_b(p_177145_1_.func_175546_cu().func_176765_a());
float[] afloat = EntitySheep.func_175513_a(enumdyecolor);
GlStateManager.color(afloat[0], afloat[1], afloat[2]);
this.field_177146_b.getMainModel().render(p_177145_1_, p_177145_2_, p_177145_3_, p_177145_5_, p_177145_6_, p_177145_7_, p_177145_8_);
}
if(p_177145_1_.isTamed() && p_177145_1_.getHealth() <=10){
this.field_177146_b.bindTexture(ZertumDyingTextures);
}
}
public boolean shouldCombineTextures()
{
return true;
}
public void doRenderLayer(EntityLivingBase p_177141_1_, float p_177141_2_, float p_177141_3_, float p_177141_4_, float p_177141_5_, float p_177141_6_, float p_177141_7_, float p_177141_8_)
{
this.func_177145_a((EntityZertum)p_177141_1_, p_177141_2_, p_177141_3_, p_177141_4_, p_177141_5_, p_177141_6_, p_177141_7_, p_177141_8_);
}
}