mirror of
https://github.com/FabricMC/fabric.git
synced 2024-11-22 23:58:02 -05:00
Fix AttackBlockCallback being fired for incorrect player actions (#520)
This commit is contained in:
parent
6d7c2994e1
commit
04b9979457
2 changed files with 2 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
||||||
archivesBaseName = "fabric-events-interaction-v0"
|
archivesBaseName = "fabric-events-interaction-v0"
|
||||||
version = getSubprojectVersion(project, "0.2.10")
|
version = getSubprojectVersion(project, "0.3.0")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class MixinServerPlayerInteractionManager {
|
||||||
|
|
||||||
@Inject(at = @At("HEAD"), method = "processBlockBreakingAction", cancellable = true)
|
@Inject(at = @At("HEAD"), method = "processBlockBreakingAction", cancellable = true)
|
||||||
public void startBlockBreak(BlockPos pos, PlayerActionC2SPacket.Action playerAction, Direction direction, int i, CallbackInfo info) {
|
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);
|
ActionResult result = AttackBlockCallback.EVENT.invoker().interact(player, world, Hand.MAIN_HAND, pos, direction);
|
||||||
|
|
||||||
if (result != ActionResult.PASS) {
|
if (result != ActionResult.PASS) {
|
||||||
|
|
Loading…
Reference in a new issue