summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntityProjectile.patch
blob: 460ea5583d8bea5387df31b4b405050e3ee92a6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
--- a/net/minecraft/server/EntityProjectile.java
+++ b/net/minecraft/server/EntityProjectile.java
@@ -26,6 +26,7 @@
     public EntityProjectile(World world, EntityLiving entityliving) {
         super(world);
         this.shooter = entityliving;
+        this.projectileSource = (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity(); // CraftBukkit
         this.setSize(0.25F, 0.25F);
         this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.getHeadHeight(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
         this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F);
@@ -151,6 +152,11 @@
                 this.d(movingobjectposition.a());
             } else {
                 this.a(movingobjectposition);
+                // CraftBukkit start
+                if (this.dead) {
+                    org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this);
+                }
+                // CraftBukkit end
             }
         }