From 2f77c7b990976848eef21ca8a56fceb0f66c176c Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Fri, 7 May 2021 04:41:38 +0000 Subject: [PATCH] Sort mobs by distance --- mosfet/world.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mosfet/world.py b/mosfet/world.py index 1198940..71ce48b 100644 --- a/mosfet/world.py +++ b/mosfet/world.py @@ -312,6 +312,7 @@ class World: if utils.phyp(center, pos) > distance: continue result.append(mob) + result.sort(key=lambda mob: utils.phyp(center, (mob.x, mob.y, mob.z))) return result def find_threats(self, center, distance): @@ -324,6 +325,7 @@ class World: if not self.check_air_column(pos, distance): continue result.append(mob) + result.sort(key=lambda mob: utils.phyp(center, (mob.x, mob.y, mob.z))) return result def find_villagers(self, center, distance): @@ -336,6 +338,7 @@ class World: if utils.phyp(center, pos) > distance: continue result.append(mob) + result.sort(key=lambda mob: utils.phyp(center, (mob.x, mob.y, mob.z))) return result def find_villager_openings(self, villager):