PaperMC/nms-patches/PathfinderGoalNearestAttackableTarget.patch

34 lines
1.9 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java
+++ b/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java
2018-12-13 01:00:00 +01:00
@@ -44,18 +44,18 @@
2016-02-29 22:32:46 +01:00
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 {
2018-12-25 22:00:00 +01:00
- 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<EntityHuman, Double>() {
2016-06-09 03:43:49 +02:00
+ 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
2016-05-10 13:47:39 +02:00
@Nullable
2018-12-13 01:00:00 +01:00
public Double apply(@Nullable EntityHuman entityhuman) {
2016-02-29 22:32:46 +01:00
ItemStack itemstack = entityhuman.getEquipment(EnumItemSlot.HEAD);
2018-12-13 01:00:00 +01:00
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;
2016-02-29 22:32:46 +01:00
}
- }, this.c);
+ }, (Predicate<EntityHuman>) this.c); // CraftBukkit - fix decompile error
return this.d != null;
}
}
2018-12-13 01:00:00 +01:00
@@ -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();
}
2015-02-26 23:41:06 +01:00