summaryrefslogtreecommitdiffstats
path: root/nms-patches/PathfinderGoalNearestAttackableTarget.patch
blob: e306d1b256040831ab893f9e397f5882951bae93 (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
32
33
--- a/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java
+++ b/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java
@@ -44,18 +44,18 @@
                 return false;
             } else {
                 Collections.sort(list, this.b);
-                this.d = (EntityLiving) list.get(0);
+                this.d = (T) list.get(0); // CraftBukkit - fix decompile error
                 return true;
             }
         } else {
-            this.d = this.e.world.a(this.e.locX, this.e.locY + (double) this.e.getHeadHeight(), this.e.locZ, this.i(), this.i(), new Function() {
+            this.d = (T) this.e.world.a(this.e.locX, this.e.locY + (double) this.e.getHeadHeight(), this.e.locZ, this.i(), this.i(), new Function<EntityHuman, Double>() { // CraftBukkit - fix decompile error
                 @Nullable
                 public Double apply(@Nullable EntityHuman entityhuman) {
                     ItemStack itemstack = entityhuman.getEquipment(EnumItemSlot.HEAD);
 
                     return (!(PathfinderGoalNearestAttackableTarget.this.e instanceof EntitySkeleton) || itemstack.getItem() != Items.SKELETON_SKULL) && (!(PathfinderGoalNearestAttackableTarget.this.e instanceof EntityZombie) || itemstack.getItem() != Items.ZOMBIE_HEAD) && (!(PathfinderGoalNearestAttackableTarget.this.e instanceof EntityCreeper) || itemstack.getItem() != Items.CREEPER_HEAD) ? 1.0D : 0.5D;
                 }
-            }, this.c);
+            }, (Predicate<EntityHuman>) this.c); // CraftBukkit - fix decompile error
             return this.d != null;
         }
     }
@@ -65,7 +65,7 @@
     }
 
     public void c() {
-        this.e.setGoalTarget(this.d);
+        this.e.setGoalTarget(this.d, d instanceof EntityPlayer ? org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER : org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_ENTITY, true); // Craftbukkit - reason
         super.c();
     }