Skip to content

Commit f8371e3

Browse files
committed
avoid liquids setting
1 parent 5a8588b commit f8371e3

File tree

8 files changed

+47
-44
lines changed

8 files changed

+47
-44
lines changed

common/src/main/kotlin/com/lambda/config/groups/BreakSettings.kt

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,27 @@ class BreakSettings(
2929
vis: () -> Boolean = { true }
3030
) : BreakConfig(priority) {
3131
override val breakMode by c.setting("Break Mode", BreakMode.Packet) { vis() }
32-
override val reBreak by c.setting("ReBreak", true, "Re-breaks blocks after they've been broken once", vis)
33-
override val unsafeCancels by c.setting("Unsafe Cancels", true, "Allows cancelling block breaking even if the server might continue breaking sever side, potentially causing unexpected state changes") { vis() }
34-
override val breakThreshold by c.setting("Break Threshold", 0.7f, 0.1f..1.0f, 0.02f, "The break amount at which the block is considered broken") { vis() }
35-
override val doubleBreak by c.setting("Double Break", true, "Allows breaking two blocks at once") { vis() }
32+
override val reBreak by c.setting("ReBreak", true, "Re-breaks blocks after they've been broken once", visibility = vis)
33+
override val unsafeCancels by c.setting("Unsafe Cancels", true, "Allows cancelling block breaking even if the server might continue breaking sever side, potentially causing unexpected state changes", visibility = vis)
34+
override val breakThreshold by c.setting("Break Threshold", 0.7f, 0.1f..1.0f, 0.02f, "The break amount at which the block is considered broken", visibility = vis)
35+
override val doubleBreak by c.setting("Double Break", true, "Allows breaking two blocks at once", visibility = vis)
3636
override val doubleBreakFudgeFactor by c.setting("Double Break Fudge Factor", 3, 0..3, 1, "The amount of ticks to give double, aka secondary breaks extra for the server to recognise the break") { doubleBreak && vis() }
37-
override val breakDelay by c.setting("Break Delay", 0, 0..6, 1, "The delay between breaking blocks", " ticks") { vis() }
38-
override val breakStageMask by c.setting("Break Stage Mask", setOf(TickEvent.Pre, TickEvent.Input.Pre, TickEvent.Input.Post, TickEvent.Player.Post), "The sub-tick timing at which break actions can be performed", vis)
39-
override val swing by c.setting("Swing Mode", SwingMode.Constant, "The times at which to swing the players hand") { vis() }
37+
override val breakDelay by c.setting("Break Delay", 0, 0..6, 1, "The delay between breaking blocks", " ticks", visibility = vis)
38+
override val breakStageMask by c.setting("Break Stage Mask", setOf(TickEvent.Pre, TickEvent.Input.Pre, TickEvent.Input.Post, TickEvent.Player.Post), "The sub-tick timing at which break actions can be performed", visibility = vis)
39+
override val swing by c.setting("Swing Mode", SwingMode.Constant, "The times at which to swing the players hand", visibility = vis)
4040
override val swingType by c.setting("Break Swing Type", BuildConfig.SwingType.Vanilla, "The style of swing") { vis() && swing != SwingMode.None }
41-
override val sounds by c.setting("Break Sounds", true, "Plays the breaking sounds") { vis() }
42-
override val particles by c.setting("Particles", true, "Renders the breaking particles") { vis() }
43-
override val breakingTexture by c.setting("Breaking Overlay", true, "Overlays the breaking texture at its different stages") { vis() }
44-
override val rotateForBreak by c.setting("Rotate For Break", false, "Rotate towards block while breaking") { vis() }
45-
override val ignoredBlocks by c.setting("Ignored Blocks", allSigns, "Blocks that wont be broken") { vis() }
46-
override val breakConfirmation by c.setting("Break Confirmation", BreakConfirmationMode.BreakThenAwait, "The style of confirmation used when breaking") { vis() }
47-
override val maxPendingBreaks by c.setting("Max Pending Breaks", 15, 1..30, 1, "The maximum amount of pending breaks") { vis() }
48-
override val breaksPerTick by c.setting("Breaks Per Tick", 5, 1..30, 1, "Maximum instant block breaks per tick") { vis() }
41+
override val sounds by c.setting("Break Sounds", true, "Plays the breaking sounds", visibility = vis)
42+
override val particles by c.setting("Particles", true, "Renders the breaking particles", visibility = vis)
43+
override val breakingTexture by c.setting("Breaking Overlay", true, "Overlays the breaking texture at its different stages", visibility = vis)
44+
override val rotateForBreak by c.setting("Rotate For Break", false, "Rotate towards block while breaking", visibility = vis)
45+
override val ignoredBlocks by c.setting("Ignored Blocks", allSigns, "Blocks that wont be broken", visibility = vis)
46+
override val breakConfirmation by c.setting("Break Confirmation", BreakConfirmationMode.BreakThenAwait, "The style of confirmation used when breaking", visibility = vis)
47+
override val maxPendingBreaks by c.setting("Max Pending Breaks", 15, 1..30, 1, "The maximum amount of pending breaks", visibility = vis)
48+
override val breaksPerTick by c.setting("Breaks Per Tick", 5, 1..30, 1, "Maximum instant block breaks per tick", visibility = vis)
4949
override val suitableToolsOnly by c.setting("Suitable Tools Only", false, "Places a restriction to only use tools suitable for the given block", visibility = vis)
50+
override val avoidLiquids by c.setting("Avoid Liquids", true, "Avoids breaking blocks that would cause liquid to spill", visibility = vis)
5051
override val breakWeakBlocks by c.setting("Break Weak Blocks", false, "Break blocks that dont have structural integrity (e.g: grass)") { vis() }
51-
override val forceSilkTouch by c.setting("Force Silk Touch", false, "Force silk touch when breaking blocks") { vis() }
52-
override val forceFortunePickaxe by c.setting("Force Fortune Pickaxe", false, "Force fortune pickaxe when breaking blocks") { vis() }
52+
override val forceSilkTouch by c.setting("Force Silk Touch", false, "Force silk touch when breaking blocks", visibility = vis)
53+
override val forceFortunePickaxe by c.setting("Force Fortune Pickaxe", false, "Force fortune pickaxe when breaking blocks", visibility = vis)
5354
override val minFortuneLevel by c.setting("Min Fortune Level", 1, 1..3, 1, "The minimum fortune level to use") { vis() && forceFortunePickaxe }
5455
}

