Skip to content

Commit 1d61224

Browse files
committed
allow placements outside the world border
1 parent 77fff5e commit 1d61224

File tree

5 files changed

+27
-16
lines changed

5 files changed

+27
-16
lines changed

src/main/kotlin/com/lambda/interaction/construction/simulation/checks/BasicChecker.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ object BasicChecker : Results<PreSimResult> {
6666
}
6767

6868
// block is outside the world so it cant be altered
69-
if (!world.worldBorder.contains(pos) || world.isOutOfHeightLimit(pos)) {
70-
result(PreSimResult.OutOfWorld(pos))
69+
if (world.isOutOfHeightLimit(pos)) {
70+
result(PreSimResult.OutOfHeightLimit(pos))
7171
return false
7272
}
7373

src/main/kotlin/com/lambda/interaction/construction/simulation/checks/BreakSim.kt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ class BreakSim private constructor(simInfo: SimInfo)
8282
}
8383

8484
private suspend fun AutomatedSafeContext.simBreaks() {
85+
if (!world.worldBorder.contains(pos)) {
86+
result(BreakResult.OutOfBorder(pos))
87+
return
88+
}
89+
8590
if (breakConfig.avoidSupporting) player.supportingBlockPos.getOrNull()?.let { support ->
8691
if (support != pos) return@let
8792
result(BreakResult.PlayerOnTop(pos, state))
@@ -265,12 +270,6 @@ class BreakSim private constructor(simInfo: SimInfo)
265270
}
266271

267272
if (affectedFluids.isNotEmpty()) {
268-
val fluidOutOfBounds = affectedFluids.any { !world.worldBorder.contains(it.key) }
269-
if (fluidOutOfBounds) {
270-
result(GenericResult.Ignored(pos))
271-
return true
272-
}
273-
274273
if (breakConfig.fillFluids) {
275274
affectedFluids.forEach { (fluidPos, fluidState) ->
276275
result(BreakResult.Submerge(fluidPos, fluidState))

src/main/kotlin/com/lambda/interaction/construction/simulation/result/results/BreakResult.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,24 @@ import java.awt.Color
4545
sealed class BreakResult : BuildResult() {
4646
override val name: String get() = "${this::class.simpleName} at ${pos.toShortString()}"
4747

48+
/**
49+
* The break target is out of the world border.
50+
* @param pos The position of the block that is outside the world border.
51+
*/
52+
data class OutOfBorder(
53+
override val pos: BlockPos,
54+
) : Drawable, BreakResult() {
55+
override val name: String get() = "$pos is outside the world border."
56+
override val rank = Rank.OutOfWorld
57+
private val color = Color(3, 148, 252, 100)
58+
59+
override fun RenderBuilder.render() {
60+
box(pos) {
61+
allColors(color)
62+
}
63+
}
64+
}
65+
4866
/**
4967
* Represents a successful break. All checks have been passed.
5068
* @param context The context of the break.

src/main/kotlin/com/lambda/interaction/construction/simulation/result/results/GenericResult.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ package com.lambda.interaction.construction.simulation.result.results
2020
import baritone.api.pathing.goals.GoalNear
2121
import com.lambda.context.AutomatedSafeContext
2222
import com.lambda.graphics.mc.RenderBuilder
23-
import com.lambda.graphics.mc.renderer.TickedRenderer
2423
import com.lambda.interaction.construction.simulation.result.BuildResult
2524
import com.lambda.interaction.construction.simulation.result.ComparableResult
2625
import com.lambda.interaction.construction.simulation.result.Drawable

src/main/kotlin/com/lambda/interaction/construction/simulation/result/results/PreSimResult.kt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package com.lambda.interaction.construction.simulation.result.results
1919

2020
import baritone.api.pathing.goals.GoalBlock
2121
import com.lambda.graphics.mc.RenderBuilder
22-
import com.lambda.graphics.mc.renderer.TickedRenderer
2322
import com.lambda.interaction.construction.simulation.result.BuildResult
2423
import com.lambda.interaction.construction.simulation.result.ComparableResult
2524
import com.lambda.interaction.construction.simulation.result.Drawable
@@ -107,14 +106,10 @@ sealed class PreSimResult : BuildResult() {
107106
}
108107
}
109108

110-
/**
111-
* The break target is out of the world border or height limit.
112-
* @param pos The position of the block that is out of the world.
113-
*/
114-
data class OutOfWorld(
109+
data class OutOfHeightLimit(
115110
override val pos: BlockPos,
116111
) : Drawable, PreSimResult() {
117-
override val name: String get() = "$pos is out of the world."
112+
override val name: String get() = "$pos is out of the height limit."
118113
override val rank = Rank.OutOfWorld
119114
private val color = Color(3, 148, 252, 100)
120115

0 commit comments

Comments
 (0)