From bdba5ef2d30bd66d2dee47cbb8f309be35bf7fb1 Mon Sep 17 00:00:00 2001 From: Magnus Jensen Date: Fri, 14 Oct 2022 18:18:17 +0200 Subject: [PATCH] [1.19.x] Fix PlayerInteractEvent.EntityInteractSpecific not cancelling on a server (#9079) --- .../ServerGamePacketListenerImpl.java.patch | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/patches/minecraft/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch b/patches/minecraft/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch index 4576d1cea5..610401b123 100644 --- a/patches/minecraft/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch +++ b/patches/minecraft/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch @@ -76,7 +76,7 @@ return !component.equals(p_238202_) ? p_238202_ : null; }); completablefuture.thenAcceptAsync((p_242747_) -> { -@@ -1532,11 +_,13 @@ +@@ -1532,9 +_,10 @@ return; } @@ -87,11 +87,16 @@ + if(!ServerGamePacketListenerImpl.this.f_9743_.canInteractWith(entity, 1.5D)) return; //Forge: If the entity cannot be reached, do nothing. Original check was dist < 6, range is 4.5, so vanilla used padding=1.5 ItemStack itemstack = ServerGamePacketListenerImpl.this.f_9743_.m_21120_(p_143679_).m_41777_(); InteractionResult interactionresult = p_143680_.m_143694_(ServerGamePacketListenerImpl.this.f_9743_, entity, p_143679_); -+ if (net.minecraftforge.common.ForgeHooks.onInteractEntityAt(f_9743_, entity, entity.m_20182_(), p_143679_) != null) return; if (interactionresult.m_19077_()) { - CriteriaTriggers.f_10565_.m_61494_(ServerGamePacketListenerImpl.this.f_9743_, itemstack, entity); - if (interactionresult.m_19080_()) { -@@ -1558,6 +_,8 @@ +@@ -1552,12 +_,16 @@ + + public void m_142143_(InteractionHand p_143682_, Vec3 p_143683_) { + this.m_143678_(p_143682_, (p_143686_, p_143687_, p_143688_) -> { ++ InteractionResult onInteractEntityAtResult = net.minecraftforge.common.ForgeHooks.onInteractEntityAt(f_9743_, entity, p_143683_, p_143682_); ++ if (onInteractEntityAtResult != null) return onInteractEntityAtResult; + return p_143687_.m_7111_(p_143686_, p_143683_, p_143688_); + }); + } public void m_141994_() { if (!(entity instanceof ItemEntity) && !(entity instanceof ExperienceOrb) && !(entity instanceof AbstractArrow) && entity != ServerGamePacketListenerImpl.this.f_9743_) {