aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0460-Fix-interact-event-not-being-called-sometimes.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0460-Fix-interact-event-not-being-called-sometimes.patch')
-rw-r--r--patches/server/0460-Fix-interact-event-not-being-called-sometimes.patch6
1 files changed, 3 insertions, 3 deletions
diff --git a/patches/server/0460-Fix-interact-event-not-being-called-sometimes.patch b/patches/server/0460-Fix-interact-event-not-being-called-sometimes.patch
index c80cc0c64b..50b8b7414c 100644
--- a/patches/server/0460-Fix-interact-event-not-being-called-sometimes.patch
+++ b/patches/server/0460-Fix-interact-event-not-being-called-sometimes.patch
@@ -11,7 +11,7 @@ Subject: [PATCH] Fix interact event not being called sometimes
Co-authored-by: Moulberry <[email protected]>
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-index 291c85c823a24b86235bf7581761c1686f609b82..48ebf9e606079fc091f1c4eed37001bbd0100e55 100644
+index a0bac2fe6222964b098cfaf9470f09c43328fcf5..09e40d6e50b7c1ddd1451981d05ecbbef43cfed2 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1771,7 +1771,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -24,7 +24,7 @@ index 291c85c823a24b86235bf7581761c1686f609b82..48ebf9e606079fc091f1c4eed37001bb
}
}
@@ -2392,13 +2392,20 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- double d3 = this.player.gameMode.getGameModeForPlayer() == GameType.CREATIVE ? 5.0D : 4.5D;
+ double d3 = Math.max(this.player.blockInteractionRange(), this.player.entityInteractionRange());
// SPIGOT-5607: Only call interact event if no block or entity is being clicked. Use bukkit ray trace method, because it handles blocks and entities at the same time
// SPIGOT-7429: Make sure to call PlayerInteractEvent for spectators and non-pickable entities
- org.bukkit.util.RayTraceResult result = this.player.level().getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.1, entity -> {
@@ -39,7 +39,7 @@ index 291c85c823a24b86235bf7581761c1686f609b82..48ebf9e606079fc091f1c4eed37001bb
+ GameType gameType = this.player.gameMode.getGameModeForPlayer();
+ if (gameType == GameType.ADVENTURE && result.getHitBlock() != null) {
+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, ((org.bukkit.craftbukkit.block.CraftBlock) result.getHitBlock()).getPosition(), org.bukkit.craftbukkit.block.CraftBlock.blockFaceToNotch(result.getHitBlockFace()), this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND);
-+ } else if (gameType != GameType.CREATIVE && result.getHitEntity() != null && origin.toVector().distanceSquared(result.getHitPosition()) > 3.0D * 3.0D) {
++ } else if (gameType != GameType.CREATIVE && result.getHitEntity() != null && origin.toVector().distanceSquared(result.getHitPosition()) > this.player.entityInteractionRange() * this.player.entityInteractionRange()) {
+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND);
+ }
+ } // Paper end - Call interact event