diff --git a/common/src/main/kotlin/quaedam/projection/swarm/ai/NearestVisibleContainer.kt b/common/src/main/kotlin/quaedam/projection/swarm/ai/NearestVisibleContainer.kt index eb0e6c3..1a63b0b 100644 --- a/common/src/main/kotlin/quaedam/projection/swarm/ai/NearestVisibleContainer.kt +++ b/common/src/main/kotlin/quaedam/projection/swarm/ai/NearestVisibleContainer.kt @@ -10,6 +10,7 @@ import net.minecraft.world.level.block.entity.BaseContainerBlockEntity import quaedam.Quaedam import quaedam.utils.getChunksNearby import java.util.* +import kotlin.random.Random class NearestVisibleContainer : Sensor() { @@ -33,7 +34,8 @@ class NearestVisibleContainer : Sensor() { if (entity.tickCount and 0b11111 == 0) { // 32gt val pos = level.getChunksNearby(entity.blockPosition(), 1) .flatMap { it.blockEntities.filterValues { be -> be is BaseContainerBlockEntity }.keys } - .minByOrNull { it.distManhattan(entity.blockPosition()) } + .shuffled(Random(entity.random.nextLong())) + .minByOrNull { it.distManhattan(entity.blockPosition()) / 5 } entity.brain.setMemory(memory.get(), pos) } }