File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
common/src/main/kotlin/com/lambda/task/tasks Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ import com.lambda.task.Task
3030import com.lambda.util.BlockUtils.blockState
3131import com.lambda.util.Communication.warn
3232import net.minecraft.block.BlockState
33+ import net.minecraft.util.ActionResult
3334
3435class PlaceBlock @Ta5kBuilder constructor(
3536 private val ctx : PlaceContext ,
@@ -96,19 +97,20 @@ class PlaceBlock @Ta5kBuilder constructor(
9697 }
9798
9899 private fun SafeContext.placeBlock () {
100+ val stack = player.getStackInHand(ctx.hand)
101+ val stackCount = stack.count
99102 val actionResult = interaction.interactBlock(
100103 player,
101104 ctx.hand,
102105 ctx.result
103106 )
104107
105- if (actionResult.isAccepted ) {
106- if (interact.swingHand) {
108+ if (actionResult is ActionResult . Success ) {
109+ if (actionResult.swingSource() == ActionResult . SwingSource . CLIENT && interact.swingHand) {
107110 player.swingHand(ctx.hand)
108- }
109-
110- if (! player.getStackInHand(ctx.hand).isEmpty && interaction.hasCreativeInventory()) {
111- mc.gameRenderer.firstPersonRenderer.resetEquipProgress(ctx.hand)
111+ if (! player.getStackInHand(ctx.hand).isEmpty && (stack.count != stackCount || interaction.hasCreativeInventory())) {
112+ mc.gameRenderer.firstPersonRenderer.resetEquipProgress(ctx.hand)
113+ }
112114 }
113115
114116 state = State .CONFIRMING
You can’t perform that action at this time.
0 commit comments