Skip to content

Commit c50ad7b

Browse files
committed
Advanced break place settings
1 parent f42d592 commit c50ad7b

File tree

6 files changed

+53
-23
lines changed

6 files changed

+53
-23
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ package com.lambda.config.groups
33
interface BuildConfig {
44
val breakCoolDown: Int
55
val placeCooldown: Int
6-
val placeConfirmation: Boolean
76
val breakConfirmation: Boolean
7+
val placeConfirmation: Boolean
88
val collectDrops: Boolean
99
val breakWeakBlocks: Boolean
1010
val pathing: Boolean
1111
val breaksPerTick: Int
1212
val rotateForBreak: Boolean
1313
val rotateForPlace: Boolean
14-
val swingHand: Boolean
1514
}

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

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,42 @@ class BuildSettings(
66
c: Configurable,
77
vis: () -> Boolean = { true }
88
) : BuildConfig {
9-
override val breakCoolDown by c.setting("Break Cooldown", 0, 0..1000, 1, "Delay between breaking blocks", " ms", vis)
10-
override val placeCooldown by c.setting("Place Cooldown", 0, 0..1000, 1, "Delay between placing blocks", " ms", vis)
11-
override val placeConfirmation by c.setting("Place Confirmation", false, "Wait for block placement confirmation", vis)
12-
override val breakConfirmation by c.setting("Break Confirmation", false, "Wait for block break confirmation", vis)
13-
override val collectDrops by c.setting("Collect All Drops", false, "Collect all drops when breaking blocks", vis)
14-
override val breakWeakBlocks by c.setting("Break Weak Blocks", false, "Break blocks that dont have structural integrity (e.g: grass)", vis)
15-
override val pathing by c.setting("Pathing", true, "Path to blocks", vis)
16-
override val breaksPerTick by c.setting("Instant Breaks Per Tick", 10, 1..30, 1, "Maximum instant block breaks per tick", "", vis)
17-
override val rotateForBreak by c.setting("Rotate For Break", false, "Rotate towards block while breaking", vis)
18-
override val rotateForPlace by c.setting("Rotate For Place", true, "Rotate towards block while placing", vis)
19-
override val swingHand by c.setting("Swing Hand", true, "Swing hand on interactions", vis)
9+
enum class Page {
10+
BREAK, PLACE, PATHING
11+
}
12+
13+
val page by c.setting("Build Page", Page.BREAK, "Current page", vis)
14+
15+
override val breakCoolDown by c.setting("Break Cooldown", 0, 0..1000, 1, "Delay between breaking blocks", " ms") {
16+
vis() && page == Page.BREAK
17+
}
18+
override val breakConfirmation by c.setting("Break Confirmation", false, "Wait for block break confirmation") {
19+
vis() && page == Page.BREAK
20+
}
21+
override val breakWeakBlocks by c.setting("Break Weak Blocks", false, "Break blocks that dont have structural integrity (e.g: grass)") {
22+
vis() && page == Page.BREAK
23+
}
24+
override val breaksPerTick by c.setting("Instant Breaks Per Tick", 10, 1..30, 1, "Maximum instant block breaks per tick") {
25+
vis() && page == Page.BREAK
26+
}
27+
override val rotateForBreak by c.setting("Rotate For Break", false, "Rotate towards block while breaking") {
28+
vis() && page == Page.BREAK
29+
}
30+
31+
override val placeCooldown by c.setting("Place Cooldown", 0, 0..1000, 1, "Delay between placing blocks", " ms") {
32+
vis() && page == Page.PLACE
33+
}
34+
override val placeConfirmation by c.setting("Place Confirmation", false, "Wait for block placement confirmation") {
35+
vis() && page == Page.PLACE
36+
}
37+
override val collectDrops by c.setting("Collect All Drops", false, "Collect all drops when breaking blocks") {
38+
vis() && page == Page.PLACE
39+
}
40+
override val rotateForPlace by c.setting("Rotate For Place", true, "Rotate towards block while placing") {
41+
vis() && page == Page.PLACE
42+
}
43+
44+
override val pathing by c.setting("Pathing", true, "Path to blocks") {
45+
vis() && page == Page.PATHING
46+
}
2047
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ interface InteractionConfig {
1212
val resolution: Int
1313

1414
val useRayCast: Boolean
15+
val swingHand: Boolean
1516
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ class InteractionSettings(
1010
override val reach by c.setting("Reach", 4.9, 0.1..10.0, 0.1, "Players reach / range", " blocks", vis)
1111
override val useRayCast by c.setting("Raycast", false, "Verify hit vector with ray casting (for very strict ACs)", vis)
1212
override val resolution by c.setting("Resolution", 5, 1..20, 1, "How many raycast checks per surface (will be squared)") { vis() && useRayCast }
13+
override val swingHand by c.setting("Swing Hand", true, "Swing hand on interactions", vis)
1314
}

common/src/main/kotlin/com/lambda/task/tasks/BreakBlock.kt

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ import net.minecraft.util.math.Direction
2525

2626
class BreakBlock @Ta5kBuilder constructor(
2727
private val ctx: BreakContext,
28-
private val rotationConfig: IRotationConfig = TaskFlow.rotation,
29-
private val interactionConfig: InteractionConfig = TaskFlow.interact,
30-
private val sides: Set<Direction> = emptySet(),
31-
private var collectDrop: Boolean = TaskFlow.build.collectDrops,
32-
private val rotate: Boolean = TaskFlow.build.rotateForBreak,
33-
private val swingHand: Boolean = TaskFlow.build.swingHand,
28+
private val rotationConfig: IRotationConfig,
29+
private val interactionConfig: InteractionConfig,
30+
private val sides: Set<Direction>,
31+
private var collectDrop: Boolean,
32+
private val rotate: Boolean,
33+
private val swingHand: Boolean,
3434
) : Task<ItemEntity?>() {
3535
val blockPos: BlockPos get() = ctx.result.blockPos
3636
private var beginState: BlockState? = null
@@ -111,15 +111,17 @@ class BreakBlock @Ta5kBuilder constructor(
111111
rotationConfig: IRotationConfig = TaskFlow.rotation,
112112
interactionConfig: InteractionConfig = TaskFlow.interact,
113113
sides: Set<Direction> = emptySet(),
114-
collectDrop: Boolean = false,
115-
rotate: Boolean = false,
114+
collectDrop: Boolean = TaskFlow.build.collectDrops,
115+
rotate: Boolean = TaskFlow.build.rotateForBreak,
116+
swingHand: Boolean = TaskFlow.interact.swingHand,
116117
) = BreakBlock(
117118
ctx,
118119
rotationConfig,
119120
interactionConfig,
120121
sides,
121122
collectDrop,
122-
rotate
123+
rotate,
124+
swingHand
123125
)
124126
}
125127
}

common/src/main/kotlin/com/lambda/task/tasks/PlaceBlock.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class PlaceBlock @Ta5kBuilder constructor(
101101
@Ta5kBuilder
102102
fun placeBlock(
103103
ctx: PlaceContext,
104-
swingHand: Boolean = TaskFlow.build.swingHand,
104+
swingHand: Boolean = TaskFlow.interact.swingHand,
105105
rotate: Boolean = TaskFlow.build.rotateForPlace,
106106
waitForConfirmation: Boolean = TaskFlow.build.placeConfirmation,
107107
) = PlaceBlock(ctx, swingHand, rotate, waitForConfirmation)

0 commit comments

Comments
 (0)