mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 11:24:11 +01:00
30e4583dbe
By: Initial Source <noreply+automated@papermc.io>
31 lines
1.8 KiB
Diff
31 lines
1.8 KiB
Diff
--- a/net/minecraft/world/item/ProjectileWeaponItem.java
|
|
+++ b/net/minecraft/world/item/ProjectileWeaponItem.java
|
|
@@ -54,9 +54,25 @@
|
|
float f6 = f4 + f5 * (float) ((i + 1) / 2) * f3;
|
|
|
|
f5 = -f5;
|
|
- Projectile.spawnProjectile(this.createProjectile(world, shooter, stack, itemstack1, critical), world, itemstack1, (iprojectile) -> {
|
|
- this.shootProjectile(shooter, iprojectile, i, speed, divergence, f6, target);
|
|
- });
|
|
+ // CraftBukkit start
|
|
+ Projectile iprojectile = this.createProjectile(world, shooter, stack, itemstack1, critical);
|
|
+ this.shootProjectile(shooter, iprojectile, i, speed, divergence, f6, target);
|
|
+
|
|
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(shooter, stack, itemstack1, iprojectile, hand, speed, true);
|
|
+ if (event.isCancelled()) {
|
|
+ event.getProjectile().remove();
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ if (event.getProjectile() == iprojectile.getBukkitEntity()) {
|
|
+ if (Projectile.spawnProjectile(iprojectile, world, itemstack1).isRemoved()) {
|
|
+ if (shooter instanceof net.minecraft.server.level.ServerPlayer) {
|
|
+ ((net.minecraft.server.level.ServerPlayer) shooter).getBukkitEntity().updateInventory();
|
|
+ }
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+ // CraftBukkit end
|
|
stack.hurtAndBreak(this.getDurabilityUse(itemstack1), shooter, LivingEntity.getSlotForHand(hand));
|
|
if (stack.isEmpty()) {
|
|
break;
|