summaryrefslogtreecommitdiffstats
path: root/nms-patches/PathfinderGoalNearestAttackableTarget.patch
blob: 4f44f3abd67d5feec6541f887440050a02216465 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
--- a/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java
+++ b/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java
@@ -34,7 +34,7 @@
             }
 
             public boolean apply(Object object) {
-                return this.a((EntityLiving) object);
+                return this.a((T) object); // CraftBukkit - fix decompile error
             }
         };
     }
@@ -49,11 +49,11 @@
                 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.f(), this.f(), new Function() {
+            this.d = (T) this.e.world.a(this.e.locX, this.e.locY + (double) this.e.getHeadHeight(), this.e.locZ, this.f(), this.f(), new Function<EntityHuman, Double>() { // CraftBukkit - fix decompile error
                 public Double a(EntityHuman entityhuman) {
                     ItemStack itemstack = entityhuman.getEquipment(EnumItemSlot.HEAD);
 
@@ -71,10 +71,10 @@
                     return Double.valueOf(1.0D);
                 }
 
-                public Object apply(Object object) {
+                public Double apply(EntityHuman object) { // CraftBukkit - fix decompile error
                     return this.a((EntityHuman) object);
                 }
-            }, this.c);
+            }, (Predicate<EntityHuman>) this.c); // CraftBukkit - fix decompile error
             return this.d != null;
         }
     }
@@ -84,7 +84,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();
     }
 
@@ -103,7 +103,7 @@
             return d0 < d1 ? -1 : (d0 > d1 ? 1 : 0);
         }
 
-        public int compare(Object object, Object object1) {
+        public int compare(Entity object, Entity object1) { // CraftBukkit - fix decompile error
             return this.a((Entity) object, (Entity) object1);
         }
     }