Sort mobs by distance
This commit is contained in:
		| @@ -312,6 +312,7 @@ class World: | |||||||
|             if utils.phyp(center, pos) > distance: |             if utils.phyp(center, pos) > distance: | ||||||
|                 continue |                 continue | ||||||
|             result.append(mob) |             result.append(mob) | ||||||
|  |         result.sort(key=lambda mob: utils.phyp(center, (mob.x, mob.y, mob.z))) | ||||||
|         return result |         return result | ||||||
|  |  | ||||||
|     def find_threats(self, center, distance): |     def find_threats(self, center, distance): | ||||||
| @@ -324,6 +325,7 @@ class World: | |||||||
|             if not self.check_air_column(pos, distance): |             if not self.check_air_column(pos, distance): | ||||||
|                 continue |                 continue | ||||||
|             result.append(mob) |             result.append(mob) | ||||||
|  |         result.sort(key=lambda mob: utils.phyp(center, (mob.x, mob.y, mob.z))) | ||||||
|         return result |         return result | ||||||
|  |  | ||||||
|     def find_villagers(self, center, distance): |     def find_villagers(self, center, distance): | ||||||
| @@ -336,6 +338,7 @@ class World: | |||||||
|             if utils.phyp(center, pos) > distance: |             if utils.phyp(center, pos) > distance: | ||||||
|                 continue |                 continue | ||||||
|             result.append(mob) |             result.append(mob) | ||||||
|  |         result.sort(key=lambda mob: utils.phyp(center, (mob.x, mob.y, mob.z))) | ||||||
|         return result |         return result | ||||||
|  |  | ||||||
|     def find_villager_openings(self, villager): |     def find_villager_openings(self, villager): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user