Skip to content

Commit ae63cf9

Browse files
committed
reworked break sort modes
1 parent 2566433 commit ae63cf9

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/main/kotlin/com/lambda/interaction/construction/context/BreakContext.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,18 @@ data class BreakContext(
5454

5555
override fun compareTo(other: BuildContext): Int {
5656
return when (other) {
57-
is BreakContext -> compareByDescending<BreakContext> {
58-
if (it.cachedState.block is FallingBlock) it.blockPos.y else 0
59-
}.thenBy {
60-
it.instantBreak
61-
}.thenBy {
57+
is BreakContext -> compareBy<BreakContext> {
6258
when (sortMode) {
6359
BreakConfig.SortMode.Closest -> it.distance
6460
BreakConfig.SortMode.Farthest -> -it.distance
61+
BreakConfig.SortMode.Tool -> it.hotbarIndex != HotbarManager.serverSlot
6562
BreakConfig.SortMode.Rotation -> it.rotation.target.angleDistance
6663
BreakConfig.SortMode.Random -> it.random
6764
}
65+
}.thenBy {
66+
it.instantBreak
67+
}.thenByDescending {
68+
if (it.cachedState.block is FallingBlock) it.blockPos.y else 0
6869
}.thenBy {
6970
it.hotbarIndex == HotbarManager.serverSlot
7071
}.compare(this, other)

src/main/kotlin/com/lambda/interaction/request/breaking/BreakConfig.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ interface BreakConfig : RequestConfig {
104104
) : NamedEnum, Describable {
105105
Closest("Closest", "Breaks blocks closest to the player eye position"),
106106
Farthest("Farthest", "Breaks blocks farthest from the player eye position"),
107-
Rotation("Rotation", "Breaks blocks that are closest to the player rotation"),
107+
Tool("Tool", "Breaks blocks with priority given to those with tools matching the current selected"),
108+
Rotation("Rotation", "Breaks blocks closest to the player rotation"),
108109
Random("Random", "Breaks blocks in a random order")
109110
}
110111

@@ -121,7 +122,6 @@ interface BreakConfig : RequestConfig {
121122
fun isEnabled() = this != None
122123
}
123124

124-
125125
enum class SwingMode(
126126
override val displayName: String,
127127
override val description: String

0 commit comments

Comments
 (0)