Fix interact event not being called in adventure

This commit is contained in:
TheMolkaPL 2020-06-21 17:25:24 +02:00 committed by MiniDigger | Martin
parent 2c9ed43354
commit 5650a41f5e
1 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,20 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: TheMolkaPL <themolkapl@gmail.com>
Date: Sun, 21 Jun 2020 17:21:46 +0200
Subject: [PATCH] Fix interact event not being called in adventure
Call PlayerInteractEvent when left-clicking on a block in adventure mode
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 73241af66256ef386790027fd6c7e0ca984524b4..87b1ff21957d5d708209257e569785aeaf191181 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2055,7 +2055,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
MovingObjectPosition movingobjectposition = this.player.world.rayTrace(new RayTrace(vec3d, vec3d1, RayTrace.BlockCollisionOption.OUTLINE, RayTrace.FluidCollisionOption.NONE, player));
- if (movingobjectposition == null || movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.BLOCK) {
+ if (movingobjectposition == null || movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.BLOCK || this.player.playerInteractManager.getGameMode() == EnumGamemode.ADVENTURE) { // Paper - call PlayerInteractEvent when left-clicking on a block in adventure mode
CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.inventory.getItemInHand(), EnumHand.MAIN_HAND);
}