From 04b9979457653811072aabb42c9fafd3a99d3ee9 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Wed, 11 Mar 2020 11:53:39 +0000 Subject: [PATCH] Fix AttackBlockCallback being fired for incorrect player actions (#520) --- fabric-events-interaction-v0/build.gradle | 2 +- .../event/interaction/MixinServerPlayerInteractionManager.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/fabric-events-interaction-v0/build.gradle b/fabric-events-interaction-v0/build.gradle index b42fb8a3a..f847c1d65 100644 --- a/fabric-events-interaction-v0/build.gradle +++ b/fabric-events-interaction-v0/build.gradle @@ -1,5 +1,5 @@ archivesBaseName = "fabric-events-interaction-v0" -version = getSubprojectVersion(project, "0.2.10") +version = getSubprojectVersion(project, "0.3.0") dependencies { compile project(path: ':fabric-api-base', configuration: 'dev') diff --git a/fabric-events-interaction-v0/src/main/java/net/fabricmc/fabric/mixin/event/interaction/MixinServerPlayerInteractionManager.java b/fabric-events-interaction-v0/src/main/java/net/fabricmc/fabric/mixin/event/interaction/MixinServerPlayerInteractionManager.java index 60d71a75d..b36b436a2 100644 --- a/fabric-events-interaction-v0/src/main/java/net/fabricmc/fabric/mixin/event/interaction/MixinServerPlayerInteractionManager.java +++ b/fabric-events-interaction-v0/src/main/java/net/fabricmc/fabric/mixin/event/interaction/MixinServerPlayerInteractionManager.java @@ -51,6 +51,7 @@ public class MixinServerPlayerInteractionManager { @Inject(at = @At("HEAD"), method = "processBlockBreakingAction", cancellable = true) public void startBlockBreak(BlockPos pos, PlayerActionC2SPacket.Action playerAction, Direction direction, int i, CallbackInfo info) { + if (playerAction != PlayerActionC2SPacket.Action.START_DESTROY_BLOCK) return; ActionResult result = AttackBlockCallback.EVENT.invoker().interact(player, world, Hand.MAIN_HAND, pos, direction); if (result != ActionResult.PASS) {