Skip to content

Commit 4fe34c1

Browse files
committed
Revert "fixed PlaceBlock action result swing issue"
This reverts commit 93abcbc.
1 parent 6d34658 commit 4fe34c1

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import com.lambda.task.Task
3030
import com.lambda.util.BlockUtils.blockState
3131
import com.lambda.util.Communication.warn
3232
import net.minecraft.block.BlockState
33-
import net.minecraft.util.ActionResult
3433

3534
class PlaceBlock @Ta5kBuilder constructor(
3635
private val ctx: PlaceContext,
@@ -97,20 +96,19 @@ class PlaceBlock @Ta5kBuilder constructor(
9796
}
9897

9998
private fun SafeContext.placeBlock() {
100-
val stack = player.getStackInHand(ctx.hand)
101-
val stackCount = stack.count
10299
val actionResult = interaction.interactBlock(
103100
player,
104101
ctx.hand,
105102
ctx.result
106103
)
107104

108-
if (actionResult is ActionResult.Success) {
109-
if (actionResult.swingSource() == ActionResult.SwingSource.CLIENT && interact.swingHand) {
105+
if (actionResult.isAccepted) {
106+
if (interact.swingHand) {
110107
player.swingHand(ctx.hand)
111-
if (!player.getStackInHand(ctx.hand).isEmpty && (stack.count != stackCount || interaction.hasCreativeInventory())) {
112-
mc.gameRenderer.firstPersonRenderer.resetEquipProgress(ctx.hand)
113-
}
108+
}
109+
110+
if (!player.getStackInHand(ctx.hand).isEmpty && interaction.hasCreativeInventory()) {
111+
mc.gameRenderer.firstPersonRenderer.resetEquipProgress(ctx.hand)
114112
}
115113

116114
state = State.CONFIRMING

0 commit comments

Comments
 (0)