Skip to content

Commit 342b9da

Browse files
committed
open all managers on all tick stages by default with a blacklist. Also fix tick stage settings
1 parent 0565a8d commit 342b9da

File tree

21 files changed

+66
-52
lines changed

21 files changed

+66
-52
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import com.lambda.config.settings.CharSetting
2525
import com.lambda.config.settings.FunctionSetting
2626
import com.lambda.config.settings.StringSetting
2727
import com.lambda.config.settings.collections.BlockCollectionSetting
28-
import com.lambda.config.settings.collections.CollectionSettings
28+
import com.lambda.config.settings.collections.CollectionSetting
2929
import com.lambda.config.settings.collections.ItemCollectionSetting
3030
import com.lambda.config.settings.collections.MapSetting
3131
import com.lambda.config.settings.comparable.BooleanSetting
@@ -160,7 +160,7 @@ abstract class Configurable(
160160
defaultValue: Collection<T> = immutableList,
161161
description: String = "",
162162
noinline visibility: () -> Boolean = { true },
163-
) = CollectionSettings(
163+
) = CollectionSetting(
164164
name,
165165
immutableList,
166166
defaultValue.toMutableList(),

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package com.lambda.config.groups
2020
import com.lambda.config.Configurable
2121
import com.lambda.config.SettingGroup
2222
import com.lambda.event.events.TickEvent
23+
import com.lambda.event.events.TickEvent.Companion.ALL_STAGES
2324
import com.lambda.interaction.request.breaking.BreakConfig
2425
import com.lambda.interaction.request.breaking.BreakConfig.AnimationMode
2526
import com.lambda.interaction.request.breaking.BreakConfig.BreakConfirmationMode
@@ -56,7 +57,7 @@ open class BreakSettings(
5657
override val breakDelay by c.setting("Break Delay", 0, 0..6, 1, "The delay between breaking blocks", " tick(s)").group(baseGroup, Group.General).index()
5758

5859
// Timing
59-
override val tickStageMask by c.setting("Break Stage Mask", setOf<TickEvent>(TickEvent.Input.Post), description = "The sub-tick timing at which break actions can be performed").group(baseGroup, Group.General).index()
60+
override val tickStageMask by c.setting("Break Stage Mask", ALL_STAGES.toSet(), setOf(TickEvent.Input.Post), description = "The sub-tick timing at which break actions can be performed").group(baseGroup, Group.General).index()
6061

6162
// Swap
6263
override val swapMode by c.setting("Swap Mode", BreakConfig.SwapMode.End, "Decides when to swap to the best suited tool when breaking a block").group(baseGroup, Group.General).index()

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package com.lambda.config.groups
2020
import com.lambda.config.Configurable
2121
import com.lambda.config.SettingGroup
2222
import com.lambda.event.events.TickEvent
23+
import com.lambda.event.events.TickEvent.Companion.ALL_STAGES
2324
import com.lambda.interaction.request.hotbar.HotbarConfig
2425
import com.lambda.util.NamedEnum
2526

@@ -31,5 +32,5 @@ class HotbarSettings(
3132
override val swapDelay by c.setting("Swap Delay", 0, 0..3, 1, "The number of ticks delay before allowing another hotbar selection swap", " ticks").group(baseGroup).index()
3233
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 }.group(baseGroup).index()
3334
override val swapPause by c.setting("Swap Pause", 0, 0..20, 1, "The delay in ticks to pause actions after switching to the slot", " ticks").group(baseGroup).index()
34-
override val tickStageMask by c.setting("Hotbar Stage Mask", setOf<TickEvent>(TickEvent.Input.Post), description = "The sub-tick timing at which hotbar actions are performed").group(baseGroup).index()
35+
override val tickStageMask by c.setting("Hotbar Stage Mask", ALL_STAGES.toSet(), setOf(TickEvent.Input.Post), description = "The sub-tick timing at which hotbar actions are performed").group(baseGroup).index()
3536
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package com.lambda.config.groups
2020
import com.lambda.config.Configurable
2121
import com.lambda.config.SettingGroup
2222
import com.lambda.event.events.TickEvent
23+
import com.lambda.event.events.TickEvent.Companion.ALL_STAGES
2324
import com.lambda.interaction.request.interacting.InteractConfig
2425
import com.lambda.util.NamedEnum
2526

@@ -30,7 +31,7 @@ class InteractSettings(
3031
override val rotate by c.setting("Rotate For Interact", true, "Rotates the player to look at the block when interacting").group(baseGroup).index()
3132
override val sorter by c.setting("Interact Sorter", ActionConfig.SortMode.Tool, "The order in which interactions are performed").group(baseGroup).index()
3233
override val swingHand by c.setting("Swing On Interact", true, "Swings the players hand after interacting").group(baseGroup).index()
33-
override val tickStageMask by c.setting("Interact Stage Mask", setOf<TickEvent>(TickEvent.Input.Post), description = "The sub-tick timing at which interact actions are performed").group(baseGroup).index()
34+
override val tickStageMask by c.setting("Interact Stage Mask", ALL_STAGES.toSet(), setOf(TickEvent.Input.Post), description = "The sub-tick timing at which interact actions are performed").group(baseGroup).index()
3435
override val interactSwingType by c.setting("Interact Swing Type", BuildConfig.SwingType.Vanilla, "The style of swing") { swingHand }.group(baseGroup).index()
3536
override val interactConfirmationMode by c.setting("Interact Confirmation Mode", InteractConfig.InteractConfirmationMode.InteractThenAwait, "The style of confirmation for interactions").group(baseGroup).index()
3637
}

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

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

2020
import com.lambda.config.Configurable
2121
import com.lambda.config.SettingGroup
22-
import com.lambda.event.events.TickEvent
22+
import com.lambda.event.events.TickEvent.Companion.ALL_STAGES
2323
import com.lambda.interaction.request.inventory.InventoryConfig
2424
import com.lambda.util.NamedEnum
2525
import com.lambda.util.item.ItemUtils
@@ -35,7 +35,7 @@ class InventorySettings(
3535
}
3636

3737
override val actionsPerSecond by c.setting("Actions Per Second", 100, 0..100, 1, "How many inventory actions can be performed per tick").group(baseGroup, Group.General).index()
38-
override val tickStageMask by c.setting("Inventory Stage Mask", setOf(TickEvent.Pre, TickEvent.Input.Pre, TickEvent.Input.Post, TickEvent.Player.Post), description = "The sub-tick timing at which inventory actions are performed").group(baseGroup, Group.General).index()
38+
override val tickStageMask by c.setting("Inventory Stage Mask", ALL_STAGES.toSet(), description = "The sub-tick timing at which inventory actions are performed").group(baseGroup, Group.General).index()
3939
override val disposables by c.setting("Disposables", ItemUtils.defaultDisposables, description = "Items that will be ignored when checking for a free slot").group(baseGroup, Group.Container).index()
4040
override val swapWithDisposables by c.setting("Swap With Disposables", true, "Swap items with disposable ones").group(baseGroup, Group.Container).index()
4141
override val providerPriority by c.setting("Provider Priority", InventoryConfig.Priority.WithMinItems, "What container to prefer when retrieving the item from").group(baseGroup, Group.Container).index()

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package com.lambda.config.groups
2020
import com.lambda.config.Configurable
2121
import com.lambda.config.SettingGroup
2222
import com.lambda.event.events.TickEvent
23+
import com.lambda.event.events.TickEvent.Companion.ALL_STAGES
2324
import com.lambda.interaction.request.placing.PlaceConfig
2425
import com.lambda.interaction.request.placing.PlaceConfig.AirPlaceMode
2526
import com.lambda.interaction.request.placing.PlaceConfig.PlaceConfirmationMode
@@ -33,7 +34,7 @@ class PlaceSettings(
3334
override val airPlace by c.setting("Air Place", AirPlaceMode.None, "Allows for placing blocks without adjacent faces").group(baseGroup).index()
3435
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") { airPlace.isEnabled }.group(baseGroup).index()
3536
override val sorter by c.setting("Place Sorter", ActionConfig.SortMode.Tool, "The order in which placements are performed").group(baseGroup).index()
36-
override val tickStageMask by c.setting("Place Stage mask", setOf<TickEvent>(TickEvent.Input.Post), description = "The sub-tick timing at which place actions are performed").group(baseGroup).index()
37+
override val tickStageMask by c.setting("Place Stage mask", ALL_STAGES.toSet(), setOf(TickEvent.Input.Post), description = "The sub-tick timing at which place actions are performed").group(baseGroup).index()
3738
override val placeConfirmationMode by c.setting("Place Confirmation", PlaceConfirmationMode.PlaceThenAwait, "Wait for block placement confirmation").group(baseGroup).index()
3839
override val maxPendingPlacements by c.setting("Max Pending Placements", 5, 0..30, 1, "The maximum amount of pending placements").group(baseGroup).index()
3940
override val placementsPerTick by c.setting("Places Per Tick", 1, 1..30, 1, "Maximum instant block places per tick").group(baseGroup).index()

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package com.lambda.config.groups
1919

2020
import com.lambda.config.Configurable
2121
import com.lambda.config.SettingGroup
22+
import com.lambda.event.events.TickEvent
2223
import com.lambda.event.events.TickEvent.Companion.ALL_STAGES
2324
import com.lambda.interaction.request.rotating.RotationConfig
2425
import com.lambda.interaction.request.rotating.RotationMode
@@ -42,7 +43,7 @@ class RotationSettings(
4243
/** How many ticks to wait before resetting the rotation */
4344
override val decayTicks by c.setting("Reset Rotation", 1, 1..10, 1, "Ticks before rotation is reset", " ticks") { rotate }.group(baseGroup).index()
4445

45-
override val tickStageMask = ALL_STAGES.toSet()
46+
override val tickStageMask = ALL_STAGES.subList(0, ALL_STAGES.indexOf(TickEvent.Player.Post)).toSet()
4647

4748
/** Whether the rotation is instant */
4849
var instant by c.setting("Instant Rotation", true, "Instantly rotate") { rotate }.group(baseGroup).index()

src/main/kotlin/com/lambda/config/settings/collections/BlockCollectionSetting.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class BlockCollectionSetting(
2929
defaultValue: MutableCollection<Block>,
3030
description: String,
3131
visibility: () -> Boolean,
32-
) : CollectionSettings<Block>(
32+
) : CollectionSetting<Block>(
3333
name,
3434
immutableCollection,
3535
defaultValue,

src/main/kotlin/com/lambda/config/settings/collections/CollectionSettings.kt renamed to src/main/kotlin/com/lambda/config/settings/collections/CollectionSetting.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import java.lang.reflect.Type
3030
/**
3131
* @see [com.lambda.config.Configurable]
3232
*/
33-
open class CollectionSettings<T : Any>(
33+
open class CollectionSetting<T : Any>(
3434
override var name: String,
3535
private var immutableCollection: Collection<T>,
3636
defaultValue: MutableCollection<T>,
@@ -82,7 +82,7 @@ open class CollectionSettings<T : Any>(
8282
@SettingEditorDsl
8383
@Suppress("unchecked_cast")
8484
fun <T : Any> SettingGroupEditor.TypedEditBuilder<Collection<T>>.immutableCollection(collection: Collection<T>) {
85-
(settings as Collection<CollectionSettings<T>>).forEach { it.immutableCollection = collection }
85+
(settings as Collection<CollectionSetting<T>>).forEach { it.immutableCollection = collection }
8686
}
8787
}
8888
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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.settings.collections
19+
20+
import net.minecraft.item.Item
21+
22+
class EventCollectionSetting<T : Any>(
23+
override var name: String,
24+
private val immutableSet: Set<T>,
25+
defaultValue: MutableSet<T>,
26+
description: String,
27+
visibility: () -> Boolean
28+
) : CollectionSetting<T>(
29+
name,
30+
immutableSet,
31+
defaultValue,
32+
Item::class.java,
33+
description,
34+
visibility,
35+
) {
36+
37+
}

0 commit comments

Comments
 (0)