2020-06-21 15:25:24 +00:00
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
2021-03-02 03:07:12 +00:00
index 793ea3d3d81d97e59fd367979da2698ce54561b8..c06c1440353f706828cfc791e93aee7889f2ef92 100644
2020-06-21 15:25:24 +00:00
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
2021-03-02 03:07:12 +00:00
@@ -2057,7 +2057,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
2020-06-21 15:25:24 +00:00
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);
}