fix: container focus again

This commit is contained in:
xtex 2023-08-18 09:34:07 +08:00
parent d45f8d2a57
commit 1ee1c7215d
Signed by: xtex
GPG Key ID: B918086ED8045B91

View File

@ -34,8 +34,9 @@ class NearestVisibleContainer : Sensor<LivingEntity>() {
if (entity.tickCount and 0b11111 == 0) { // 32gt
val pos = level.getChunksNearby(entity.blockPosition(), 1)
.flatMap { it.blockEntities.filterValues { be -> be is BaseContainerBlockEntity }.keys }
.shuffled(Random(entity.random.nextLong()))
.minByOrNull { it.distManhattan(entity.blockPosition()) / 5 }
.sortedBy { it.distManhattan(entity.blockPosition()) / 5 }
.shuffled(Random(System.currentTimeMillis() / 10000))
.first()
entity.brain.setMemory(memory.get(), pos)
}
}