Skip to content

Commit 30a7a84

Browse files
committed
move fill fluids setting into the break config; only available if avoid fluids is enabled
1 parent 77e9e87 commit 30a7a84

File tree

10 files changed

+19
-31
lines changed

10 files changed

+19
-31
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import com.lambda.interaction.managers.breaking.BreakConfig.BreakMode
2929
import com.lambda.interaction.managers.breaking.BreakConfig.SwingMode
3030
import com.lambda.util.NamedEnum
3131
import net.minecraft.block.Block
32-
import net.minecraft.world.attribute.EnvironmentAttributeModifier.override
3332
import java.awt.Color
3433

3534
open class BreakSettings(
@@ -79,9 +78,9 @@ open class BreakSettings(
7978

8079
// Block
8180
override val ignoredBlocks by c.setting("${prefix}Ignored Blocks", emptySet<Block>(), description = "Blocks that wont be broken", visibility = visibility).group(*baseGroup, Group.General).index()
82-
override val avoidLiquids by c.setting("${prefix}Avoid Liquids", true, "Avoids breaking blocks that would cause liquid to spill", visibility = visibility).group(*baseGroup, Group.General).index()
81+
override val avoidFluids by c.setting("${prefix}Avoid Fluids", true, "Avoids breaking blocks that would cause fluids to spill", visibility = visibility).group(*baseGroup, Group.General).index()
8382
override val avoidSupporting by c.setting("${prefix}Avoid Supporting", true, "Avoids breaking the block supporting the player", visibility = visibility).group(*baseGroup, Group.General).index()
84-
83+
override val fillFluids by c.setting("Fill Fluids", true, "Fills fluids in order to break blocks that would initially spill them") { visibility() && avoidFluids }.group(*baseGroup, Group.General).index()
8584
// Tool
8685
override val efficientOnly by c.setting("${prefix}Efficient Tools Only", true, "Only use tools suitable for the given block (will get the item drop)") { visibility() && swapMode.isEnabled() }.group(*baseGroup, Group.General).index()
8786
override val suitableToolsOnly by c.setting("${prefix}Suitable Tools Only", true, "Only use tools suitable for the given block (will get the item drop)") { visibility() && swapMode.isEnabled() }.group(*baseGroup, Group.General).index()

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class BreakSim private constructor(simInfo: SimInfo)
9494
return
9595
}
9696

97-
if (breakConfig.avoidLiquids && affectsFluids()) return
97+
if (breakConfig.avoidFluids && affectsFluids()) return
9898

9999
val (swapStack, stackSelection) = getSwapStack() ?: return
100100
val instant = instantBreakable(
@@ -265,15 +265,17 @@ class BreakSim private constructor(simInfo: SimInfo)
265265
}
266266

267267
if (affectedFluids.isNotEmpty()) {
268-
val liquidOutOfBounds = affectedFluids.any { !world.worldBorder.contains(it.key) }
269-
if (liquidOutOfBounds) {
268+
val fluidOutOfBounds = affectedFluids.any { !world.worldBorder.contains(it.key) }
269+
if (fluidOutOfBounds) {
270270
result(GenericResult.Ignored(pos))
271271
return true
272272
}
273273

274-
affectedFluids.forEach { (fluidPos, fluidState) ->
275-
result(BreakResult.Submerge(fluidPos, fluidState))
276-
sim(fluidPos, fluidState, TargetState.Solid(emptySet()))
274+
if (breakConfig.fillFluids) {
275+
affectedFluids.forEach { (fluidPos, fluidState) ->
276+
result(BreakResult.Submerge(fluidPos, fluidState))
277+
sim(fluidPos, fluidState, TargetState.Solid(emptySet()))
278+
}
277279
}
278280
result(BreakResult.BlockedByFluid(pos, state, affectedFluids.keys))
279281
return true

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ enum class Rank {
2121
// solvable
2222
PlaceSuccess,
2323
BreakSuccess,
24-
InteractSuccess,
2524
WrongItem,
2625
BreakItemCantMine,
2726
PlaceBlockedByPlayer,

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import baritone.api.pathing.goals.GoalBlock
2121
import baritone.api.pathing.goals.GoalInverted
2222
import com.lambda.context.AutomatedSafeContext
2323
import com.lambda.graphics.mc.RenderBuilder
24-
import com.lambda.graphics.mc.renderer.TickedRenderer
2524
import com.lambda.graphics.util.DirectionMask.mask
2625
import com.lambda.interaction.construction.simulation.context.BreakContext
2726
import com.lambda.interaction.construction.simulation.result.BuildResult
@@ -114,8 +113,8 @@ sealed class BreakResult : BuildResult() {
114113
}
115114

116115
/**
117-
* The block is a liquid and first has to be submerged.
118-
* @param pos The position of the block that is a liquid.
116+
* The block is a fluid and first has to be submerged.
117+
* @param pos The position of the block that is a fluid.
119118
*/
120119
data class Submerge(
121120
override val pos: BlockPos,
@@ -132,7 +131,7 @@ sealed class BreakResult : BuildResult() {
132131
}
133132

134133
/**
135-
* The block is blocked by another liquid block that first has to be submerged.
134+
* The block is blocked by another fluid block that first has to be submerged.
136135
*/
137136
data class BlockedByFluid(
138137
override val pos: BlockPos,

src/main/kotlin/com/lambda/interaction/managers/breaking/BreakConfig.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ interface BreakConfig : ActionConfig, ISettingGroup {
5050
val breakConfirmation: BreakConfirmationMode
5151
val breaksPerTick: Int
5252

53-
val avoidLiquids: Boolean
53+
val avoidFluids: Boolean
54+
val fillFluids: Boolean
5455
val avoidSupporting: Boolean
5556
val ignoredBlocks: Collection<Block>
5657

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ object FastBreak : Module(
6161
}
6262
breakConfig.apply {
6363
editTyped(
64-
::avoidLiquids,
64+
::avoidFluids,
6565
::avoidSupporting,
6666
::efficientOnly,
6767
::suitableToolsOnly

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ object Nuker : Module(
4747
private val flattenMode by setting("Flatten Mode", FlattenMode.Standard)
4848
private val directionalDig by setting("Directional Dig", DigDirection.None)
4949
private val onGround by setting("On Ground", false, "Only break blocks when the player is standing on ground")
50-
private val fillFluids by setting("Fill Fluids", false, "Removes liquids by filling them in before breaking")
5150
private val fillFloor by setting("Fill Floor", false)
5251
private val baritoneSelection by setting("Baritone Selection", false, "Restricts nuker to your baritone selection")
5352
private val inverseSelection by setting("Inverse Selection", false, "Breaks blocks outside of the baritone selection and ignores blocks inside") { baritoneSelection }
@@ -75,7 +74,7 @@ object Nuker : Module(
7574
.filter { flattenMode == FlattenMode.None || isInFlatten(it) }
7675
.filter { isWithinDigDirection(it) }
7776
.filter { isInBaritoneSelection(it) == !inverseSelection }
78-
.associateWith { if (fillFluids) TargetState.Air else TargetState.Empty }
77+
.associateWith { if (breakConfig.fillFluids) TargetState.Air else TargetState.Empty }
7978

8079
if (fillFloor) {
8180
val floor = BlockPos.iterateOutwards(player.blockPos.down(), width, 0, width)

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import com.lambda.module.Module
3535
import com.lambda.module.tag.ModuleTag
3636
import com.lambda.threading.runSafeAutomated
3737
import com.lambda.util.BlockUtils.blockState
38-
import com.lambda.util.ChatUtils.colors
3938
import com.lambda.util.Describable
4039
import com.lambda.util.NamedEnum
4140
import com.lambda.util.math.distSq
@@ -116,7 +115,7 @@ object PacketMine : Module(
116115
}
117116
breakConfig.apply {
118117
editTyped(
119-
::avoidLiquids,
118+
::avoidFluids,
120119
::avoidSupporting,
121120
::efficientOnly,
122121
::suitableToolsOnly

src/main/kotlin/com/lambda/module/modules/render/NoRender.kt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,12 @@ package com.lambda.module.modules.render
2020
import com.lambda.config.groups.EntitySelectionSettings
2121
import com.lambda.module.Module
2222
import com.lambda.module.tag.ModuleTag
23-
import com.lambda.util.EntityUtils.blockEntityMap
24-
import com.lambda.util.EntityUtils.bossEntityMap
2523
import com.lambda.util.EntityUtils.createNameMap
26-
import com.lambda.util.EntityUtils.decorationEntityMap
27-
import com.lambda.util.EntityUtils.miscEntityMap
28-
import com.lambda.util.EntityUtils.mobEntityMap
29-
import com.lambda.util.EntityUtils.passiveEntityMap
30-
import com.lambda.util.EntityUtils.playerEntityMap
31-
import com.lambda.util.EntityUtils.projectileEntityMap
32-
import com.lambda.util.EntityUtils.vehicleEntityMap
3324
import com.lambda.util.NamedEnum
3425
import com.lambda.util.reflections.scanResult
3526
import net.minecraft.block.entity.BlockEntity
3627
import net.minecraft.client.particle.Particle
3728
import net.minecraft.entity.Entity
38-
import net.minecraft.entity.SpawnGroup
3929

4030
//ToDo: Implement unimplemented settings. (Keep in mind compatibility with other mods like sodium)
4131
object NoRender : Module(

src/main/kotlin/com/lambda/util/player/prediction/MovementPrediction.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import com.lambda.context.SafeContext
2424
*
2525
* Currently not implemented:
2626
* - Elytra movement
27-
* - Movement in liquids
27+
* - Movement in fluids
2828
* - Ladder climbing
2929
* - Movement in webs
3030
* - Sneaking safewalk

0 commit comments

Comments
 (0)