/// <summary> /// Returns whether the EntityAIBase should begin execution. /// </summary> public override bool ShouldExecute() { if (EntityObj.WorldObj.IsDaytime()) { return(false); } Village village = EntityObj.WorldObj.VillageCollectionObj.FindNearestVillage(MathHelper2.Floor_double(EntityObj.PosX), MathHelper2.Floor_double(EntityObj.PosY), MathHelper2.Floor_double(EntityObj.PosZ), 16); if (village == null) { return(false); } FrontDoor = village.FindNearestDoor(MathHelper2.Floor_double(EntityObj.PosX), MathHelper2.Floor_double(EntityObj.PosY), MathHelper2.Floor_double(EntityObj.PosZ)); if (FrontDoor == null) { return(false); } else { return((double)FrontDoor.GetInsideDistanceSquare(MathHelper2.Floor_double(EntityObj.PosX), MathHelper2.Floor_double(EntityObj.PosY), MathHelper2.Floor_double(EntityObj.PosZ)) < 2.25D); } }
/// <summary> /// Returns whether the EntityAIBase should begin execution. /// </summary> public override bool ShouldExecute() { if (EntityObj.WorldObj.IsDaytime() && !EntityObj.WorldObj.IsRaining() || EntityObj.WorldObj.WorldProvider.HasNoSky) { return(false); } if (EntityObj.GetRNG().Next(50) != 0) { return(false); } if (InsidePosX != -1 && EntityObj.GetDistanceSq(InsidePosX, EntityObj.PosY, InsidePosZ) < 4D) { return(false); } Village village = EntityObj.WorldObj.VillageCollectionObj.FindNearestVillage(MathHelper2.Floor_double(EntityObj.PosX), MathHelper2.Floor_double(EntityObj.PosY), MathHelper2.Floor_double(EntityObj.PosZ), 14); if (village == null) { return(false); } else { DoorInfo = village.FindNearestDoorUnrestricted(MathHelper2.Floor_double(EntityObj.PosX), MathHelper2.Floor_double(EntityObj.PosY), MathHelper2.Floor_double(EntityObj.PosZ)); return(DoorInfo != null); } }
/// <summary> /// Resets the task /// </summary> public override void ResetTask() { EntityObj.GetNavigator().SetBreakDoors(true); EntityObj.GetNavigator().Func_48663_c(true); FrontDoor = null; }
/// <summary> /// Resets the task /// </summary> public override void ResetTask() { InsidePosX = DoorInfo.GetInsidePosX(); InsidePosZ = DoorInfo.GetInsidePosZ(); DoorInfo = null; }