common/src/main/kotlin/com/lambda/config/groups/HotbarSettings.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ class HotbarSettings(
2727
priority: Priority = 0,
2828
vis: () -> Boolean = { true }
2929
) : HotbarConfig(priority) {
30-
override val keepTicks by c.setting("Keep Ticks", 3, 0..20, 1, "The number of ticks to keep the current hotbar selection active", " ticks", vis)
31-
override val swapDelay by c.setting("Swap Delay", 0, 0..3, 1, "The number of ticks delay before allowing another hotbar selection swap", " ticks", vis)
30+
override val keepTicks by c.setting("Keep Ticks", 3, 0..20, 1, "The number of ticks to keep the current hotbar selection active", " ticks", visibility = vis)
31+
override val swapDelay by c.setting("Swap Delay", 0, 0..3, 1, "The number of ticks delay before allowing another hotbar selection swap", " ticks", visibility = vis)
3232
override val swapsPerTick by c.setting("Swaps Per Tick", 3, 1..10, 1, "The number of hotbar selection swaps that can take place each tick") { swapDelay <= 0 && vis() }
33-
override val swapPause by c.setting("Swap Pause", 0, 0..20, 1, "The delay in ticks to pause actions after switching to the slot", " ticks", vis)
34-
override val sequenceStageMask by c.setting("Hotbar Stage Mask", setOf(TickEvent.Input.Pre, TickEvent.Input.Post), "The sub-tick timing at which hotbar actions are performed", vis)
33+
override val swapPause by c.setting("Swap Pause", 0, 0..20, 1, "The delay in ticks to pause actions after switching to the slot", " ticks", visibility = vis)
34+
override val sequenceStageMask by c.setting("Hotbar Stage Mask", setOf(TickEvent.Input.Pre, TickEvent.Input.Post), "The sub-tick timing at which hotbar actions are performed", visibility = vis)
3535
}

