From 205d1402f8002068c51cbceb47fbf0f676a0264b Mon Sep 17 00:00:00 2001 From: "TM (Holly)" <25277367+Thatsmusic99@users.noreply.github.com> Date: Mon, 13 Feb 2023 09:36:25 +0000 Subject: [PATCH] Call PlayerReadyArrowEvent for when items in the offhand are used (#8842) --- patches/server/PlayerReadyArrowEvent.patch | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/patches/server/PlayerReadyArrowEvent.patch b/patches/server/PlayerReadyArrowEvent.patch index 38acbec8e0..4c3dd15c72 100644 --- a/patches/server/PlayerReadyArrowEvent.patch +++ b/patches/server/PlayerReadyArrowEvent.patch @@ -28,12 +28,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public ItemStack getProjectile(ItemStack stack) { if (!(stack.getItem() instanceof ProjectileWeaponItem)) { -@@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity { + return ItemStack.EMPTY; + } else { +- Predicate predicate = ((ProjectileWeaponItem) stack.getItem()).getSupportedHeldProjectiles(); ++ Predicate predicate = ((ProjectileWeaponItem) stack.getItem()).getSupportedHeldProjectiles().and(item -> tryReadyArrow(stack, item)); // Paper + ItemStack itemstack1 = ProjectileWeaponItem.getHeldProjectile(this, predicate); + + if (!itemstack1.isEmpty()) { + return itemstack1; + } else { +- predicate = ((ProjectileWeaponItem) stack.getItem()).getAllSupportedProjectiles(); ++ predicate = ((ProjectileWeaponItem) stack.getItem()).getAllSupportedProjectiles().and(item -> tryReadyArrow(stack, item)); // Paper + for (int i = 0; i < this.inventory.getContainerSize(); ++i) { ItemStack itemstack2 = this.inventory.getItem(i); - -- if (predicate.test(itemstack2)) { -+ if (predicate.test(itemstack2) && tryReadyArrow(stack, itemstack2)) { // Paper - return itemstack2; - } - }