Fix interact event in adventure mode

This commit is contained in:
Jake Potrebic 2021-01-06 13:43:39 -08:00 committed by MiniDigger | Martin
parent 964e0bf42b
commit 17d2e1291e

View file

@ -6,9 +6,18 @@ Subject: [PATCH] Fix interact event not being called in adventure
Call PlayerInteractEvent when left-clicking on a block in adventure mode 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 diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 793ea3d3d81d97e59fd367979da2698ce54561b8..c06c1440353f706828cfc791e93aee7889f2ef92 100644 index 741e338f55a63a5a097f2adc737b7e4cf9172555..f3679a3ad2d51612381bc47bb23eeffec924d478 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1556,7 +1556,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
IChatMutableComponent ichatmutablecomponent = (new ChatMessage("build.tooHigh", new Object[]{this.minecraftServer.getMaxBuildHeight()})).a(EnumChatFormat.RED);
this.player.playerConnection.sendPacket(new PacketPlayOutChat(ichatmutablecomponent, ChatMessageType.GAME_INFO, SystemUtils.b));
- } else if (enuminteractionresult.b()) {
+ } else if (enuminteractionresult.b() && !this.player.playerInteractManager.interactResult) {
this.player.swingHand(enumhand, true);
}
}
@@ -2057,7 +2057,7 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -2057,7 +2057,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); 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)); MovingObjectPosition movingobjectposition = this.player.world.rayTrace(new RayTrace(vec3d, vec3d1, RayTrace.BlockCollisionOption.OUTLINE, RayTrace.FluidCollisionOption.NONE, player));