Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import com.lambda.task.RootTask.run
import com.lambda.task.Task
import com.lambda.task.tasks.BuildTask.Companion.build
import com.lambda.util.BlockUtils.blockState
import com.lambda.util.extension.shrinkByEpsilon
import com.lambda.util.item.ItemUtils.block
import com.lambda.util.math.flooredBlockPos
import com.lambda.util.player.SlotUtils.hotbarAndStorage
Expand Down Expand Up @@ -88,8 +89,8 @@ object PlayerTrap : Module(
}

fun SafeContext.getTrapPositions(player: PlayerEntity): Set<BlockPos> {
val min = player.boundingBox.minPos.flooredBlockPos.add(-1, -1, -1)
val max = player.boundingBox.maxPos.flooredBlockPos.add(1, 1, 1)
val min = player.boundingBox.shrinkByEpsilon().minPos.flooredBlockPos.add(-1, -1, -1)
val max = player.boundingBox.shrinkByEpsilon().maxPos.flooredBlockPos.add(1, 1, 1)

return buildSet {
(min.x + 1..<max.x).forEach { x ->
Expand Down
2 changes: 2 additions & 0 deletions src/main/kotlin/com/lambda/util/extension/Box.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@ import net.minecraft.util.math.Vec3d
val Box.min get() = Vec3d(minX, minY, minZ)
val Box.max get() = Vec3d(maxX, maxY, maxZ)

fun Box.shrinkByEpsilon(): Box = expand(-1e-7)

operator fun Box.contains(boundingBox: Box) = this.intersects(boundingBox)
operator fun DoubleArray.component6() = this[5]
Loading