/// <summary> /// Called when a lightning bolt hits the entity. /// </summary> public override void OnStruckByLightning(EntityLightningBolt par1EntityLightningBolt) { if (WorldObj.IsRemote) { return; } else { EntityPigZombie entitypigzombie = new EntityPigZombie(WorldObj); entitypigzombie.SetLocationAndAngles(PosX, PosY, PosZ, RotationYaw, RotationPitch); WorldObj.SpawnEntityInWorld(entitypigzombie); SetDead(); return; } }
/// <summary> /// Called when the entity is attacked. /// </summary> public override bool AttackEntityFrom(DamageSource par1DamageSource, int par2) { Entity entity = par1DamageSource.GetEntity(); if (entity is EntityPlayer) { List <Entity> list = WorldObj.GetEntitiesWithinAABBExcludingEntity(this, BoundingBox.Expand(32, 32, 32)); for (int i = 0; i < list.Count; i++) { Entity entity1 = list[i]; if (entity1 is EntityPigZombie) { EntityPigZombie entitypigzombie = (EntityPigZombie)entity1; entitypigzombie.BecomeAngryAt(entity); } } BecomeAngryAt(entity); } return(base.AttackEntityFrom(par1DamageSource, par2)); }