Skip to content

Commit 3b43ed3

Browse files
committed
a button to access the automation configs within modules
1 parent ca4b17e commit 3b43ed3

24 files changed

+214
-394
lines changed

src/main/kotlin/com/lambda/config/AbstractSetting.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ abstract class AbstractSetting<T : Any>(
102102
var visibility: () -> Boolean,
103103
) : Jsonable, Nameable, Describable, Layout {
104104
private val listeners = mutableListOf<ValueListener<T>>()
105+
var disabled = { false }
105106
var groups: MutableList<List<NamedEnum>> = mutableListOf()
106107

107108
var value by Delegates.observable(defaultValue) { _, from, to ->
@@ -152,6 +153,10 @@ abstract class AbstractSetting<T : Any>(
152153
listeners.add(ValueListener(false, block))
153154
}
154155

156+
fun disabled(predicate: () -> Boolean) = apply {
157+
disabled = predicate
158+
}
159+
155160
fun group(path: List<NamedEnum>, vararg continuation: NamedEnum) = apply {
156161
groups.add(path + continuation)
157162
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ open class BreakSettings(
3232
c: Configurable,
3333
baseGroup: NamedEnum,
3434
vis: () -> Boolean = { true },
35-
) : BreakConfig, MutableSettings(c) {
35+
) : BreakConfig {
3636
enum class Group(override val displayName: String) : NamedEnum {
3737
General("General"),
3838
Cosmetic("Cosmetic")

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class BuildSettings(
2626
c: Configurable,
2727
vararg baseGroup: NamedEnum,
2828
vis: () -> Boolean = { true },
29-
) : BuildConfig, MutableSettings(c) {
29+
) : BuildConfig {
3030
enum class Group(override val displayName: String) : NamedEnum {
3131
General("General"),
3232
Reach("Reach"),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class EatSettings(
2525
c: Configurable,
2626
baseGroup: NamedEnum,
2727
vis: () -> Boolean = { true }
28-
) : EatConfig, MutableSettings(c) {
28+
) : EatConfig {
2929
val nutritiousFoodDefaults = listOf(Items.APPLE, Items.BAKED_POTATO, Items.BEEF, Items.BEETROOT, Items.BEETROOT_SOUP, Items.BREAD, Items.CARROT, Items.CHICKEN, Items.CHORUS_FRUIT, Items.COD, Items.COOKED_BEEF, Items.COOKED_CHICKEN, Items.COOKED_COD, Items.COOKED_MUTTON, Items.COOKED_PORKCHOP, Items.COOKED_RABBIT, Items.COOKED_SALMON, Items.COOKIE, Items.DRIED_KELP, Items.ENCHANTED_GOLDEN_APPLE, Items.GOLDEN_APPLE, Items.GOLDEN_CARROT, Items.HONEY_BOTTLE, Items.MELON_SLICE, Items.MUSHROOM_STEW, Items.MUTTON, Items.POISONOUS_POTATO, Items.PORKCHOP, Items.POTATO, Items.PUFFERFISH, Items.PUMPKIN_PIE, Items.RABBIT, Items.RABBIT_STEW, Items.ROTTEN_FLESH, Items.SALMON, Items.SPIDER_EYE, Items.SUSPICIOUS_STEW, Items.SWEET_BERRIES, Items.GLOW_BERRIES, Items.TROPICAL_FISH)
3030
val resistanceFoodDefaults = listOf(Items.ENCHANTED_GOLDEN_APPLE)
3131
val regenerationFoodDefaults = listOf(Items.ENCHANTED_GOLDEN_APPLE, Items.GOLDEN_APPLE)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class HotbarSettings(
2626
c: Configurable,
2727
baseGroup: NamedEnum,
2828
vis: () -> Boolean = { true }
29-
) : HotbarConfig, MutableSettings(c) {
29+
) : HotbarConfig {
3030
override val keepTicks by c.setting("Keep Ticks", 1, 0..20, 1, "The number of ticks to keep the current hotbar selection active", " ticks", visibility = vis).group(baseGroup)
3131
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).group(baseGroup)
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() }.group(baseGroup)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class InteractSettings(
2626
c: Configurable,
2727
baseGroup: NamedEnum,
2828
vis: () -> Boolean = { true }
29-
) : InteractConfig, MutableSettings(c) {
29+
) : InteractConfig {
3030
override val rotate by c.setting("Rotate For Interact", true, "Rotates the player to look at the block when interacting", visibility = vis).group(baseGroup)
3131
override val sorter by c.setting("Interact Sorter", ActionConfig.SortMode.Tool, "The order in which interactions are performed", visibility = vis).group(baseGroup)
3232
override val swingHand by c.setting("Swing On Interact", true, "Swings the players hand after interacting", visibility = vis).group(baseGroup)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class InventorySettings(
2727
c: Configurable,
2828
baseGroup: NamedEnum,
2929
vis: () -> Boolean = { true }
30-
) : InventoryConfig, MutableSettings(c) {
30+
) : InventoryConfig {
3131
enum class Group(override val displayName: String) : NamedEnum {
3232
General("General"),
3333
Container("Container"),

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

Lines changed: 0 additions & 151 deletions
This file was deleted.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class PlaceSettings(
2828
c: Configurable,
2929
baseGroup: NamedEnum,
3030
vis: () -> Boolean = { true }
31-
) : PlaceConfig, MutableSettings(c) {
31+
) : PlaceConfig {
3232
override val rotateForPlace by c.setting("Rotate For Place", true, "Rotate towards block while placing", visibility = vis).group(baseGroup)
3333
override val airPlace by c.setting("Air Place", AirPlaceMode.None, "Allows for placing blocks without adjacent faces", visibility = vis).group(baseGroup)
3434
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 }.group(baseGroup)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class RotationSettings(
3232
c: Configurable,
3333
baseGroup: NamedEnum? = null,
3434
vis: () -> Boolean = { true }
35-
) : RotationConfig, MutableSettings(c) {
35+
) : RotationConfig {
3636
override var rotationMode by c.setting("Mode", RotationMode.Sync, "How the player is being rotated on interaction", vis).group(baseGroup)
3737

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

0 commit comments

Comments
 (0)