Skip to content

Commit fdd0256

Browse files
committed
Merge branch '1.21.5' into refactor/rendering
2 parents 721501c + 5e9c94c commit fdd0256

File tree

32 files changed

+333
-195
lines changed

32 files changed

+333
-195
lines changed

src/main/java/com/lambda/mixin/baritone/MixinLookBehavior.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void onTargetUpdate(Rotation rotation, boolean blockInteract, CallbackInfo ci) {
3636
LookBehavior instance = ((LookBehavior) (Object) this);
3737
if (instance.baritone != BaritoneManager.getPrimary()) return;
3838

39-
RotationManager.handleBaritoneRotation(rotation.getYaw());
39+
RotationManager.handleBaritoneRotation(rotation.getYaw(), rotation.getPitch());
4040
ci.cancel();
4141
}
4242

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ open class AutomationConfig(
6262
name: String = module.name,
6363
edits: (AutomationConfig.() -> Unit)? = null
6464
) {
65-
defaultAutomationConfig = AutomationConfig("$name Automation Config").apply { edits?.invoke(this) }
65+
this.defaultAutomationConfig = AutomationConfig("$name Automation Config").apply { edits?.invoke(this) }
6666
}
6767

6868
fun MutableAutomationConfig.setDefaultAutomationConfig(
@@ -79,6 +79,7 @@ open class AutomationConfig(
7979
val showAllEntries by setting("Show All Entries", false, "Show all entries in the task tree").group(Group.Debug)
8080
val shrinkFactor by setting("Shrink Factor", 0.001, 0.0..1.0, 0.001).group(Group.Debug)
8181
val ignoreItemDropWarnings by setting("Ignore Drop Warnings", false, "Hides the item drop warnings from the break manager").group(Group.Debug)
82+
val managerDebugLogs by setting("Manager Debug Logs", false, "Prints debug logs from managers into chat").group(Group.Debug)
8283

8384
@Volatile
8485
var drawables = listOf<Drawable>()

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,27 @@ open class BreakSettings(
4040
}
4141

4242
// General
43-
override val breakMode by c.setting("Break Mode", BreakMode.Vanilla).group(baseGroup, Group.General).index()
43+
override val breakMode by c.setting("Break Mode", BreakMode.Packet).group(baseGroup, Group.General).index()
4444
override val sorter by c.setting("Break Sorter", ActionConfig.SortMode.Tool, "The order in which breaks are performed").group(baseGroup, Group.General).index()
4545
override val rebreak by c.setting("Rebreak", true, "Re-breaks blocks after they've been broken once").group(baseGroup, Group.General).index()
4646

4747
// Double break
48-
override val doubleBreak by c.setting("Double Break", false, "Allows breaking two blocks at once").group(baseGroup, Group.General).index()
48+
override val doubleBreak by c.setting("Double Break", true, "Allows breaking two blocks at once").group(baseGroup, Group.General).index()
4949
override val unsafeCancels by c.setting("Unsafe Cancels", true, "Allows cancelling block breaking even if the server might continue breaking sever side, potentially causing unexpected state changes") { doubleBreak }.group(baseGroup, Group.General).index()
5050

5151
// Fixes / Delays
52-
override val breakThreshold by c.setting("Break Threshold", 1.00f, 0.1f..1.0f, 0.01f, "The break amount at which the block is considered broken").group(baseGroup, Group.General).index()
52+
override val breakThreshold by c.setting("Break Threshold", 0.70f, 0.1f..1.0f, 0.01f, "The break amount at which the block is considered broken").group(baseGroup, Group.General).index()
5353
override val fudgeFactor by c.setting("Fudge Factor", 1, 0..5, 1, "The number of ticks to add to the break time, usually to account for server lag").group(baseGroup, Group.General).index()
54-
override val serverSwapTicks by c.setting("Server Swap", 5, 0..5, 1, "The number of ticks to give the server time to recognize the player attributes on the swapped item", " tick(s)").group(baseGroup, Group.General).index()
54+
override val serverSwapTicks by c.setting("Server Swap", 0, 0..5, 1, "The number of ticks to give the server time to recognize the player attributes on the swapped item", " tick(s)").group(baseGroup, Group.General).index()
5555

5656
// override val desyncFix by c.setting("Desync Fix", false, "Predicts if the players breaking will be slowed next tick as block break packets are processed using the players next position") { vis() && page == Page.General }
57-
override val breakDelay by c.setting("Break Delay", 5, 0..5, 1, "The delay between breaking blocks", " tick(s)").group(baseGroup, Group.General).index()
57+
override val breakDelay by c.setting("Break Delay", 0, 0..5, 1, "The delay between breaking blocks", " tick(s)").group(baseGroup, Group.General).index()
5858

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

6262
// Swap
63-
override val swapMode by c.setting("Break Swap Mode", BreakConfig.SwapMode.StartAndEnd, "Decides when to swap to the best suited tool when breaking a block").group(baseGroup, Group.General).index()
63+
override val swapMode by c.setting("Break Swap Mode", BreakConfig.SwapMode.End, "Decides when to swap to the best suited tool when breaking a block").group(baseGroup, Group.General).index()
6464

6565
// Swing
6666
override val swing by c.setting("Swing Mode", SwingMode.Constant, "The times at which to swing the players hand").group(baseGroup, Group.General).index()

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import net.minecraft.client.network.ClientPlayerEntity
3333
import net.minecraft.client.network.OtherClientPlayerEntity
3434
import net.minecraft.entity.LivingEntity
3535
import net.minecraft.entity.decoration.ArmorStandEntity
36+
import net.minecraft.entity.mob.HostileEntity
3637
import net.minecraft.entity.mob.MobEntity
3738
import net.minecraft.entity.passive.PassiveEntity
3839
import java.util.*
@@ -115,9 +116,10 @@ abstract class Targeting(
115116
* @return `true` if the entity is valid for targeting, `false` otherwise.
116117
*/
117118
open fun validate(player: ClientPlayerEntity, entity: LivingEntity) = when {
118-
!players || (entity is OtherClientPlayerEntity && entity.isFriend) -> false
119+
!players && entity is OtherClientPlayerEntity -> false
120+
players && entity is OtherClientPlayerEntity && entity.isFriend -> false
119121
!animals && entity is PassiveEntity -> false
120-
!hostiles && entity is MobEntity -> false
122+
!hostiles && entity is HostileEntity -> false
121123
entity is ArmorStandEntity -> false
122124

123125
!invisible && entity.isInvisibleTo(player) -> false

src/main/kotlin/com/lambda/config/settings/numeric/DoubleSetting.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import com.lambda.config.Setting
2626
import com.lambda.config.settings.NumericSetting
2727
import com.lambda.gui.dsl.ImGuiBuilder
2828
import com.lambda.util.extension.CommandBuilder
29+
import com.lambda.util.math.MathUtils.roundToStep
2930
import net.minecraft.command.CommandRegistryAccess
3031
import kotlin.math.roundToInt
3132

@@ -46,7 +47,9 @@ class DoubleSetting(
4647
private var valueIndex: Int
4748
get() = ((value - range.start) / step).roundToInt()
4849
set(index) {
49-
value = (range.start + index * step).coerceIn(range)
50+
value = (range.start + index * step)
51+
.roundToStep(step)
52+
.coerceIn(range)
5053
}
5154

5255
context(setting: Setting<*, Double>)

src/main/kotlin/com/lambda/config/settings/numeric/FloatSetting.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import com.lambda.config.Setting
2525
import com.lambda.config.settings.NumericSetting
2626
import com.lambda.gui.dsl.ImGuiBuilder
2727
import com.lambda.util.extension.CommandBuilder
28+
import com.lambda.util.math.MathUtils.roundToStep
2829
import net.minecraft.command.CommandRegistryAccess
2930
import kotlin.math.roundToInt
3031

@@ -45,7 +46,9 @@ class FloatSetting(
4546
private var valueIndex: Int
4647
get() = ((value - range.start) / step).roundToInt()
4748
set(index) {
48-
value = (range.start + index * step).coerceIn(range)
49+
value = (range.start + index * step)
50+
.roundToStep(step)
51+
.coerceIn(range)
4952
}
5053

5154
context(setting: Setting<*, Float>)

src/main/kotlin/com/lambda/event/events/KeyboardEvent.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import com.lambda.event.Event
2222
import com.lambda.util.KeyCode
2323
import org.lwjgl.glfw.GLFW.GLFW_PRESS
2424
import org.lwjgl.glfw.GLFW.GLFW_RELEASE
25+
import org.lwjgl.glfw.GLFW.GLFW_REPEAT
2526

2627
sealed class KeyboardEvent {
2728
/**
@@ -48,6 +49,7 @@ sealed class KeyboardEvent {
4849

4950
val isPressed = action >= GLFW_PRESS
5051
val isReleased = action == GLFW_RELEASE
52+
val isRepeated = action == GLFW_REPEAT
5153

5254
fun satisfies(bind: Bind) = bind.key == translated.code && bind.modifiers and modifiers == bind.modifiers
5355
}

src/main/kotlin/com/lambda/gui/components/QuickSearch.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ import imgui.flag.ImGuiStyleVar
4040
import imgui.flag.ImGuiWindowFlags
4141
import imgui.type.ImString
4242
import net.minecraft.client.gui.screen.ChatScreen
43-
import org.lwjgl.glfw.GLFW
4443
import kotlin.math.max
4544

4645
// ToDo: Add support for searching of menu bar entries
@@ -304,7 +303,7 @@ object QuickSearch {
304303
}
305304

306305
private fun handleKeyPress(event: KeyboardEvent.Press) {
307-
if ((!event.isPressed || event.action == GLFW.GLFW_REPEAT) ||
306+
if ((!event.isPressed || event.isRepeated) ||
308307
!(event.keyCode == KeyCode.LeftShift.code || event.keyCode == KeyCode.RightShift.code)) return
309308

310309
val currentTime = System.currentTimeMillis()

src/main/kotlin/com/lambda/gui/components/SettingsWidget.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ object SettingsWidget {
3939
if (config is Module) {
4040
with(config.keybindSetting) { buildLayout() }
4141
with(config.disableOnReleaseSetting) { buildLayout() }
42+
with(config.drawSetting) { buildLayout() }
4243
}
4344
smallButton("Reset") {
4445
config.settings.forEach { it.reset(silent = true) }
@@ -75,7 +76,7 @@ object SettingsWidget {
7576
}
7677
val toIgnoreSettings =
7778
when (config) {
78-
is Module -> setOf(config.keybindSetting, config.disableOnReleaseSetting)
79+
is Module -> setOf(config.keybindSetting, config.disableOnReleaseSetting, config.drawSetting)
7980
is UserAutomationConfig -> setOf(config.linkedModules)
8081
else -> emptySet()
8182
}

src/main/kotlin/com/lambda/interaction/construction/simulation/checks/BasicChecker.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package com.lambda.interaction.construction.simulation.checks
1919

2020
import com.lambda.context.AutomatedSafeContext
21+
import com.lambda.interaction.construction.simulation.BreakSimInfo
2122
import com.lambda.interaction.construction.simulation.Results
2223
import com.lambda.interaction.construction.simulation.SimDsl
2324
import com.lambda.interaction.construction.simulation.SimInfo
@@ -47,7 +48,7 @@ object BasicChecker : Results<PreSimResult> {
4748
}
4849

4950
// block should be ignored
50-
if (state.block in breakConfig.ignoredBlocks && targetState.isEmpty()) {
51+
if (state.block in breakConfig.ignoredBlocks && this@hasBasicRequirements is BreakSimInfo) {
5152
result(GenericResult.Ignored(pos))
5253
return false
5354
}
@@ -70,7 +71,7 @@ object BasicChecker : Results<PreSimResult> {
7071
return false
7172
}
7273

73-
// block is unbreakable, so it cant be broken or replaced
74+
// block is unbreakable, so it can't be broken or replaced
7475
if (state.getHardness(world, pos) < 0 && !gamemode.isCreative) {
7576
result(PreSimResult.Unbreakable(pos, state))
7677
return false

0 commit comments

Comments
 (0)