Skip to content

Commit 529c025

Browse files
committed
onGround setting in nuker and optional spleef setting in build config
1 parent 0ef5565 commit 529c025

File tree

4 files changed

+21
-13
lines changed

4 files changed

+21
-13
lines changed

src/main/kotlin/com/lambda/config/groups/BuildConfig.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ interface BuildConfig {
2626
val pathing: Boolean
2727
val stayInRange: Boolean
2828
val collectDrops: Boolean
29+
val spleefEntities: Boolean
2930
val interactionsPerTick: Int
3031
val maxPendingInteractions: Int
3132
val interactionTimeout: Int

src/main/kotlin/com/lambda/config/groups/BuildSettings.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class BuildSettings(
3737
override val pathing by c.setting("Pathing", true, "Path to blocks").group(baseGroup, Group.General).index()
3838
override val stayInRange by c.setting("Stay In Range", true, "Stay in range of blocks").group(baseGroup, Group.General).index()
3939
override val collectDrops by c.setting("Collect All Drops", false, "Collect all drops when breaking blocks").group(baseGroup, Group.General).index()
40+
override val spleefEntities by c.setting("Spleef Entities", false, "Breaks blocks beneath entities blocking placements to get them out of the way").group(baseGroup, Group.General).index()
4041
override val interactionsPerTick by c.setting("Interactions Per Tick", 5, 1..30, 1, "The amount of interactions that can happen per tick").group(baseGroup, Group.General).index()
4142
override val maxPendingInteractions by c.setting("Max Pending Interactions", 15, 1..30, 1, "The maximum count of pending interactions to allow before pausing future interactions").group(baseGroup, Group.General).index()
4243
override val interactionTimeout by c.setting("Interaction Timeout", 10, 1..30, 1, "Timeout for block breaks in ticks", unit = " ticks").group(baseGroup, Group.General).index()

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

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -277,20 +277,23 @@ class PlaceSim private constructor(simInfo: ISimInfo)
277277

278278
if (collidingEntities.isNotEmpty()) {
279279
collidingEntities
280-
.mapNotNull { entity ->
281-
if (entity === player) {
282-
result(PlaceResult.BlockedBySelf(pos))
283-
return@mapNotNull null
280+
.takeIf { buildConfig.spleefEntities }
281+
?.run {
282+
mapNotNull { entity ->
283+
if (entity === player) {
284+
result(PlaceResult.BlockedBySelf(pos))
285+
return@mapNotNull null
286+
}
287+
val hitbox = entity.boundingBox
288+
entity.getPositionsWithinHitboxXZ(
289+
(pos.y - (hitbox.maxY - hitbox.minY)).floorToInt(),
290+
pos.y
291+
)
284292
}
285-
val hitbox = entity.boundingBox
286-
entity.getPositionsWithinHitboxXZ(
287-
(pos.y - (hitbox.maxY - hitbox.minY)).floorToInt(),
288-
pos.y
289-
)
290-
}
291-
.flatten()
292-
.forEach { support ->
293-
sim(support, blockState(support), TargetState.Empty) { simBreak() }
293+
.flatten()
294+
.forEach { support ->
295+
sim(support, blockState(support), TargetState.Empty) { simBreak() }
296+
}
294297
}
295298
result(PlaceResult.BlockedByEntity(pos, collidingEntities, context.hitPos, context.side))
296299
}

src/main/kotlin/com/lambda/module/modules/player/Nuker.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ object Nuker : Module(
3838
private val height by setting("Height", 4, 1..8, 1)
3939
private val width by setting("Width", 4, 1..8, 1)
4040
private val flatten by setting("Flatten", true)
41+
private val onGround by setting("On Ground", false, "Only break blocks when the player is standing on ground")
4142
private val fillFluids by setting("Fill Fluids", false, "Removes liquids by filling them in before breaking")
4243
private val fillFloor by setting("Fill Floor", false)
4344
private val baritoneSelection by setting("Baritone Selection", false, "Restricts nuker to your baritone selection")
@@ -50,6 +51,8 @@ object Nuker : Module(
5051
}
5152
onEnable {
5253
task = tickingBlueprint {
54+
if (onGround && !player.isOnGround) return@tickingBlueprint emptyMap()
55+
5356
val selection = BlockPos.iterateOutwards(player.blockPos, width, height, width)
5457
.asSequence()
5558
.map { it.blockPos }

0 commit comments

Comments
 (0)