Skip to content

Commit 837f5a9

Browse files
committed
separated interact settings into their own page in the build config and removed unused priority var's
1 parent fe14b56 commit 837f5a9

File tree

29 files changed

+166
-135
lines changed

29 files changed

+166
-135
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,14 @@ package com.lambda.config.groups
1919

2020
import com.lambda.config.Configurable
2121
import com.lambda.event.events.TickEvent
22-
import com.lambda.interaction.request.Priority
2322
import com.lambda.interaction.request.breaking.BreakConfig
2423
import com.lambda.util.BlockUtils.allSigns
2524
import java.awt.Color
2625

2726
class BreakSettings(
2827
c: Configurable,
29-
priority: Priority = 0,
3028
vis: () -> Boolean = { true }
31-
) : BreakConfig(priority) {
29+
) : BreakConfig() {
3230
val page by c.setting("Break Page", Page.General, visibility = vis)
3331
override val breakMode by c.setting("Break Mode", BreakMode.Packet) { vis() && page == Page.General }
3432
override val reBreak by c.setting("ReBreak", true, "Re-breaks blocks after they've been broken once") { vis() && page == Page.General }

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ interface BuildConfig {
3232
// Placing
3333
val placing: PlaceSettings
3434

35+
// Interacting
36+
val interacting: InteractSettings
37+
3538
enum class SwingType {
3639
Vanilla,
3740
Server,

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class BuildSettings(
2626
vis: () -> Boolean = { true }
2727
) : BuildConfig {
2828
enum class Page {
29-
General, Break, Place
29+
General, Break, Place, Interact
3030
}
3131

3232
private val page by c.setting("Build Page", Page.General, "Current page", vis)
@@ -44,5 +44,12 @@ class BuildSettings(
4444
// Placing
4545
override val placing = PlaceSettings(c) { page == Page.Place && vis() }
4646

47-
override val interactionTimeout by c.setting("Interaction Timeout", 10, 1..30, 1, "Timeout for block breaks in ticks", unit = " ticks") { vis() && ((page == Page.Place && placing.placeConfirmationMode != PlaceConfig.PlaceConfirmationMode.None) || (page == Page.Break && breaking.breakConfirmation != BreakConfirmationMode.None)) }
47+
//Interacting
48+
override val interacting = InteractSettings(c) { page == Page.Interact && vis() }
49+
50+
override val interactionTimeout by c.setting("Interaction Timeout", 10, 1..30, 1, "Timeout for block breaks in ticks", unit = " ticks") {
51+
vis() && ((page == Page.Place && placing.placeConfirmationMode != PlaceConfig.PlaceConfirmationMode.None)
52+
|| (page == Page.Break && breaking.breakConfirmation != BreakConfirmationMode.None)
53+
|| (page == Page.Interact && interacting.interactConfirmationMode != InteractionConfig.InteractConfirmationMode.None))
54+
}
4855
}

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,12 @@ package com.lambda.config.groups
1919

2020
import com.lambda.config.Configurable
2121
import com.lambda.event.events.TickEvent
22-
import com.lambda.interaction.request.Priority
2322
import com.lambda.interaction.request.hotbar.HotbarConfig
2423

2524
class HotbarSettings(
2625
c: Configurable,
27-
priority: Priority = 0,
2826
vis: () -> Boolean = { true }
29-
) : HotbarConfig(priority) {
27+
) : HotbarConfig() {
3028
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)
3129
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)
3230
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() }
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright 2025 Lambda
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
package com.lambda.config.groups
19+
20+
import com.lambda.config.groups.InteractionConfig.InteractConfirmationMode
21+
import com.lambda.interaction.request.RequestConfig
22+
import com.lambda.interaction.request.interacting.InteractionManager
23+
import com.lambda.interaction.request.interacting.InteractionRequest
24+
25+
abstract class InteractConfig : RequestConfig<InteractionRequest>() {
26+
abstract val rotate: Boolean
27+
abstract val swingHand: Boolean
28+
abstract val interactSwingType: BuildConfig.SwingType
29+
abstract val interactConfirmationMode: InteractConfirmationMode
30+
31+
override fun requestInternal(request: InteractionRequest, queueIfClosed: Boolean) {
32+
InteractionManager.request(request, queueIfClosed)
33+
}
34+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright 2025 Lambda
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
package com.lambda.config.groups
19+
20+
import com.lambda.config.Configurable
21+
22+
class InteractSettings(
23+
c: Configurable,
24+
vis: () -> Boolean = { true }
25+
) : InteractConfig() {
26+
override val rotate by c.setting("Rotate For Interact", true, "Rotates the player to look at the block when interacting", visibility = vis)
27+
override val swingHand by c.setting("Swing On Interact", true, "Swings the players hand after interacting", visibility = vis)
28+
override val interactSwingType by c.setting("Interact Swing Type", BuildConfig.SwingType.Vanilla, "The style of swing") { vis() && swingHand }
29+
override val interactConfirmationMode by c.setting("Interact Confirmation Mode", InteractionConfig.InteractConfirmationMode.InteractThenAwait, "The style of confirmation for interactions", visibility = vis)
30+
}

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

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ import com.lambda.interaction.request.interacting.InteractionManager
2222
import com.lambda.interaction.request.interacting.InteractionRequest
2323
import com.lambda.interaction.request.rotating.visibilty.PointSelection
2424

25-
abstract class InteractionConfig(
26-
priority: Int
27-
) : RequestConfig<InteractionRequest>(priority) {
25+
abstract class InteractionConfig : RequestConfig<InteractionRequest>() {
2826
/**
2927
* Maximum entity interaction distance
3028
*/
@@ -35,11 +33,6 @@ abstract class InteractionConfig(
3533
*/
3634
abstract val interactReach: Double
3735

38-
/**
39-
* Rotates the player for block interactions. For example, right-clicking a chest to open it.
40-
*/
41-
abstract val rotate: Boolean
42-
4336
/**
4437
* Maximum possible interaction distance
4538
*
@@ -69,21 +62,6 @@ abstract class InteractionConfig(
6962
*/
7063
abstract val pointSelection: PointSelection
7164

72-
/**
73-
* The method of confirming the interaction had taken place server side
74-
*/
75-
abstract val interactConfirmationMode: InteractConfirmationMode
76-
77-
/**
78-
* Whether to swing the hand when interacting.
79-
*/
80-
abstract val swingHand: Boolean
81-
82-
/**
83-
* The style of hand swing to use
84-
*/
85-
abstract val interactSwingType: BuildConfig.SwingType
86-
8765
override fun requestInternal(request: InteractionRequest, queueIfClosed: Boolean) {
8866
InteractionManager.request(request, queueIfClosed)
8967
}

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,12 @@ class InteractionSettings(
2626
c: Configurable,
2727
private val usage: InteractionMask,
2828
vis: () -> Boolean = { true },
29-
) : InteractionConfig(0) {
29+
) : InteractionConfig() {
3030
// Reach
3131
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

35-
override val rotate by c.setting("Rotate For Interactions", true, "Rotates the player for block interactions. For example, right-clicking a chest to open it", visibility = vis)
36-
3735
override val attackReach: Double get() {
3836
check(usage.entity) {
3937
"Given interaction config has no attack reach implementation"
@@ -62,12 +60,6 @@ class InteractionSettings(
6260
override val resolution by c.setting("Resolution", 5, 1..20, 1, "The amount of grid divisions per surface of the hit box", "", visibility = vis)
6361
override val pointSelection by c.setting("Point Selection", PointSelection.Optimum, "The strategy to select the best hit point", visibility = vis)
6462

65-
override val interactConfirmationMode by c.setting("Interact Confirmation Mode", InteractConfirmationMode.InteractThenAwait, "The style of confirmation used when interacting", visibility = vis)
66-
67-
// Swing
68-
override val swingHand by c.setting("Swing Hand", true, "Whether to swing hand on interactions", visibility = vis)
69-
override val interactSwingType by c.setting("Interact Swing Type", BuildConfig.SwingType.Vanilla, "The style of swing") { vis() && swingHand }
70-
7163
companion object {
7264
const val DEFAULT_ATTACK_REACH = 3.0
7365
const val DEFAULT_INTERACT_REACH = 4.5

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,20 @@ package com.lambda.config.groups
1919

2020
import com.lambda.config.Configurable
2121
import com.lambda.event.events.TickEvent
22-
import com.lambda.interaction.request.Priority
2322
import com.lambda.interaction.request.placing.PlaceConfig
2423

2524
class PlaceSettings(
2625
c: Configurable,
27-
priority: Priority = 0,
2826
vis: () -> Boolean = { true }
29-
) : PlaceConfig(priority) {
27+
) : PlaceConfig() {
3028
override val rotateForPlace by c.setting("Rotate For Place", true, "Rotate towards block while placing", visibility = vis)
3129
override val airPlace by c.setting("Air Place", AirPlaceMode.None, "Allows for placing blocks without adjacent faces", visibility = vis)
3230
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() }
3331
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)
3432
override val placeConfirmationMode by c.setting("Place Confirmation", PlaceConfirmationMode.PlaceThenAwait, "Wait for block placement confirmation", visibility = vis)
3533
override val maxPendingPlacements by c.setting("Max Pending Placements", 5, 0..30, 1, "The maximum amount of pending placements", visibility = vis)
3634
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)
35+
override val swing by c.setting("Swing On Place", true, "Swings the players hand when placing", visibility = vis)
3836
override val swingType by c.setting("Place Swing Type", BuildConfig.SwingType.Vanilla, "The style of swing") { vis() && swing }
3937
override val sounds by c.setting("Place Sounds", true, "Plays the placing sounds", visibility = vis)
4038
}

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
package com.lambda.config.groups
1919

2020
import com.lambda.config.Configurable
21-
import com.lambda.interaction.request.Priority
2221
import com.lambda.interaction.request.rotating.RotationConfig
2322
import com.lambda.interaction.request.rotating.RotationMode
2423
import kotlin.math.PI
@@ -30,9 +29,8 @@ import kotlin.random.Random
3029

3130
class RotationSettings(
3231
c: Configurable,
33-
priority: Priority = 0,
3432
vis: () -> Boolean = { true }
35-
) : RotationConfig(priority) {
33+
) : RotationConfig() {
3634
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)
3735

3836
/** How many ticks to keep the rotation before resetting */

0 commit comments

Comments
 (0)