From 2b5f9b69c17d7d6f1308a981dafb419a0d71b7a6 Mon Sep 17 00:00:00 2001 From: IzzelAliz Date: Tue, 1 Sep 2020 09:42:41 +0800 Subject: [PATCH] Do not skip PlayerInteractEvent. --- .../core/network/play/ServerPlayNetHandlerMixin.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/network/play/ServerPlayNetHandlerMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/network/play/ServerPlayNetHandlerMixin.java index 0a0d02e9..a80d8996 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/network/play/ServerPlayNetHandlerMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/network/play/ServerPlayNetHandlerMixin.java @@ -752,17 +752,13 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB float f8 = f3 * f5; double d4 = (this.player.interactionManager.getGameType() == GameType.CREATIVE) ? 5.0 : 4.5; Vector3d vec3d2 = vec3d.add(f7 * d4, f6 * d4, f8 * d4); - BlockRayTraceResult movingobjectposition = this.player.world.rayTraceBlocks(new RayTraceContext(vec3d, vec3d2, RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, this.player)); + BlockRayTraceResult result = this.player.world.rayTraceBlocks(new RayTraceContext(vec3d, vec3d2, RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, this.player)); boolean cancelled; - if (movingobjectposition == null || movingobjectposition.getType() != RayTraceResult.Type.BLOCK) { + if (result == null || result.getType() != RayTraceResult.Type.BLOCK) { PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_AIR, itemstack, enumhand); cancelled = (event.useItemInHand() == Event.Result.DENY); - } else if (((PlayerInteractionManagerBridge) this.player.interactionManager).bridge$isFiredInteract()) { - ((PlayerInteractionManagerBridge) this.player.interactionManager).bridge$setFiredInteract(false); - cancelled = ((PlayerInteractionManagerBridge) this.player.interactionManager).bridge$getInteractResult(); } else { - BlockRayTraceResult movingobjectpositionblock = movingobjectposition; - PlayerInteractEvent event2 = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_BLOCK, movingobjectpositionblock.getPos(), movingobjectpositionblock.getFace(), itemstack, true, enumhand); + PlayerInteractEvent event2 = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_BLOCK, result.getPos(), result.getFace(), itemstack, true, enumhand); cancelled = (event2.useItemInHand() == Event.Result.DENY); } if (cancelled) {