fix: game crash when no container available

This commit is contained in:
xtex 2023-08-21 09:10:13 +08:00
parent 1ee1c7215d
commit abb5646959
Signed by: xtex
GPG Key ID: B918086ED8045B91

View File

@ -36,7 +36,7 @@ class NearestVisibleContainer : Sensor<LivingEntity>() {
.flatMap { it.blockEntities.filterValues { be -> be is BaseContainerBlockEntity }.keys }
.sortedBy { it.distManhattan(entity.blockPosition()) / 5 }
.shuffled(Random(System.currentTimeMillis() / 10000))
.first()
.firstOrNull()
entity.brain.setMemory(memory.get(), pos)
}
}