Esempio n. 1
0
        private ILocation FindTarget()
        {
            var h = (int)totalRadius.start.y + totalRadius.height;

            for (int x = totalRadius.start.x; x < totalRadius.start.x + totalRadius.xSize + 1; x++)
            {
                for (int z = totalRadius.start.z; z < totalRadius.start.z + totalRadius.zSize + 1; z++)
                {
                    if (Taken.ContainsKey(new Location(x, h, z)) || player.world.GetBlockId(x, h, z) != 0 || player.status.entity.location.Distance(new Position(x + 0.5f, h, z + 0.5f)) > MAX_RANGE)
                    {
                        continue;
                    }

                    return(new Location(x, h, z));
                }
            }

            return(null);
        }
Esempio n. 2
0
        private ILocation[] FindSurroundingTargets()
        {
            var h = (int)totalRadius.start.y + totalRadius.height;
            List <ILocation> list = new List <ILocation>();

            for (int x = totalRadius.start.x; x < totalRadius.start.x + totalRadius.xSize + 1; x++)
            {
                for (int z = totalRadius.start.z; z < totalRadius.start.z + totalRadius.zSize + 1; z++)
                {
                    //Check if the block is valid for mining.
                    if (Taken.ContainsKey(new Location(x, h, z)) || player.world.GetBlockId(x, h, z) != 0 || player.status.entity.location.Distance(new Position(x, h, z)) > REACH)
                    {
                        continue;
                    }

                    list.Add(new Location(x, h, z));
                }
            }

            return(list.ToArray());
        }
Esempio n. 3
0
        private ILocation FindTargetClosest()
        {
            var h = (int)totalRadius.start.y + totalRadius.height;

            List <ILocation> locations = new List <ILocation>();

            for (int x = totalRadius.start.x; x < totalRadius.start.x + totalRadius.xSize + 1; x++)
            {
                for (int z = totalRadius.start.z; z < totalRadius.start.z + totalRadius.zSize + 1; z++)
                {
                    if (Taken.ContainsKey(new Location(x, h, z)) || player.world.GetBlockId(x, h, z) != 0)
                    {
                        continue;
                    }

                    locations.Add(new Location(x, h, z));
                }
            }

            return(locations.OrderBy(x => x.Distance(player.status.entity.location.ToLocation(-1))).FirstOrDefault());
        }