protected internal virtual void SetOwnedEntitiesToAttack(net.minecraft.src.EntityLiving entityliving, bool mustBeStanding) { if ((entityliving is net.minecraft.src.EntityCreeper) || (entityliving is net.minecraft.src.EntityGhast)) { return; } if (entityliving is net.minecraft.src.EntityWolf) { net.minecraft.src.EntityWolf entitywolf = (net.minecraft.src.EntityWolf)entityliving; if (entitywolf.IsTamed() && username.Equals(entitywolf.GetOwner())) { return; } } if ((entityliving is net.minecraft.src.EntityPlayer) && !IsPVPEnabled()) { return; } System.Collections.Generic.List <Entity> list = worldObj.GetEntitiesWithinAABB(Sharpen.Runtime.GetClassForType (typeof(net.minecraft.src.EntityWolf)), net.minecraft.src.AxisAlignedBB.GetBoundingBoxFromPool (posX, posY, posZ, posX + 1.0D, posY + 1.0D, posZ + 1.0D).Expand(16D, 4D, 16D)); System.Collections.IEnumerator iterator = list.GetEnumerator(); do { if (!iterator.MoveNext()) { break; } net.minecraft.src.Entity entity = (net.minecraft.src.Entity)iterator.Current; net.minecraft.src.EntityWolf entitywolf1 = (net.minecraft.src.EntityWolf)entity; if (entitywolf1.IsTamed() && entitywolf1.GetEntityToAttack() == null && entitywolf1.GetOwner() == username && (!mustBeStanding || !entitywolf1.GetIsSitting())) { entitywolf1.SetIsSitting(false); entitywolf1.SetEntityToAttack(entityliving); } }while (true); }
public override bool AttackEntityFrom(net.minecraft.src.Entity entity, int i) { SetIsSitting(false); if (entity != null && !(entity is net.minecraft.src.EntityPlayer) && !(entity is net.minecraft.src.EntityArrow)) { i = (i + 1) / 2; } if (base.AttackEntityFrom(entity, i)) { if (!IsTamed() && !GetIsAngry()) { if (entity is net.minecraft.src.EntityPlayer) { SetIsAngry(true); playerToAttack = entity; } if ((entity is net.minecraft.src.EntityArrow) && ((net.minecraft.src.EntityArrow) entity).owner != null) { entity = ((net.minecraft.src.EntityArrow)entity).owner; } if (entity is net.minecraft.src.EntityLiving) { System.Collections.Generic.List <Entity> list = worldObj.GetEntitiesWithinAABB(Sharpen.Runtime.GetClassForType (typeof(net.minecraft.src.EntityWolf)), net.minecraft.src.AxisAlignedBB.GetBoundingBoxFromPool (posX, posY, posZ, posX + 1.0D, posY + 1.0D, posZ + 1.0D).Expand(16D, 4D, 16D)); System.Collections.IEnumerator iterator = list.GetEnumerator(); do { if (!iterator.MoveNext()) { break; } net.minecraft.src.Entity entity1 = (net.minecraft.src.Entity)iterator.Current; net.minecraft.src.EntityWolf entitywolf = (net.minecraft.src.EntityWolf)entity1; if (!entitywolf.IsTamed() && entitywolf.playerToAttack == null) { entitywolf.playerToAttack = entity; if (entity is net.minecraft.src.EntityPlayer) { entitywolf.SetIsAngry(true); } } }while (true); } } else { if (entity != this && entity != null) { if (IsTamed() && (entity is net.minecraft.src.EntityPlayer) && ((net.minecraft.src.EntityPlayer)entity).username.Equals(GetOwner(), System.StringComparison.OrdinalIgnoreCase)) { return(true); } playerToAttack = entity; } } return(true); } else { return(false); } }