Skip to content

Commit ac6054b

Browse files
committed
ref: use mc's reach
1 parent 5d7a706 commit ac6054b

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ package com.lambda.config.groups
2020
import com.lambda.core.PingManager
2121

2222
interface InteractionConfig {
23+
/**
24+
* Minecraft's default reach values
25+
*/
26+
val defaultReach: Boolean
27+
2328
/**
2429
* Maximum distance to interact.
2530
*/

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,17 @@
1818
package com.lambda.config.groups
1919

2020
import com.lambda.config.Configurable
21+
import com.lambda.threading.runSafe
22+
import net.minecraft.entity.player.PlayerEntity
2123

2224
class InteractionSettings(
2325
c: Configurable,
24-
defaultReach: Double = 4.6,
2526
vis: () -> Boolean = { true },
2627
) : InteractionConfig {
27-
override val reach by c.setting("Reach", defaultReach, 0.1..10.0, 0.1, "Players reach / range", " blocks", vis)
28+
override val defaultReach by c.setting("Default Reach", true)
29+
private val customReach by c.setting("Reach", 4.5, 0.1..10.0, 0.1, "Players reach / range", " blocks") { vis() && !defaultReach }
30+
override val reach: Double
31+
get() = if (defaultReach) runSafe { PlayerEntity.getReachDistance(interaction.currentGameMode.isCreative).toDouble() } ?: 4.5 else customReach
2832
override val useRayCast by c.setting("Raycast", true, "Verify hit vector with ray casting (for very strict ACs)", vis)
2933
override val visibilityCheck by c.setting("Visibility Check", true, "Check if target is visible", vis)
3034
override val resolution by c.setting("Resolution", 4, 1..40, 1, "How many raycast checks per surface (will be squared)") { vis() && useRayCast }

common/src/main/kotlin/com/lambda/module/modules/combat/KillAura.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ object KillAura : Module(
6262
private val page by setting("Page", Page.Interact)
6363

6464
// Interact
65-
private val interactionSettings = InteractionSettings(this, 3.0) { page == Page.Interact }
65+
private val interactionSettings = InteractionSettings(this) { page == Page.Interact }
6666
private val attackMode by setting("Attack Mode", AttackMode.Cooldown) { page == Page.Interact }
6767
private val delaySync by setting("Client-side Delay", true) { page == Page.Interact && attackMode == AttackMode.Cooldown }
6868
private val cooldownSync by setting("Client-side Cooldown", true) { page == Page.Interact && attackMode == AttackMode.Cooldown }

0 commit comments

Comments
 (0)