Skip to content

Commit 44c5ae1

Browse files
committed
Merge branch '1.21.5' into feature/module/BetterFirework
2 parents 97a03a5 + 1099c72 commit 44c5ae1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+663
-426
lines changed

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import com.lambda.context.SafeContext
3333
import com.lambda.gui.Layout
3434
import com.lambda.threading.runSafe
3535
import com.lambda.util.Communication.info
36+
import com.lambda.util.Describable
3637
import com.lambda.util.Nameable
3738
import com.lambda.util.NamedEnum
3839
import com.lambda.util.extension.CommandBuilder
@@ -94,13 +95,14 @@ import kotlin.reflect.KProperty
9495
* @property visibility A function that determines whether the setting is visible.
9596
*/
9697
abstract class AbstractSetting<T : Any>(
97-
internal val defaultValue: T,
98+
override var name: String,
99+
internal var defaultValue: T,
98100
val type: Type,
99-
val description: String,
100-
val visibility: () -> Boolean,
101-
) : Jsonable, Nameable, Layout {
101+
override var description: String,
102+
var visibility: () -> Boolean,
103+
) : Jsonable, Nameable, Describable, Layout {
102104
private val listeners = mutableListOf<ValueListener<T>>()
103-
val groups: MutableList<List<NamedEnum>> = mutableListOf()
105+
var groups: MutableList<List<NamedEnum>> = mutableListOf()
104106

105107
var value by Delegates.observable(defaultValue) { _, from, to ->
106108
listeners.forEach {
@@ -185,7 +187,7 @@ abstract class AbstractSetting<T : Any>(
185187
val previous = this@AbstractSetting.value
186188
try {
187189
loadFromJson(parsed)
188-
} catch (e: Exception) {
190+
} catch (_: Exception) {
189191
return@executeWithResult failure("Failed to load $valueString as a ${type::class.simpleName} for $name in ${config.name}.")
190192
}
191193
ConfigCommand.info(setMessage(previous, this@AbstractSetting.value))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ import java.awt.Color
5959
abstract class Configurable(
6060
private val configuration: Configuration,
6161
) : Jsonable, Nameable {
62-
val settings = mutableSetOf<AbstractSetting<*>>()
62+
val settings = mutableListOf<AbstractSetting<*>>()
6363

6464
init {
6565
registerConfigurable()

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

Lines changed: 49 additions & 49 deletions
Large diffs are not rendered by default.

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package com.lambda.config.groups
1919

20+
import com.lambda.interaction.request.rotating.visibilty.PointSelection
2021
import com.lambda.util.Describable
2122
import com.lambda.util.NamedEnum
2223

@@ -29,14 +30,15 @@ interface BuildConfig {
2930
val maxPendingInteractions: Int
3031
val interactionTimeout: Int
3132

32-
// Breaking
33-
val breakConfig: BreakSettings
33+
val useDefaultReach: Boolean
34+
val attackReach: Double
35+
val interactReach: Double
36+
val scanReach: Double
3437

35-
// Placing
36-
val placeConfig: PlaceSettings
37-
38-
// Interacting
39-
val interactConfig: InteractSettings
38+
val strictRayCast: Boolean
39+
val checkSideVisibility: Boolean
40+
val resolution: Int
41+
val pointSelection: PointSelection
4042

4143
enum class SwingType(
4244
override val displayName: String,

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

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,41 +18,42 @@
1818
package com.lambda.config.groups
1919

2020
import com.lambda.config.Configurable
21-
import com.lambda.interaction.request.breaking.BreakConfig.BreakConfirmationMode
22-
import com.lambda.interaction.request.placing.PlaceConfig
21+
import com.lambda.interaction.request.rotating.visibilty.PointSelection
2322
import com.lambda.util.NamedEnum
23+
import kotlin.math.max
2424

2525
class BuildSettings(
2626
c: Configurable,
27-
vararg groupPath: NamedEnum,
27+
vararg baseGroup: NamedEnum,
2828
vis: () -> Boolean = { true },
29-
) : BuildConfig {
29+
) : BuildConfig, SettingGroup(c) {
3030
enum class Group(override val displayName: String) : NamedEnum {
3131
General("General"),
32-
Break("Break"),
33-
Place("Place"),
34-
Interact("Interact")
32+
Reach("Reach"),
33+
Scan("Scan")
3534
}
3635

3736
// General
38-
override val pathing by c.setting("Pathing", true, "Path to blocks", vis).group(*groupPath, Group.General)
39-
override val stayInRange by c.setting("Stay In Range", true, "Stay in range of blocks", vis).group(*groupPath, Group.General)
40-
override val collectDrops by c.setting("Collect All Drops", false, "Collect all drops when breaking blocks", vis).group(*groupPath, Group.General)
41-
override val interactionsPerTick by c.setting("Interactions Per Tick", 5, 1..30, 1, "The amount of interactions that can happen per tick", visibility = vis).group(*groupPath, Group.General)
42-
override val maxPendingInteractions by c.setting("Max Pending Interactions", 15, 1..30, 1, "The maximum count of pending interactions to allow before pausing future interactions", visibility = vis).group(*groupPath, Group.General)
43-
44-
// Breaking
45-
override val breakConfig = BreakSettings(c, groupPath.toList() + Group.Break, vis)
46-
47-
// Placing
48-
override val placeConfig = PlaceSettings(c, groupPath.toList() + Group.Place, vis)
49-
50-
//Interacting
51-
override val interactConfig = InteractSettings(c, groupPath.toList() + Group.Interact, vis)
52-
53-
override val interactionTimeout by c.setting("Interaction Timeout", 10, 1..30, 1, "Timeout for block breaks in ticks", unit = " ticks") {
54-
vis() && (placeConfig.placeConfirmationMode != PlaceConfig.PlaceConfirmationMode.None
55-
|| breakConfig.breakConfirmation != BreakConfirmationMode.None
56-
|| interactConfig.interactConfirmationMode != InteractionConfig.InteractConfirmationMode.None)
57-
}.group(*groupPath, Group.Break, BreakSettings.Group.General).group(*groupPath, Group.Place).group(*groupPath, Group.Interact)
37+
override val pathing by c.setting("Pathing", true, "Path to blocks", vis).group(*baseGroup, Group.General)
38+
override val stayInRange by c.setting("Stay In Range", true, "Stay in range of blocks", vis).group(*baseGroup, Group.General)
39+
override val collectDrops by c.setting("Collect All Drops", false, "Collect all drops when breaking blocks", vis).group(*baseGroup, Group.General)
40+
override val interactionsPerTick by c.setting("Interactions Per Tick", 5, 1..30, 1, "The amount of interactions that can happen per tick", visibility = vis).group(*baseGroup, Group.General)
41+
override val maxPendingInteractions by c.setting("Max Pending Interactions", 15, 1..30, 1, "The maximum count of pending interactions to allow before pausing future interactions", visibility = vis).group(*baseGroup, Group.General)
42+
override val interactionTimeout by c.setting("Interaction Timeout", 10, 1..30, 1, "Timeout for block breaks in ticks", unit = " ticks", visibility = vis).group(*baseGroup, Group.General)
43+
44+
override val useDefaultReach by c.setting("Default Reach", true, "Whether to use vanilla interaction ranges", vis).group(*baseGroup, Group.Reach)
45+
override val attackReach by c.setting("Attack Reach", DEFAULT_ATTACK_REACH, 1.0..10.0, 0.01, "Maximum entity interaction distance") { vis() && !useDefaultReach }.group(*baseGroup, Group.Reach)
46+
override val interactReach by c.setting("Interact Reach", DEFAULT_INTERACT_REACH, 1.0..10.0, 0.01, "Maximum block interaction distance") { vis() && !useDefaultReach }.group(*baseGroup, Group.Reach)
47+
48+
override val scanReach: Double get() = max(attackReach, interactReach)
49+
50+
override val strictRayCast by c.setting("Strict Raycast", false, "Whether to include the environment to the ray cast context", vis).group(*baseGroup, Group.Scan)
51+
override val checkSideVisibility by c.setting("Visibility Check", true, "Whether to check if an AABB side is visible", vis).group(*baseGroup, Group.Scan)
52+
override val resolution by c.setting("Resolution", 5, 1..20, 1, "The amount of grid divisions per surface of the hit box", "", vis).group(*baseGroup, Group.Scan)
53+
override val pointSelection by c.setting("Point Selection", PointSelection.Optimum, "The strategy to select the best hit point", vis).group(*baseGroup, Group.Scan)
54+
55+
companion object {
56+
const val DEFAULT_ATTACK_REACH = 3.0
57+
const val DEFAULT_INTERACT_REACH = 4.5
58+
}
5859
}

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

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

2020
import com.lambda.config.Configurable
2121
import com.lambda.util.NamedEnum
22-
import net.minecraft.item.Item
2322
import net.minecraft.item.Items
2423

2524
class EatSettings(
2625
c: Configurable,
2726
baseGroup: NamedEnum,
2827
vis: () -> Boolean = { true }
29-
) : EatConfig {
28+
) : EatConfig, SettingGroup(c) {
3029
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)
3130
val resistanceFoodDefaults = listOf(Items.ENCHANTED_GOLDEN_APPLE)
3231
val regenerationFoodDefaults = listOf(Items.ENCHANTED_GOLDEN_APPLE, Items.GOLDEN_APPLE)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ class HotbarSettings(
2626
c: Configurable,
2727
baseGroup: NamedEnum,
2828
vis: () -> Boolean = { true }
29-
) : HotbarConfig {
30-
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).group(baseGroup)
29+
) : HotbarConfig, SettingGroup(c) {
30+
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)
3333
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", visibility = vis).group(baseGroup)

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ import com.lambda.util.NamedEnum
2424

2525
class InteractSettings(
2626
c: Configurable,
27-
groupPath: List<NamedEnum> = emptyList(),
27+
baseGroup: NamedEnum,
2828
vis: () -> Boolean = { true }
29-
) : InteractConfig {
30-
override val rotate by c.setting("Rotate For Interact", true, "Rotates the player to look at the block when interacting", visibility = vis).group(groupPath)
31-
override val swingHand by c.setting("Swing On Interact", true, "Swings the players hand after interacting", visibility = vis).group(groupPath)
32-
override val interactStageMask by c.setting("Interact Stage Mask", setOf(TickEvent.Input.Post), description = "The sub-tick timing at which interact actions are performed", visibility = vis).group(groupPath)
33-
override val interactSwingType by c.setting("Interact Swing Type", BuildConfig.SwingType.Vanilla, "The style of swing") { vis() && swingHand }.group(groupPath)
34-
override val interactConfirmationMode by c.setting("Interact Confirmation Mode", InteractionConfig.InteractConfirmationMode.InteractThenAwait, "The style of confirmation for interactions", visibility = vis).group(groupPath)
29+
) : InteractConfig, SettingGroup(c) {
30+
override val rotate by c.setting("Rotate For Interact", true, "Rotates the player to look at the block when interacting", visibility = vis).group(baseGroup)
31+
override val swingHand by c.setting("Swing On Interact", true, "Swings the players hand after interacting", visibility = vis).group(baseGroup)
32+
override val interactStageMask by c.setting("Interact Stage Mask", setOf(TickEvent.Input.Post), description = "The sub-tick timing at which interact actions are performed", visibility = vis).group(baseGroup)
33+
override val interactSwingType by c.setting("Interact Swing Type", BuildConfig.SwingType.Vanilla, "The style of swing") { vis() && swingHand }.group(baseGroup)
34+
override val interactConfirmationMode by c.setting("Interact Confirmation Mode", InteractConfig.InteractConfirmationMode.InteractThenAwait, "The style of confirmation for interactions", visibility = vis).group(baseGroup)
3535
}

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

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

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

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

0 commit comments

Comments
 (0)