From c34094ea505d888ecb1ec37dbdd7a347d612cee4 Mon Sep 17 00:00:00 2001 From: KnightMiner Date: Mon, 2 May 2022 13:46:58 -0400 Subject: [PATCH] Fix shears passing on a client when interacting with a shearable entity (#8597) Caused the offhand item to also interact with the entity, possibly sending a packet to the server causing both hands to interact --- .../net/minecraft/world/item/ShearsItem.java.patch | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/patches/minecraft/net/minecraft/world/item/ShearsItem.java.patch b/patches/minecraft/net/minecraft/world/item/ShearsItem.java.patch index a8dc90fa4e..a2fc29e717 100644 --- a/patches/minecraft/net/minecraft/world/item/ShearsItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/ShearsItem.java.patch @@ -1,14 +1,13 @@ --- a/net/minecraft/world/item/ShearsItem.java +++ b/net/minecraft/world/item/ShearsItem.java -@@ -48,6 +_,32 @@ +@@ -48,6 +_,31 @@ } } + @Override + public net.minecraft.world.InteractionResult m_6880_(ItemStack stack, net.minecraft.world.entity.player.Player playerIn, LivingEntity entity, net.minecraft.world.InteractionHand hand) { -+ if (entity.f_19853_.f_46443_) return net.minecraft.world.InteractionResult.PASS; -+ if (entity instanceof net.minecraftforge.common.IForgeShearable) { -+ net.minecraftforge.common.IForgeShearable target = (net.minecraftforge.common.IForgeShearable)entity; ++ if (entity instanceof net.minecraftforge.common.IForgeShearable target) { ++ if (entity.f_19853_.f_46443_) return net.minecraft.world.InteractionResult.SUCCESS; + BlockPos pos = new BlockPos(entity.m_20185_(), entity.m_20186_(), entity.m_20189_()); + if (target.isShearable(stack, entity.f_19853_, pos)) { + java.util.List drops = target.onSheared(playerIn, stack, entity.f_19853_, pos,