From c9fa596b9d5a7c4348554b63358635022491834f Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 27 Apr 2019 13:57:46 +1000 Subject: [PATCH] Add some missing goal targets --- nms-patches/EntityLLamaTrader.patch | 11 ++++++++ nms-patches/EntityPanda.patch | 44 +++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 nms-patches/EntityLLamaTrader.patch create mode 100644 nms-patches/EntityPanda.patch diff --git a/nms-patches/EntityLLamaTrader.patch b/nms-patches/EntityLLamaTrader.patch new file mode 100644 index 0000000000..cd05a6c86d --- /dev/null +++ b/nms-patches/EntityLLamaTrader.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/server/EntityLLamaTrader.java ++++ b/net/minecraft/server/EntityLLamaTrader.java +@@ -113,7 +113,7 @@ + + @Override + public void c() { +- this.e.setGoalTarget(this.c); ++ this.e.setGoalTarget(this.c, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_OWNER, true); // CraftBukkit + Entity entity = this.b.getLeashHolder(); + + if (entity instanceof EntityVillagerTrader) { diff --git a/nms-patches/EntityPanda.patch b/nms-patches/EntityPanda.patch new file mode 100644 index 0000000000..6b6f6591bd --- /dev/null +++ b/nms-patches/EntityPanda.patch @@ -0,0 +1,44 @@ +--- a/net/minecraft/server/EntityPanda.java ++++ b/net/minecraft/server/EntityPanda.java +@@ -9,6 +9,8 @@ + import java.util.function.Predicate; + import javax.annotation.Nullable; + ++import org.bukkit.event.entity.EntityTargetEvent; // CraftBukkit ++ + public class EntityPanda extends EntityAnimal { + + private static final DataWatcherObject bA = DataWatcher.a(EntityPanda.class, DataWatcherRegistry.b); +@@ -673,7 +675,7 @@ + @Override + protected void a(EntityInsentient entityinsentient, EntityLiving entityliving) { + if (entityinsentient instanceof EntityPanda && ((EntityPanda) entityinsentient).dR()) { +- entityinsentient.setGoalTarget(entityliving); ++ entityinsentient.setGoalTarget(entityliving, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit + } + + } +@@ -777,9 +779,9 @@ + private final EntityPanda i; + + public c(EntityPanda entitypanda, Class oclass, float f, double d0, double d1) { +- Predicate predicate = IEntitySelector.f; ++ // Predicate predicate = IEntitySelector.f; // CraftBukkit - decompile error + +- super(entitypanda, oclass, f, d0, d1, predicate::test); ++ super(entitypanda, oclass, f, d0, d1, IEntitySelector.f::test); // CraftBukkit - decompile error + this.i = entitypanda; + } + +@@ -808,9 +810,9 @@ + this.e.r(32); + this.f = this.e.ticksLived + 600; + if (this.e.de()) { +- EntityHuman entityhuman = this.b.a(EntityPanda.d.d, (EntityLiving) this.e); ++ EntityHuman entityhuman = this.b.a(d, (EntityLiving) this.e); // CraftBukkit - decompile error + +- this.e.setGoalTarget(entityhuman); ++ this.e.setGoalTarget(entityhuman, EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit + } + } +