mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 15:49:00 +01:00
Call PlayerReadyArrowEvent for when items in the offhand are used (#8842)
This commit is contained in:
parent
ffc1cf92a1
commit
205d1402f8
1 changed files with 12 additions and 7 deletions
|
@ -28,12 +28,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getProjectile(ItemStack stack) {
|
public ItemStack getProjectile(ItemStack stack) {
|
||||||
if (!(stack.getItem() instanceof ProjectileWeaponItem)) {
|
if (!(stack.getItem() instanceof ProjectileWeaponItem)) {
|
||||||
@@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity {
|
return ItemStack.EMPTY;
|
||||||
|
} else {
|
||||||
|
- Predicate<ItemStack> predicate = ((ProjectileWeaponItem) stack.getItem()).getSupportedHeldProjectiles();
|
||||||
|
+ Predicate<ItemStack> 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) {
|
for (int i = 0; i < this.inventory.getContainerSize(); ++i) {
|
||||||
ItemStack itemstack2 = this.inventory.getItem(i);
|
ItemStack itemstack2 = this.inventory.getItem(i);
|
||||||
|
|
||||||
- if (predicate.test(itemstack2)) {
|
|
||||||
+ if (predicate.test(itemstack2) && tryReadyArrow(stack, itemstack2)) { // Paper
|
|
||||||
return itemstack2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue