Pass correct draw strength for EntityShootBowEvent (#12308)

This commit is contained in:
TonytheMacaroni
2025-05-02 16:05:50 -04:00
committed by GitHub
parent d637ae85dd
commit 1074237311
5 changed files with 31 additions and 3 deletions

View File

@@ -1,5 +1,13 @@
--- a/net/minecraft/world/item/ProjectileWeaponItem.java
+++ b/net/minecraft/world/item/ProjectileWeaponItem.java
@@ -50,6 +_,7 @@
float inaccuracy,
boolean isCrit,
@Nullable LivingEntity target
+ ,float drawStrength // Paper - Pass draw strength
) {
float f = EnchantmentHelper.processProjectileSpread(level, weapon, shooter, 0.0F);
float f1 = projectileItems.size() == 1 ? 0.0F : 2.0F * f / (projectileItems.size() - 1);
@@ -62,12 +_,29 @@
float f4 = f2 + f3 * ((i + 1) / 2) * f1;
f3 = -f3;
@@ -14,7 +22,7 @@
+ Projectile projectile = this.createProjectile(level, shooter, weapon, itemStack, isCrit);
+ this.shootProjectile(shooter, projectile, i1, velocity, inaccuracy, f4, target);
+
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(shooter, weapon, itemStack, projectile, hand, velocity, true);
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(shooter, weapon, itemStack, projectile, hand, drawStrength, true);
+ if (event.isCancelled()) {
+ event.getProjectile().remove();
+ return;