public EntityAIFollowParent(EntityAnimal par1EntityAnimal, float par2) { ChildAnimal = par1EntityAnimal; Field_48248_c = par2; }
/// <summary> /// Renders the entity shadows at the position, shadow alpha and partialTickTime. Args: entity, x, y, z, shadowAlpha, /// partialTickTime /// </summary> private void RenderShadow(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { //GL.Enable(EnableCap.Blend); //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); RenderEngine renderengine = RenderManager.RenderEngine; renderengine.BindTexture("misc.shadow.png", TextureMode.Clamp); World world = GetWorldFromRenderManager(); //GL.DepthMask(false); float f = ShadowSize; if (par1Entity is EntityLiving) { EntityLiving entityliving = (EntityLiving)par1Entity; f *= entityliving.GetRenderSizeModifier(); if (entityliving is EntityAnimal) { EntityAnimal entityanimal = (EntityAnimal)entityliving; if (entityanimal.IsChild()) { f *= 0.5F; } } } double d = par1Entity.LastTickPosX + (par1Entity.PosX - par1Entity.LastTickPosX) * (double)par9; double d1 = par1Entity.LastTickPosY + (par1Entity.PosY - par1Entity.LastTickPosY) * (double)par9 + (double)par1Entity.GetShadowSize(); double d2 = par1Entity.LastTickPosZ + (par1Entity.PosZ - par1Entity.LastTickPosZ) * (double)par9; int i = MathHelper2.Floor_double(d - (double)f); int j = MathHelper2.Floor_double(d + (double)f); int k = MathHelper2.Floor_double(d1 - (double)f); int l = MathHelper2.Floor_double(d1); int i1 = MathHelper2.Floor_double(d2 - (double)f); int j1 = MathHelper2.Floor_double(d2 + (double)f); double d3 = par2 - d; double d4 = par4 - d1; double d5 = par6 - d2; Tessellator tessellator = Tessellator.Instance; tessellator.StartDrawingQuads(); for (int k1 = i; k1 <= j; k1++) { for (int l1 = k; l1 <= l; l1++) { for (int i2 = i1; i2 <= j1; i2++) { int j2 = world.GetBlockId(k1, l1 - 1, i2); if (j2 > 0 && world.GetBlockLightValue(k1, l1, i2) > 3) { RenderShadowOnBlock(Block.BlocksList[j2], par2, par4 + (double)par1Entity.GetShadowSize(), par6, k1, l1, i2, par8, f, d3, d4 + (double)par1Entity.GetShadowSize(), d5); } } } } tessellator.Draw(); //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F); //GL.Disable(EnableCap.Blend); //GL.DepthMask(true); }
/// <summary> /// Resets the task /// </summary> public override void ResetTask() { TargetMate = null; Field_48261_b = 0; }
/// <summary> /// This function is used when two same-species animals in 'love mode' breed to generate the new baby animal. /// </summary> public override EntityAnimal SpawnBabyAnimal(EntityAnimal par1EntityAnimal) { return(new EntityPig(WorldObj)); }
/// <summary> /// Basic mob attack. Default to touch of death in EntityCreature. Overridden by each mob to define their attack. /// </summary> protected override void AttackEntity(Entity par1Entity, float par2) { if (par1Entity is EntityPlayer) { if (par2 < 3F) { double d = par1Entity.PosX - PosX; double d1 = par1Entity.PosZ - PosZ; RotationYaw = (float)((Math.Atan2(d1, d) * 180D) / Math.PI) - 90F; HasAttacked = true; } EntityPlayer entityplayer = (EntityPlayer)par1Entity; if (entityplayer.GetCurrentEquippedItem() == null || !IsWheat(entityplayer.GetCurrentEquippedItem())) { EntityToAttack = null; } } else if (par1Entity is EntityAnimal) { EntityAnimal entityanimal = (EntityAnimal)par1Entity; if (GetGrowingAge() > 0 && entityanimal.GetGrowingAge() < 0) { if ((double)par2 < 2.5D) { HasAttacked = true; } } else if (InLove > 0 && entityanimal.InLove > 0) { if (entityanimal.EntityToAttack == null) { entityanimal.EntityToAttack = this; } if (entityanimal.EntityToAttack == this && (double)par2 < 3.5D) { entityanimal.InLove++; InLove++; Breeding++; if (Breeding % 4 == 0) { WorldObj.SpawnParticle("heart", (PosX + (double)(Rand.NextFloat() * Width * 2.0F)) - (double)Width, PosY + 0.5D + (double)(Rand.NextFloat() * Height), (PosZ + (double)(Rand.NextFloat() * Width * 2.0F)) - (double)Width, 0.0F, 0.0F, 0.0F); } if (Breeding == 60) { Procreate((EntityAnimal)par1Entity); } } else { Breeding = 0; } } else { Breeding = 0; EntityToAttack = null; } } }
/// <summary> /// This function is used when two same-species animals in 'love mode' breed to generate the new baby animal. /// </summary> public abstract EntityAnimal SpawnBabyAnimal(EntityAnimal entityanimal);