Sort mobs by distance
This commit is contained in:
parent
3540e5580e
commit
2f77c7b990
|
@ -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):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user