Skip to content

Commit ea3e648

Browse files
committed
isToolRequired check in isSuitableForBreaking predicate
1 parent 7d7cbc3 commit ea3e648

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/main/kotlin/com/lambda/interaction/material/StackSelection.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ class StackSelection {
5858
/**
5959
* Filters the given [stacks], sorts them with the [comparator] and returns the first value
6060
*/
61-
fun bestItemMatch(stacks: List<ItemStack>): ItemStack? =
62-
filterStacks(stacks).firstOrNull()
61+
fun bestItemMatch(stacks: List<ItemStack>): ItemStack? = filterStacks(stacks).firstOrNull()
6362

6463
fun matches(stack: ItemStack): Boolean = filterStack(stack)
6564

@@ -169,7 +168,7 @@ class StackSelection {
169168
else false
170169
}
171170

172-
fun isSuitableForBreaking(blockState: BlockState): (ItemStack) -> Boolean = { it.isSuitableFor(blockState) }
171+
fun isSuitableForBreaking(blockState: BlockState): (ItemStack) -> Boolean = { !blockState.isToolRequired || it.isSuitableFor(blockState) }
173172

174173
fun hasTag(tag: TagKey<Item>): (ItemStack) -> Boolean = { it.isIn(tag) }
175174

src/main/kotlin/com/lambda/util/EnchantmentUtils.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ object EnchantmentUtils {
4949
?.intValue
5050
?: 0
5151

52-
5352
/**
5453
* Iterates over all the enchantments for the given [ItemStack]
5554
*/

0 commit comments

Comments
 (0)