Compare commits
No commits in common. "db74d07155b8aafb2306ca9679842437798a75de" and "296fe1efc2e2754711d5bff08b348949740c506b" have entirely different histories.
db74d07155
...
296fe1efc2
@ -62,7 +62,7 @@ class ExchangeItem<E> : Behavior<E>(
|
|||||||
owner.brain.eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE)
|
owner.brain.eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE)
|
||||||
if (closeAt != null) {
|
if (closeAt != null) {
|
||||||
// opened
|
// opened
|
||||||
val chest = level.getBlockEntity(target!!) ?: return
|
val chest = level.getBlockEntity(target!!)!!
|
||||||
if (chest is ChestBlockEntity) {
|
if (chest is ChestBlockEntity) {
|
||||||
ChestBlockEntity.playSound(level, target!!, level.getBlockState(target!!), SoundEvents.CHEST_CLOSE)
|
ChestBlockEntity.playSound(level, target!!, level.getBlockState(target!!), SoundEvents.CHEST_CLOSE)
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ import net.minecraft.world.level.block.entity.BaseContainerBlockEntity
|
|||||||
import quaedam.Quaedam
|
import quaedam.Quaedam
|
||||||
import quaedam.utils.getChunksNearby
|
import quaedam.utils.getChunksNearby
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.random.Random
|
|
||||||
|
|
||||||
class NearestVisibleContainer : Sensor<LivingEntity>() {
|
class NearestVisibleContainer : Sensor<LivingEntity>() {
|
||||||
|
|
||||||
@ -34,8 +33,7 @@ class NearestVisibleContainer : Sensor<LivingEntity>() {
|
|||||||
if (entity.tickCount and 0b11111 == 0) { // 32gt
|
if (entity.tickCount and 0b11111 == 0) { // 32gt
|
||||||
val pos = level.getChunksNearby(entity.blockPosition(), 1)
|
val pos = level.getChunksNearby(entity.blockPosition(), 1)
|
||||||
.flatMap { it.blockEntities.filterValues { be -> be is BaseContainerBlockEntity }.keys }
|
.flatMap { it.blockEntities.filterValues { be -> be is BaseContainerBlockEntity }.keys }
|
||||||
.shuffled(Random(entity.random.nextLong()))
|
.minByOrNull { it.distManhattan(entity.blockPosition()) }
|
||||||
.minByOrNull { it.distManhattan(entity.blockPosition()) / 5 }
|
|
||||||
entity.brain.setMemory(memory.get(), pos)
|
entity.brain.setMemory(memory.get(), pos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user