summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntityProjectile.patch
blob: 3e8aa8a0e0ba3e747a5041956f4b4427c65a5353 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--- a/net/minecraft/server/EntityProjectile.java
+++ b/net/minecraft/server/EntityProjectile.java
@@ -33,6 +33,7 @@
         this(entitytypes, entityliving.locX, entityliving.locY + (double) entityliving.getHeadHeight() - 0.10000000149011612D, entityliving.locZ, world);
         this.shooter = entityliving;
         this.shooterId = entityliving.getUniqueID();
+        this.projectileSource = (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity(); // CraftBukkit
     }
 
     protected void x_() {}
@@ -111,7 +112,7 @@
             if (entity1.isInteractable()) {
                 if (entity1 == this.d) {
                     flag = true;
-                } else if (this.shooter != null && this.ticksLived < 2 && this.d == null) {
+                } else if (this.shooter != null && this.ticksLived < 2 && this.d == null && this.shooter == entity1) { // CraftBukkit - MC-88491
                     this.d = entity1;
                     flag = true;
                 } else {
@@ -148,6 +149,11 @@
                 this.e(movingobjectposition.a());
             } else {
                 this.a(movingobjectposition);
+                // CraftBukkit start
+                if (this.dead) {
+                    org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this, movingobjectposition);
+                }
+                // CraftBukkit end
             }
         }