Skip to content

Commit 9bc9b11

Browse files
committed
Merge branch '1.21.5' into improvement/build-simulator
# Conflicts: # src/main/kotlin/com/lambda/interaction/construction/result/Rank.kt # src/main/kotlin/com/lambda/interaction/construction/result/results/PlaceResult.kt # src/main/kotlin/com/lambda/interaction/construction/simulation/BuildSimulator.kt # src/main/kotlin/com/lambda/task/tasks/BuildTask.kt
2 parents ea3e648 + 4698998 commit 9bc9b11

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

src/main/kotlin/com/lambda/interaction/construction/context/PlaceContext.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ data class PlaceContext(
9595
value("Expected State", expectedState)
9696
value("Sneak", sneak)
9797
value("Inside Block", insideBlock)
98-
value("Current Dir Is Invalid", currentDirIsValid)
98+
value("Current Dir Is Valid", currentDirIsValid)
9999
}
100100
}
101101
}

src/main/kotlin/com/lambda/interaction/construction/result/Rank.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ enum class Rank {
2727
PlaceBlockedByPlayer,
2828
NotVisible,
2929
OutOfReach,
30+
PlaceBlockedByEntity,
3031
BreakNotExposed,
3132
ChunkNotLoaded,
3233
PlaceCantReplace,

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

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import baritone.api.pathing.goals.GoalInverted
2222
import com.lambda.context.Automated
2323
import com.lambda.graphics.renderer.esp.ShapeBuilder
2424
import com.lambda.interaction.construction.context.PlaceContext
25+
import com.lambda.interaction.construction.verify.TargetState
26+
import com.lambda.task.Task
2527
import com.lambda.interaction.construction.result.BuildResult
2628
import com.lambda.interaction.construction.result.ComparableResult
2729
import com.lambda.interaction.construction.result.Contextual
@@ -31,7 +33,9 @@ import com.lambda.interaction.construction.result.Navigable
3133
import com.lambda.interaction.construction.result.Rank
3234
import com.lambda.interaction.construction.result.Resolvable
3335
import com.lambda.task.tasks.BuildTask.Companion.breakBlock
36+
import com.lambda.task.tasks.BuildTask.Companion.build
3437
import net.minecraft.block.BlockState
38+
import net.minecraft.entity.Entity
3539
import net.minecraft.item.ItemPlacementContext
3640
import net.minecraft.item.ItemStack
3741
import net.minecraft.util.math.BlockPos
@@ -93,18 +97,38 @@ sealed class PlaceResult : BuildResult() {
9397
}
9498
}
9599

100+
/**
101+
* Represents a scenario where block placement is obstructed by the player itself.
102+
*
103+
* @property blockPos The position of the block that was attempted to be placed.
104+
*/
105+
data class BlockedBySelf(
106+
override val pos: BlockPos
107+
) : Drawable, Navigable, PlaceResult() {
108+
override val rank = Rank.PlaceBlockedByEntity
109+
private val color = Color(252, 3, 3, 100)
110+
override val goal = GoalInverted(GoalBlock(pos))
111+
112+
override fun ShapeBuilder.buildRenderer() {
113+
box(pos, color, color)
114+
}
115+
}
116+
96117
/**
97118
* Represents a scenario where block placement is obstructed by an entity.
98119
*
99120
* @property pos The position of the block that was attempted to be placed.
100121
*/
101122
data class BlockedByEntity(
102123
override val pos: BlockPos,
103-
) : Navigable, PlaceResult() {
104-
override val rank = Rank.PlaceBlockedByPlayer
124+
val entities: List<Entity>
125+
) : Drawable, PlaceResult() {
126+
override val rank = Rank.PlaceBlockedByEntity
127+
private val color = Color(252, 3, 3, 100)
105128

106-
// ToDo: check what type of entity. player -> leave box, other entity -> kill?
107-
override val goal = GoalInverted(GoalBlock(pos))
129+
override fun ShapeBuilder.buildRenderer() {
130+
entities.forEach { box(it, color) }
131+
}
108132
}
109133

110134
/**

0 commit comments

Comments
 (0)