common/src/main/kotlin/com/lambda/config/groups/InteractionSettings.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class InteractionSettings(
2828
vis: () -> Boolean = { true },
2929
) : InteractionConfig {
3030
// Reach
31-
private val useDefaultReach by c.setting("Default Reach", true, "Whether to use vanilla interaction ranges", vis)
31+
private val useDefaultReach by c.setting("Default Reach", true, "Whether to use vanilla interaction ranges", visibility = vis)
3232
private val attackReachSetting = if (usage.entity) c.setting("Attack Reach", DEFAULT_ATTACK_REACH, 1.0..10.0, 0.01, "Maximum entity interaction distance") { vis() && !useDefaultReach } else null
3333
private val interactReachSetting = if (usage.block) c.setting("Interact Reach", DEFAULT_INTERACT_REACH, 1.0..10.0, 0.01, "Maximum block interaction distance") { vis() && !useDefaultReach } else null
3434

@@ -55,13 +55,13 @@ class InteractionSettings(
5555
}
5656

5757
// Point scan
58-
override val strictRayCast by c.setting("Strict Raycast", false, "Whether to include the environment to the ray cast context", vis)
59-
override val checkSideVisibility by c.setting("Visibility Check", true, "Whether to check if an AABB side is visible", vis)
60-
override val resolution by c.setting("Resolution", 5, 1..20, 1, "The amount of grid divisions per surface of the hit box", "", vis)
61-
override val pointSelection by c.setting("Point Selection", PointSelection.Optimum, "The strategy to select the best hit point", vis)
58+
override val strictRayCast by c.setting("Strict Raycast", false, "Whether to include the environment to the ray cast context", visibility = vis)
59+
override val checkSideVisibility by c.setting("Visibility Check", true, "Whether to check if an AABB side is visible", visibility = vis)
60+
override val resolution by c.setting("Resolution", 5, 1..20, 1, "The amount of grid divisions per surface of the hit box", "", visibility = vis)
61+
override val pointSelection by c.setting("Point Selection", PointSelection.Optimum, "The strategy to select the best hit point", visibility = vis)
6262

6363
// Swing
64-
override val swingHand by c.setting("Swing Hand", true, "Whether to swing hand on interactions", vis)
64+
override val swingHand by c.setting("Swing Hand", true, "Whether to swing hand on interactions", visibility = vis)
6565

6666
companion object {
6767
const val DEFAULT_ATTACK_REACH = 3.0

common/src/main/kotlin/com/lambda/config/groups/PlaceSettings.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ class PlaceSettings(
2727
priority: Priority = 0,
2828
vis: () -> Boolean = { true }
2929
) : PlaceConfig(priority) {
30-
override val rotateForPlace by c.setting("Rotate For Place", true, "Rotate towards block while placing") { vis() }
31-
override val airPlace by c.setting("Air Place", AirPlaceMode.None, "Allows for placing blocks without adjacent faces") { vis() }
30+
override val rotateForPlace by c.setting("Rotate For Place", true, "Rotate towards block while placing", visibility = vis)
31+
override val airPlace by c.setting("Air Place", AirPlaceMode.None, "Allows for placing blocks without adjacent faces", visibility = vis)
3232
override val axisRotateSetting by c.setting("Axis Rotate", true, "Overrides the Rotate For Place setting and rotates the player on each axis to air place rotational blocks") { vis() && airPlace.isEnabled() }
33-
override val placeStageMask by c.setting("Place Sequence Mode", setOf(TickEvent.Pre, TickEvent.Input.Pre, TickEvent.Player.Post), "The sub-tick timing at which break actions are performed") { vis() }
34-
override val placeConfirmationMode by c.setting("Place Confirmation", PlaceConfirmationMode.PlaceThenAwait, "Wait for block placement confirmation") { vis() }
35-
override val maxPendingPlacements by c.setting("Max Pending Placements", 5, 0..30, 1, "The maximum amount of pending placements") { vis() }
36-
override val placementsPerTick by c.setting("Places Per Tick", 1, 1..30, 1, "Maximum instant block places per tick") { vis() }
37-
override val swing by c.setting("Swing", true, "Swings the players hand when placing") { vis() }
33+
override val placeStageMask by c.setting("Place Sequence Mode", setOf(TickEvent.Pre, TickEvent.Input.Pre, TickEvent.Player.Post), "The sub-tick timing at which break actions are performed", visibility = vis)
34+
override val placeConfirmationMode by c.setting("Place Confirmation", PlaceConfirmationMode.PlaceThenAwait, "Wait for block placement confirmation", visibility = vis)
35+
override val maxPendingPlacements by c.setting("Max Pending Placements", 5, 0..30, 1, "The maximum amount of pending placements", visibility = vis)
36+
override val placementsPerTick by c.setting("Places Per Tick", 1, 1..30, 1, "Maximum instant block places per tick", visibility = vis)
37+
override val swing by c.setting("Swing", true, "Swings the players hand when placing", visibility = vis)
3838
override val swingType by c.setting("Place Swing Type", BuildConfig.SwingType.Vanilla, "The style of swing") { vis() && swing }
39-
override val sounds by c.setting("Place Sounds", true, "Plays the placing sounds") { vis() }
39+
override val sounds by c.setting("Place Sounds", true, "Plays the placing sounds", visibility = vis)
4040
}

common/src/main/kotlin/com/lambda/config/groups/RotationSettings.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class RotationSettings(
3434
priority: Priority = 0,
3535
vis: () -> Boolean = { true }
3636
) : RotationConfig(priority) {
37-
override var rotationMode by c.setting("Mode", RotationMode.Sync, "SILENT - server-side rotation, SYNC - server-side rotation; client-side movement, LOCK - Lock camera, NONE - No rotation", vis)
37+
override var rotationMode by c.setting("Mode", RotationMode.Sync, "SILENT - server-side rotation, SYNC - server-side rotation; client-side movement, LOCK - Lock camera, NONE - No rotation", visibility = vis)
3838

3939
/** How many ticks to keep the rotation before resetting */
4040
override val keepTicks by c.setting("Keep Rotation", 1, 1..10, 1, "Ticks to keep rotation", " ticks") { rotate && vis() }
@@ -45,7 +45,7 @@ class RotationSettings(
4545
/**
4646
* At what sub-tick stages rotations can be performed
4747
*/
48-
override val rotationStageMask by c.setting("Rotation Stage Mask", setOf(TickEvent.Pre, TickEvent.Input.Pre, TickEvent.Player.Post), "The sub-tick stages at which rotations can be performed", vis)
48+
override val rotationStageMask by c.setting("Rotation Stage Mask", setOf(TickEvent.Pre, TickEvent.Input.Pre, TickEvent.Player.Post), "The sub-tick stages at which rotations can be performed", visibility = vis)
4949

5050
/** Whether the rotation is instant */
5151
var instant by c.setting("Instant Rotation", true, "Instantly rotate") { rotate && vis() }

common/src/main/kotlin/com/lambda/interaction/construction/simulation/BuildSimulator.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import com.lambda.interaction.material.StackSelection.Companion.select
3535
import com.lambda.interaction.material.StackSelection.Companion.selectStack
3636
import com.lambda.interaction.material.container.ContainerManager.containerWithMaterial
3737
import com.lambda.interaction.material.container.MaterialContainer
38+
import com.lambda.interaction.request.breaking.BreakConfig
3839
import com.lambda.interaction.request.placing.PlaceConfig
3940
import com.lambda.interaction.request.rotation.Rotation.Companion.rotation
4041
import com.lambda.interaction.request.rotation.Rotation.Companion.rotationTo
@@ -96,7 +97,7 @@ object BuildSimulator {
9697
if (it.isEmpty()) return@let
9798
return@flatMap it
9899
}
99-
checkBreakResults(pos, eye, build.placing, interact, rotation, inventory, build).let {
100+
checkBreakResults(pos, eye, build.breaking, interact, rotation, inventory, build).let {
100101
if (it.isEmpty()) return@let
101102
return@flatMap it
102103
}
@@ -404,7 +405,7 @@ object BuildSimulator {
404405
private fun SafeContext.checkBreakResults(
405406
pos: BlockPos,
406407
eye: Vec3d,
407-
place: PlaceConfig,
408+
breaking: BreakConfig,
408409
interact: InteractionConfig,
409410
rotation: RotationConfig,
410411
inventory: InventoryConfig,
@@ -432,7 +433,7 @@ object BuildSimulator {
432433

433434
/* liquid needs to be submerged first to be broken */
434435
if (!state.fluidState.isEmpty && state.isReplaceable) {
435-
val submerge = checkPlaceResults(pos, TargetState.Solid, eye, place, interact, rotation, inventory)
436+
val submerge = checkPlaceResults(pos, TargetState.Solid, eye, build.placing, interact, rotation, inventory)
436437
acc.add(BreakResult.Submerge(pos, state, submerge))
437438
acc.addAll(submerge)
438439
return acc
@@ -443,13 +444,13 @@ object BuildSimulator {
443444
}.map { pos.offset(it) }
444445

445446
/* block has liquids next to it that will leak when broken */
446-
if (adjacentLiquids.isNotEmpty()) {
447+
if (adjacentLiquids.isNotEmpty() && build.breaking.avoidLiquids) {
447448
acc.add(BreakResult.BlockedByLiquid(pos, state))
448449
adjacentLiquids.forEach { liquidPos ->
449450
val submerge = if (blockState(liquidPos).isReplaceable) {
450-
checkPlaceResults(liquidPos, TargetState.Solid, eye, place, interact, rotation, inventory)
451+
checkPlaceResults(liquidPos, TargetState.Solid, eye, build.placing, interact, rotation, inventory)
451452
} else {
452-
checkBreakResults(liquidPos, eye, place, interact, rotation, inventory, build)
453+
checkBreakResults(liquidPos, eye, build.breaking, interact, rotation, inventory, build)
453454
}
454455
acc.addAll(submerge)
455456
}

common/src/main/kotlin/com/lambda/interaction/request/breaking/BreakConfig.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ abstract class BreakConfig(
4444
abstract val maxPendingBreaks: Int
4545
abstract val breaksPerTick: Int
4646
abstract val suitableToolsOnly: Boolean
47+
abstract val avoidLiquids: Boolean
4748
abstract val breakWeakBlocks: Boolean
4849
abstract val forceSilkTouch: Boolean
4950
abstract val forceFortunePickaxe: Boolean

common/src/main/kotlin/com/lambda/module/modules/player/PacketMine.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ object PacketMine : Module(
5858

5959
private val reBreakMode by setting("ReBreak Mode", ReBreakMode.Manual, "The method used to re-break blocks after they've been broken once") { breakConfig.reBreak }
6060
private val breakRadius by setting("Break Radius", 0, 0..5, 1, "Selects and breaks all blocks within the break radius of the selected block")
61-
private val flatten by setting("Flatten", false, "Wont allow breaking extra blocks under your players position") { breakRadius > 0 }
61+
private val flatten by setting("Flatten", true, "Wont allow breaking extra blocks under your players position") { breakRadius > 0 }
6262
private val queue by setting("Queue", false, "Queues blocks to break so you can select multiple at once")
6363
.onValueChange { _, to -> if (!to) queuePositions.clear() }
6464
private val queueOrder by setting("Queue Order", QueueOrder.Standard, "Which end of the queue to break blocks from") { queue }

0 commit comments

Comments
 (0)