Compare commits
4 Commits
cd40ba58da
...
22b1450a72
Author | SHA1 | Date | |
---|---|---|---|
22b1450a72 | |||
abb5646959 | |||
1ee1c7215d | |||
d45f8d2a57 |
@ -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))
|
||||
.firstOrNull()
|
||||
entity.brain.setMemory(memory.get(), pos)
|
||||
}
|
||||
}
|
||||
|
@ -29,8 +29,8 @@ object ProjectedPersonAI {
|
||||
val defaultSchedule = Quaedam.schedules.register("projected_person_default") {
|
||||
ScheduleBuilder(Schedule()).changeActivityAt(10, Activity.IDLE)
|
||||
.changeActivityAt(10, Activity.IDLE)
|
||||
.changeActivityAt(2000, Activity.WORK)
|
||||
.changeActivityAt(7300, Activity.IDLE)
|
||||
.changeActivityAt(900, Activity.WORK)
|
||||
.changeActivityAt(6300, Activity.IDLE)
|
||||
.changeActivityAt(9000, Activity.WORK)
|
||||
.changeActivityAt(10700, Activity.IDLE)
|
||||
.changeActivityAt(11000, Activity.PLAY)
|
||||
|
@ -75,8 +75,11 @@ class ProjectorBlockEntity(pos: BlockPos, state: BlockState) :
|
||||
val chunk = ChunkPos(SectionPos.blockToSectionCoord(blockPos.x), SectionPos.blockToSectionCoord(blockPos.z))
|
||||
val minChunk = ChunkPos(chunk.x - radius, chunk.z - radius)
|
||||
val maxChunk = ChunkPos(chunk.x + radius, chunk.z + radius)
|
||||
val minBlock = BlockPos(minChunk.minBlockX, Int.MIN_VALUE, minChunk.minBlockZ)
|
||||
val maxBlock = BlockPos(maxChunk.maxBlockX, Int.MAX_VALUE, maxChunk.maxBlockZ)
|
||||
// Y is not the limit value of Int because at
|
||||
// Lnet/minecraft/world/level/entity/EntitySectionStorage;forEachAccessibleNonEmptySection(Lnet/minecraft/world/phys/AABB;Lnet/minecraft/util/AbortableIterationConsumer;)V
|
||||
// it may get overflow
|
||||
val minBlock = BlockPos(minChunk.minBlockX, Short.MIN_VALUE.toInt(), minChunk.minBlockZ)
|
||||
val maxBlock = BlockPos(maxChunk.maxBlockX, Short.MAX_VALUE.toInt(), maxChunk.maxBlockZ)
|
||||
effectArea = BoundingBox.fromCorners(minBlock, maxBlock)
|
||||
effectAreaAABB = AABB(minBlock, maxBlock)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user