2024-04-23 17:15:00 +02:00
|
|
|
--- a/net/minecraft/world/item/ItemProjectileWeapon.java
|
|
|
|
+++ b/net/minecraft/world/item/ItemProjectileWeapon.java
|
2024-06-13 17:05:00 +02:00
|
|
|
@@ -62,7 +62,22 @@
|
|
|
|
IProjectile iprojectile = this.createProjectile(worldserver, entityliving, itemstack, itemstack1, flag);
|
2024-04-23 17:15:00 +02:00
|
|
|
|
|
|
|
this.shootProjectile(entityliving, iprojectile, i, f, f1, f6, entityliving1);
|
2024-06-13 17:05:00 +02:00
|
|
|
- worldserver.addFreshEntity(iprojectile);
|
2024-04-23 17:15:00 +02:00
|
|
|
+ // CraftBukkit start
|
|
|
|
+ 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()) {
|
2024-06-13 17:05:00 +02:00
|
|
|
+ if (!worldserver.addFreshEntity(iprojectile)) {
|
2024-04-23 17:15:00 +02:00
|
|
|
+ if (entityliving instanceof net.minecraft.server.level.EntityPlayer) {
|
|
|
|
+ ((net.minecraft.server.level.EntityPlayer) entityliving).getBukkitEntity().updateInventory();
|
|
|
|
+ }
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2024-06-13 17:05:00 +02:00
|
|
|
itemstack.hurtAndBreak(this.getDurabilityUse(itemstack1), entityliving, EntityLiving.getSlotForHand(enumhand));
|
|
|
|
if (itemstack.isEmpty()) {
|
|
|
|
break;
|