aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/og/net/minecraft/world/item/ItemCrossbow.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/og/net/minecraft/world/item/ItemCrossbow.patch')
-rw-r--r--patch-remap/og/net/minecraft/world/item/ItemCrossbow.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/item/ItemCrossbow.patch b/patch-remap/og/net/minecraft/world/item/ItemCrossbow.patch
new file mode 100644
index 0000000000..d1b86c9d2e
--- /dev/null
+++ b/patch-remap/og/net/minecraft/world/item/ItemCrossbow.patch
@@ -0,0 +1,31 @@
+--- a/net/minecraft/world/item/ItemCrossbow.java
++++ b/net/minecraft/world/item/ItemCrossbow.java
+@@ -236,11 +236,27 @@
+
+ ((IProjectile) object).shoot((double) vector3f.x(), (double) vector3f.y(), (double) vector3f.z(), f1, f2);
+ }
++ // CraftBukkit start
++ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityliving, itemstack, itemstack1, (Entity) object, entityliving.getUsedItemHand(), f, true);
++ if (event.isCancelled()) {
++ event.getProjectile().remove();
++ return;
++ }
++ // CraftBukkit end
+
+ itemstack.hurtAndBreak(flag1 ? 3 : 1, entityliving, (entityliving1) -> {
+ entityliving1.broadcastBreakEvent(enumhand);
+ });
+- world.addFreshEntity((Entity) object);
++ // CraftBukkit start
++ if (event.getProjectile() == ((Entity) object).getBukkitEntity()) {
++ if (!world.addFreshEntity((Entity) object)) {
++ if (entityliving instanceof EntityPlayer) {
++ ((EntityPlayer) entityliving).getBukkitEntity().updateInventory();
++ }
++ return;
++ }
++ }
++ // CraftBukkit end
+ world.playSound((EntityHuman) null, entityliving.getX(), entityliving.getY(), entityliving.getZ(), SoundEffects.CROSSBOW_SHOOT, SoundCategory.PLAYERS, 1.0F, f);
+ }
+ }