mirror of
https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
synced 2024-11-22 04:16:17 +00:00
32 lines
1.8 KiB
Diff
32 lines
1.8 KiB
Diff
--- a/net/minecraft/world/item/ItemProjectileWeapon.java
|
|
+++ b/net/minecraft/world/item/ItemProjectileWeapon.java
|
|
@@ -54,9 +54,25 @@
|
|
float f6 = f4 + f5 * (float) ((i + 1) / 2) * f3;
|
|
|
|
f5 = -f5;
|
|
- IProjectile.spawnProjectile(this.createProjectile(worldserver, entityliving, itemstack, itemstack1, flag), worldserver, itemstack1, (iprojectile) -> {
|
|
- this.shootProjectile(entityliving, iprojectile, i, f, f1, f6, entityliving1);
|
|
- });
|
|
+ // CraftBukkit start
|
|
+ IProjectile iprojectile = this.createProjectile(worldserver, entityliving, itemstack, itemstack1, flag);
|
|
+ this.shootProjectile(entityliving, iprojectile, i, f, f1, f6, entityliving1);
|
|
+
|
|
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityliving, itemstack, itemstack1, iprojectile, enumhand, f, true);
|
|
+ if (event.isCancelled()) {
|
|
+ event.getProjectile().remove();
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ if (event.getProjectile() == iprojectile.getBukkitEntity()) {
|
|
+ if (IProjectile.spawnProjectile(iprojectile, worldserver, itemstack1).isRemoved()) {
|
|
+ if (entityliving instanceof net.minecraft.server.level.EntityPlayer) {
|
|
+ ((net.minecraft.server.level.EntityPlayer) entityliving).getBukkitEntity().updateInventory();
|
|
+ }
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+ // CraftBukkit end
|
|
itemstack.hurtAndBreak(this.getDurabilityUse(itemstack1), entityliving, EntityLiving.getSlotForHand(enumhand));
|
|
if (itemstack.isEmpty()) {
|
|
break;
|