Skip to content

Commit 6bcc984

Browse files
committed
remove action-specific max pending action settings
1 parent 1a0977b commit 6bcc984

File tree

11 files changed

+45
-58
lines changed

11 files changed

+45
-58
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
@@ -26,8 +26,8 @@ import com.lambda.interaction.managers.breaking.BreakConfig.AnimationMode
2626
import com.lambda.interaction.managers.breaking.BreakConfig.BreakConfirmationMode
2727
import com.lambda.interaction.managers.breaking.BreakConfig.BreakMode
2828
import com.lambda.interaction.managers.breaking.BreakConfig.SwingMode
29-
import com.lambda.util.BlockUtils.allSigns
3029
import com.lambda.util.NamedEnum
30+
import net.minecraft.block.Block
3131
import java.awt.Color
3232

3333
open class BreakSettings(
@@ -72,12 +72,11 @@ open class BreakSettings(
7272
// Pending / Post
7373
override val breakConfirmation by c.setting("Break Confirmation", BreakConfirmationMode.BreakThenAwait, "The style of confirmation used when breaking").group(baseGroup, Group.General).index()
7474
override val breaksPerTick by c.setting("Breaks Per Tick", 5, 1..30, 1, "Maximum instant block breaks per tick").group(baseGroup, Group.General).index()
75-
override val maxPendingBreaks by c.setting("Max Pending Breaks", 15, 1..30, 1, "The maximum amount of pending breaks").group(baseGroup, Group.General).index()
7675

7776
// Block
77+
override val ignoredBlocks by c.setting("Ignored Blocks", emptySet<Block>(), description = "Blocks that wont be broken").group(baseGroup, Group.General).index()
7878
override val avoidLiquids by c.setting("Avoid Liquids", true, "Avoids breaking blocks that would cause liquid to spill").group(baseGroup, Group.General).index()
7979
override val avoidSupporting by c.setting("Avoid Supporting", true, "Avoids breaking the block supporting the player").group(baseGroup, Group.General).index()
80-
override val ignoredBlocks by c.setting("Ignored Blocks", allSigns, description = "Blocks that wont be broken").group(baseGroup, Group.General).index()
8180

8281
// Tool
8382
override val efficientOnly by c.setting("Efficient Tools Only", true, "Only use tools suitable for the given block (will get the item drop)") { swapMode.isEnabled() }.group(baseGroup, Group.General).index()

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,10 @@ interface BuildConfig : ISettingGroup {
2828
val stayInRange: Boolean
2929
val collectDrops: Boolean
3030
val spleefEntities: Boolean
31-
val actionsPerTick: Int
3231
val maxPendingActions: Int
3332
val actionTimeout: Int
3433
val maxBuildDependencies: Int
3534

36-
val useDefaultReach: Boolean
3735
val attackReach: Double
3836
val interactReach: Double
3937
val scanReach: Double

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

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,16 @@ class BuildSettings(
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()
4040
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()
41-
override val actionsPerTick by c.setting("Actions Per Tick", 5, 1..30, 1, "The amount of interactions that can happen per tick").group(baseGroup, Group.General).index()
4241
override val maxPendingActions by c.setting("Max Pending Actions", 15, 1..30, 1, "The maximum count of pending interactions to allow before pausing future interactions").group(baseGroup, Group.General).index()
4342
override val actionTimeout by c.setting("Action Timeout", 10, 1..30, 1, "Timeout for block breaks in ticks", unit = " ticks").group(baseGroup, Group.General).index()
4443
override val maxBuildDependencies by c.setting("Max Sim Dependencies", 3, 0..10, 1, "Maximum dependency build results").group(baseGroup, Group.General).index()
4544

46-
override val useDefaultReach by c.setting("Default Reach", true, "Whether to use vanilla interaction ranges").group(baseGroup, Group.Reach).index()
47-
override val attackReach by c.setting("Attack Reach", DEFAULT_ATTACK_REACH, 1.0..10.0, 0.01, "Maximum entity interaction distance") { !useDefaultReach }.group(baseGroup, Group.Reach).index()
48-
override val interactReach by c.setting("Interact Reach", DEFAULT_INTERACT_REACH, 1.0..10.0, 0.01, "Maximum block interaction distance") { !useDefaultReach }.group(baseGroup, Group.Reach).index()
49-
45+
override var attackReach by c.setting("Attack Reach", 3.0, 1.0..7.0, 0.01, "Maximum entity interaction distance").group(baseGroup, Group.Reach).index()
46+
override var interactReach by c.setting("Interact Reach", 4.5, 1.0..7.0, 0.01, "Maximum block interaction distance").group(baseGroup, Group.Reach).index()
5047
override val scanReach: Double get() = max(attackReach, interactReach)
5148

5249
override val checkSideVisibility by c.setting("Visibility Check", true, "Whether to check if an AABB side is visible").group(baseGroup, Group.Scan).index()
5350
override val strictRayCast by c.setting("Strict Raycast", false, "Whether to include the environment to the ray cast context").group(baseGroup, Group.Scan).index()
5451
override val resolution by c.setting("Resolution", 5, 1..20, 1, "The amount of grid divisions per surface of the hit box", "") { strictRayCast }.group(baseGroup, Group.Scan).index()
5552
override val pointSelection by c.setting("Point Selection", PointSelection.Optimum, "The strategy to select the best hit point").group(baseGroup, Group.Scan).index()
56-
57-
companion object {
58-
const val DEFAULT_ATTACK_REACH = 3.0
59-
const val DEFAULT_INTERACT_REACH = 4.5
60-
}
6153
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ class InteractSettings(
3737
override val tickStageMask by c.setting("Interaction Stage Mask", setOf(TickEvent.Input.Post), ALL_STAGES.toSet(), description = "The sub-tick timing at which place actions are performed").group(baseGroup).index()
3838
override val interactConfirmationMode by c.setting("Interact Confirmation", InteractConfirmationMode.PlaceThenAwait, "Wait for block placement confirmation").group(baseGroup).index()
3939
override val interactDelay by c.setting("Interact Delay", 0, 0..3, 1, "Tick delay between interacting with another block").group(baseGroup).index()
40-
override val maxPendingInteractions by c.setting("Max Pending Interactions", 5, 0..30, 1, "The maximum amount of pending placements").group(baseGroup).index()
4140
override val interactionsPerTick by c.setting("Interactions Per Tick", 1, 1..30, 1, "Maximum instant block places per tick").group(baseGroup).index()
4241
override val swing by c.setting("Swing On Interact", true, "Swings the players hand when placing").group(baseGroup).index()
4342
override val swingType by c.setting("Interact Swing Type", BuildConfig.SwingType.Vanilla, "The style of swing") { swing }.group(baseGroup).index()

src/main/kotlin/com/lambda/interaction/managers/PostActionHandler.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ abstract class PostActionHandler<T : ActionInfo> {
5252
}
5353

5454
fun Automated.setPendingConfigs() {
55-
BrokenBlockHandler.pendingActions.setSizeLimit(breakConfig.maxPendingBreaks)
55+
BrokenBlockHandler.pendingActions.setSizeLimit(buildConfig.maxPendingActions)
5656
BrokenBlockHandler.pendingActions.setDecayTime(buildConfig.actionTimeout * 50L)
5757
}
5858
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ interface BreakConfig : ActionConfig, ISettingGroup {
4848

4949
val breakConfirmation: BreakConfirmationMode
5050
val breaksPerTick: Int
51-
val maxPendingBreaks: Int
5251

5352
val avoidLiquids: Boolean
5453
val avoidSupporting: Boolean

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ import net.minecraft.util.Hand
9999
import net.minecraft.util.math.BlockPos
100100
import net.minecraft.util.math.Box
101101
import kotlin.math.max
102-
import kotlin.math.min
103102

104103
/**
105104
* Manager responsible for breaking blocks in the most efficient manner possible. It can be accessed
@@ -412,12 +411,7 @@ object BreakManager : Manager<BreakRequest>(
412411
}
413412

414413
breaks = newBreaks
415-
.take(
416-
min(
417-
breakConfig.maxPendingBreaks - pendingBreakCount,
418-
buildConfig.maxPendingActions - request.pendingInteractions.size
419-
).coerceAtLeast(0)
420-
)
414+
.take(buildConfig.maxPendingActions - request.pendingInteractions.size.coerceAtLeast(0))
421415
.toMutableList()
422416

423417
logger.debug("${breaks.size} unprocessed breaks")

src/main/kotlin/com/lambda/interaction/managers/interacting/InteractConfig.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ interface InteractConfig : ActionConfig, ISettingGroup {
3030
val axisRotate get() = rotate && airPlace.isEnabled && axisRotateSetting
3131
val interactConfirmationMode: InteractConfirmationMode
3232
val interactDelay: Int
33-
val maxPendingInteractions: Int
3433
val interactionsPerTick: Int
3534
val swing: Boolean
3635
val swingType: BuildConfig.SwingType

src/main/kotlin/com/lambda/interaction/managers/interacting/InteractManager.kt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ import net.minecraft.util.Hand
6868
import net.minecraft.util.hit.BlockHitResult
6969
import net.minecraft.util.math.BlockPos
7070
import net.minecraft.world.GameMode
71-
import kotlin.math.min
7271

7372
object InteractManager : Manager<InteractRequest>(
7473
0,
@@ -209,12 +208,7 @@ object InteractManager : Manager<InteractRequest>(
209208
potentialPlacements = request.contexts
210209
.distinctBy { it.blockPos }
211210
.filter { !isPosBlocked(it.blockPos) }
212-
.take(
213-
min(
214-
interactConfig.maxPendingInteractions - pendingActions.size,
215-
buildConfig.maxPendingActions - request.pendingInteractions.size
216-
).coerceAtLeast(0)
217-
)
211+
.take(buildConfig.maxPendingActions - request.pendingInteractions.size.coerceAtLeast(0))
218212
.toMutableList()
219213
logger.debug("${potentialPlacements.size} potential placements")
220214

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,22 @@ object FastBreak : Module(
3939
init {
4040
setDefaultAutomationConfig {
4141
applyEdits {
42-
hideAllGroupsExcept(breakConfig, rotationConfig, hotbarConfig)
42+
hideAllGroupsExcept(buildConfig, breakConfig, rotationConfig, hotbarConfig)
4343
buildConfig.apply {
44-
editTyped(
44+
hide(
4545
::pathing,
4646
::stayInRange,
47-
::useDefaultReach,
47+
::spleefEntities,
48+
::maxBuildDependencies,
49+
::collectDrops,
50+
::interactReach,
51+
::attackReach
52+
)
53+
::maxBuildDependencies.edit { defaultValue(0) }
54+
editTyped(
4855
::checkSideVisibility,
4956
::strictRayCast
50-
) { defaultValue(false) }
51-
::actionsPerTick.edit { defaultValue(1) }
57+
) { defaultValue(false); hide() }
5258
::interactReach.edit { defaultValue(Double.MAX_VALUE) }
5359
}
5460
breakConfig.apply {
@@ -64,7 +70,6 @@ object FastBreak : Module(
6470
) { defaultValue(false); hide() }
6571
::breaksPerTick.edit { defaultValue(1); hide() }
6672
::tickStageMask.edit { defaultValue(mutableSetOf(TickEvent.Input.Post)); hide() }
67-
::maxPendingBreaks.edit { defaultValue(Int.MAX_VALUE); hide() }
6873
hide(::sorter, ::unsafeCancels)
6974
}
7075
hotbarConfig::tickStageMask.edit { defaultValue(mutableSetOf(TickEvent.Input.Post)); hide() }

0 commit comments

Comments
 (0)