Sort mobs by distance

This commit is contained in:
Tanner Collin 2021-05-07 04:41:38 +00:00
parent 3540e5580e
commit 2f77c7b990

View File

@ -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):