Ejemplo n.º 1
0
 protected internal override void UpdatePlayerActionState()
 {
     base.UpdatePlayerActionState();
     if (!hasAttacked && !GetGotPath() && IsTamed() && ridingEntity == null)
     {
         net.minecraft.src.EntityPlayer entityplayer = worldObj.GetPlayerEntityByName(GetOwner
                                                                                          ());
         if (entityplayer != null)
         {
             float f = entityplayer.GetDistanceToEntity(this);
             if (f > 5F)
             {
                 SetPathEntity(entityplayer, f);
             }
         }
         else
         {
             if (!IsInWater())
             {
                 SetIsSitting(true);
             }
         }
     }
     else
     {
         if (playerToAttack == null && !GetGotPath() && !IsTamed() && worldObj.rand.NextInt
                 (100) == 0)
         {
             System.Collections.Generic.List <Entity> list = worldObj.GetEntitiesWithinAABB(Sharpen.Runtime.GetClassForType
                                                                                                (typeof(net.minecraft.src.EntitySheep)), net.minecraft.src.AxisAlignedBB.GetBoundingBoxFromPool
                                                                                                (posX, posY, posZ, posX + 1.0D, posY + 1.0D, posZ + 1.0D).Expand(16D, 4D, 16D));
             if (list.Count > 0)
             {
                 SetEntityToAttack((net.minecraft.src.Entity)list[worldObj.rand.Next(list.Count
                                                                                     )]);
             }
         }
     }
     if (IsInWater())
     {
         SetIsSitting(false);
     }
     if (!worldObj.singleplayerWorld)
     {
         dataWatcher.UpdateObject(18, health);
     }
 }