From b5793e809b6346e16b7ea218496806a312562e27 Mon Sep 17 00:00:00 2001 From: Lumine1909 <133463833+Lumine1909@users.noreply.github.com> Date: Mon, 30 Jun 2025 22:21:12 -0700 Subject: [PATCH] Fix bot infinity desync (#584) --- .../features/0072-Bow-infinity-fix.patch | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/leaves-server/minecraft-patches/features/0072-Bow-infinity-fix.patch b/leaves-server/minecraft-patches/features/0072-Bow-infinity-fix.patch index f87c49c9..baa38a1f 100644 --- a/leaves-server/minecraft-patches/features/0072-Bow-infinity-fix.patch +++ b/leaves-server/minecraft-patches/features/0072-Bow-infinity-fix.patch @@ -5,15 +5,19 @@ Subject: [PATCH] Bow infinity fix diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java -index ee8c0d0edbb296106a128c48f4186ba3a5bf9df8..0f1a398c588b7e0832612a50734b7db8b3a48ccc 100644 +index ee8c0d0edbb296106a128c48f4186ba3a5bf9df8..6c32b0e26a77c808fb16fc420e89fcebbea56ab1 100644 --- a/net/minecraft/world/entity/player/Player.java +++ b/net/minecraft/world/entity/player/Player.java -@@ -2170,7 +2170,7 @@ public abstract class Player extends LivingEntity { +@@ -2169,8 +2169,10 @@ public abstract class Player extends LivingEntity { + } } - if (anyEventCancelled.booleanValue() && !this.abilities.instabuild && this instanceof final ServerPlayer player) this.resyncUsingItem(player); // Paper - resync if no item matched the Predicate +- if (anyEventCancelled.booleanValue() && !this.abilities.instabuild && this instanceof final ServerPlayer player) this.resyncUsingItem(player); // Paper - resync if no item matched the Predicate - return this.hasInfiniteMaterials() ? new ItemStack(Items.ARROW) : ItemStack.EMPTY; -+ return this.hasInfiniteMaterials() || (org.leavesmc.leaves.LeavesConfig.modify.bowInfinityFix && net.minecraft.world.item.enchantment.EnchantmentHelper.processAmmoUse((ServerLevel) this.level(), shootable, new ItemStack(Items.ARROW), 1) <= 0) ? new ItemStack(Items.ARROW) : ItemStack.EMPTY; ++ // Leaves start - bow infinity fix ++ if ((org.leavesmc.leaves.LeavesConfig.modify.bowInfinityFix || anyEventCancelled.booleanValue()) && !this.abilities.instabuild && this instanceof final ServerPlayer player) this.resyncUsingItem(player); // Paper - resync if no item matched the Predicate ++ return org.leavesmc.leaves.LeavesConfig.modify.bowInfinityFix ? net.minecraft.world.item.enchantment.EnchantmentHelper.processAmmoUse((ServerLevel) this.level(), shootable, new ItemStack(Items.ARROW), 1) <= 0 ? new ItemStack(Items.ARROW) : ItemStack.EMPTY : this.hasInfiniteMaterials() ? new ItemStack(Items.ARROW) : ItemStack.EMPTY; ++ // Leaves end - bow infinity fix } } }