aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/world/item/CrossbowItem.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/item/CrossbowItem.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/world/item/CrossbowItem.java.patch34
1 files changed, 34 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/item/CrossbowItem.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/item/CrossbowItem.java.patch
new file mode 100644
index 0000000000..49ad59c5bf
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/item/CrossbowItem.java.patch
@@ -0,0 +1,34 @@
+--- a/net/minecraft/world/item/CrossbowItem.java
++++ b/net/minecraft/world/item/CrossbowItem.java
+@@ -234,10 +236,28 @@
+ Vector3f vector3f = viewVector.toVector3f().rotate(quaternionf);
+ projectile.shoot((double)vector3f.x(), (double)vector3f.y(), (double)vector3f.z(), velocity, inaccuracy);
+ }
++ // CraftBukkit start
++ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(shooter, crossbowStack, ammoStack, (Entity) object, shooter.getUsedItemHand(), soundPitch, true);
++ if (event.isCancelled()) {
++ event.getProjectile().remove();
++ return;
++ }
++ // CraftBukkit end
+
+- crossbowStack.hurtAndBreak(isFireworkRocket ? 3 : 1, shooter, contextEntity -> contextEntity.broadcastBreakEvent(hand));
+- level.addFreshEntity(projectile);
+- level.playSound(null, shooter.getX(), shooter.getY(), shooter.getZ(), SoundEvents.CROSSBOW_SHOOT, SoundSource.PLAYERS, 1.0F, soundPitch);
++ crossbowStack.hurtAndBreak(flag1 ? 3 : 1, shooter, (entityliving1) -> {
++ entityliving1.broadcastBreakEvent(hand);
++ });
++ // CraftBukkit start
++ if (event.getProjectile() == ((Entity) object).getBukkitEntity()) {
++ if (!level.addFreshEntity((Entity) object)) {
++ if (shooter instanceof ServerPlayer) {
++ ((ServerPlayer) shooter).getBukkitEntity().updateInventory();
++ }
++ return;
++ }
++ }
++ // CraftBukkit end
++ level.playSound((Player) null, shooter.getX(), shooter.getY(), shooter.getZ(), SoundEvents.CROSSBOW_SHOOT, SoundSource.PLAYERS, 1.0F, soundPitch);
+ }
+ }
+