Skip to content

Commit d3b2fa4

Browse files
committed
Fixed ambiguous container matching
1 parent b3a55da commit d3b2fa4

File tree

5 files changed

+7
-11
lines changed

5 files changed

+7
-11
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@ interface BuildConfig {
88
val breakInstantAtOnce: Boolean
99
val rotateForBreak: Boolean
1010
val swingHand: Boolean
11-
val particlesOnBreak: Boolean
1211
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,4 @@ class BuildSettings(
1313
override val breakInstantAtOnce by c.setting("Break Instant At Once", true, "Break all instant blocks at once", vis)
1414
override val rotateForBreak by c.setting("Rotate For Break", false, "Rotate towards block while breaking", vis)
1515
override val swingHand by c.setting("Swing Hand", true, "Swing hand on interactions", vis)
16-
override val particlesOnBreak by c.setting("Particles On Break", true, "Show particles when breaking blocks", vis)
1716
}

common/src/main/kotlin/com/lambda/interaction/material/MaterialContainer.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,17 @@ abstract class MaterialContainer(
6363
}
6464
} ?: deposit(selection)
6565

66-
open fun StackSelection.matchingStacks() =
67-
filterStacks(stacks)
66+
open fun stacksMatching(selection: StackSelection) =
67+
selection.filterStacks(stacks)
6868

69-
open fun matchingStacks(selection: (ItemStack) -> Boolean) =
70-
selection.select().matchingStacks()
69+
open fun stacksMatching(selection: (ItemStack) -> Boolean) =
70+
stacksMatching(selection.select())
7171

7272
open fun available(selection: StackSelection) =
73-
selection.matchingStacks().count
73+
stacksMatching(selection).count
7474

7575
open fun spaceLeft(selection: StackSelection) =
76-
selection.matchingStacks().spaceLeft + stacks.empty * selection.stackSize
76+
stacksMatching(selection).spaceLeft + stacks.empty * selection.stackSize
7777

7878
fun transfer(selection: StackSelection, destination: MaterialContainer): TransferResult {
7979
val amount = available(selection)

common/src/main/kotlin/com/lambda/interaction/material/container/MainHandContainer.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ object MainHandContainer : MaterialContainer(Rank.MAIN_HAND) {
2020
override fun withdraw(selection: StackSelection) = emptyTask("WithdrawFromMainHand")
2121

2222
override fun deposit(selection: StackSelection) = buildTask("DepositToMainHand") {
23-
selection.matchingStacks().firstOrNull()?.let { stack ->
23+
InventoryContainer.stacksMatching(selection).firstOrNull()?.let { stack ->
2424
if (ItemStack.areEqual(stack, player.mainHandStack)) {
2525
return@buildTask
2626
}

common/src/main/kotlin/com/lambda/task/tasks/BreakBlock.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class BreakBlock @Ta5kBuilder constructor(
2626
private val collectDrop: Boolean = TaskFlow.build.collectDrops,
2727
private val rotate: Boolean = TaskFlow.build.rotateForBreak,
2828
private val swingHand: Boolean = TaskFlow.build.swingHand,
29-
private val particles: Boolean = TaskFlow.build.particlesOnBreak,
3029
) : Task<ItemEntity?>() {
3130
val blockPos: BlockPos get() = ctx.result.blockPos
3231
private var beginState: BlockState? = null
@@ -76,7 +75,6 @@ class BreakBlock @Ta5kBuilder constructor(
7675

7776
private fun SafeContext.breakBlock(side: Direction) {
7877
if (interaction.updateBlockBreakingProgress(blockPos, side)) {
79-
if (particles) mc.particleManager.addBlockBreakingParticles(blockPos, side)
8078
if (swingHand) player.swingHand(ctx.hand)
8179
}
8280
}

0 commit comments

Comments
 (0)