private BlockDoor Func_48318_a(int par1, int par2, int par3) { int i = TheEntity.WorldObj.GetBlockId(par1, par2, par3); if (i != Block.DoorWood.BlockID) { return(null); } else { BlockDoor blockdoor = (BlockDoor)Block.BlocksList[i]; return(blockdoor); } }
/// <summary> /// Returns whether the EntityAIBase should begin execution. /// </summary> public override bool ShouldExecute() { if (!TheEntity.IsCollidedHorizontally) { return(false); } PathNavigate pathnavigate = TheEntity.GetNavigator(); PathEntity pathentity = pathnavigate.GetPath(); if (pathentity == null || pathentity.IsFinished() || !pathnavigate.Func_48665_b()) { return(false); } for (int i = 0; i < Math.Min(pathentity.GetCurrentPathIndex() + 2, pathentity.GetCurrentPathLength()); i++) { PathPoint pathpoint = pathentity.GetPathPointFromIndex(i); EntityPosX = pathpoint.XCoord; EntityPosY = pathpoint.YCoord + 1; EntityPosZ = pathpoint.ZCoord; if (TheEntity.GetDistanceSq(EntityPosX, TheEntity.PosY, EntityPosZ) > 2.25D) { continue; } TargetDoor = Func_48318_a(EntityPosX, EntityPosY, EntityPosZ); if (TargetDoor != null) { return(true); } } EntityPosX = MathHelper2.Floor_double(TheEntity.PosX); EntityPosY = MathHelper2.Floor_double(TheEntity.PosY + 1.0D); EntityPosZ = MathHelper2.Floor_double(TheEntity.PosZ); TargetDoor = Func_48318_a(EntityPosX, EntityPosY, EntityPosZ); return(TargetDoor != null); }