From ee51737be669f84c9555f26e1b0fe1827250dd73 Mon Sep 17 00:00:00 2001 From: Bjarne Koll Date: Fri, 13 Dec 2024 17:24:35 +0100 Subject: [PATCH] More work --- gradle.properties | 1 - .../target/DefendVillageTargetGoal.java.patch | 2 +- .../goal/target/HurtByTargetGoal.java.patch | 4 +-- .../NearestAttackableTargetGoal.java.patch | 2 +- .../target/OwnerHurtByTargetGoal.java.patch | 8 ++--- .../target/OwnerHurtTargetGoal.java.patch | 8 ++--- .../ai/goal/target/TargetGoal.java.patch | 20 +++++++++++++ .../ai/goal/target/TargetGoal.java.patch | 30 ------------------- 8 files changed, 32 insertions(+), 43 deletions(-) rename paper-server/patches/{unapplied => sources}/net/minecraft/world/entity/ai/goal/target/DefendVillageTargetGoal.java.patch (96%) rename paper-server/patches/{unapplied => sources}/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java.patch (95%) rename paper-server/patches/{unapplied => sources}/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java.patch (96%) rename paper-server/patches/{unapplied => sources}/net/minecraft/world/entity/ai/goal/target/OwnerHurtByTargetGoal.java.patch (70%) rename paper-server/patches/{unapplied => sources}/net/minecraft/world/entity/ai/goal/target/OwnerHurtTargetGoal.java.patch (70%) create mode 100644 paper-server/patches/sources/net/minecraft/world/entity/ai/goal/target/TargetGoal.java.patch delete mode 100644 paper-server/patches/unapplied/net/minecraft/world/entity/ai/goal/target/TargetGoal.java.patch diff --git a/gradle.properties b/gradle.properties index f52218fcc2..27969fea17 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,6 @@ mcVersion=1.21.4 # Set to true while updating Minecraft version updatingMinecraft=false -cleanPaperRepo=~/IdeaProjects/Paper/Paper-Server/src/main/java updateTaskListIssue=https://github.com/PaperMC/Paper/issues/11736 org.gradle.configuration-cache=true diff --git a/paper-server/patches/unapplied/net/minecraft/world/entity/ai/goal/target/DefendVillageTargetGoal.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/ai/goal/target/DefendVillageTargetGoal.java.patch similarity index 96% rename from paper-server/patches/unapplied/net/minecraft/world/entity/ai/goal/target/DefendVillageTargetGoal.java.patch rename to paper-server/patches/sources/net/minecraft/world/entity/ai/goal/target/DefendVillageTargetGoal.java.patch index 3a2b688e7b..8144be0e41 100644 --- a/paper-server/patches/unapplied/net/minecraft/world/entity/ai/goal/target/DefendVillageTargetGoal.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/ai/goal/target/DefendVillageTargetGoal.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/ai/goal/target/DefendVillageTargetGoal.java +++ b/net/minecraft/world/entity/ai/goal/target/DefendVillageTargetGoal.java -@@ -61,7 +61,7 @@ +@@ -48,7 +_,7 @@ @Override public void start() { diff --git a/paper-server/patches/unapplied/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java.patch similarity index 95% rename from paper-server/patches/unapplied/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java.patch rename to paper-server/patches/sources/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java.patch index 3b4092a6f3..1fd9b780b6 100644 --- a/paper-server/patches/unapplied/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java +++ b/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java -@@ -67,7 +67,7 @@ +@@ -59,7 +_,7 @@ @Override public void start() { @@ -9,7 +9,7 @@ this.targetMob = this.mob.getTarget(); this.timestamp = this.mob.getLastHurtByMobTimestamp(); this.unseenMemoryTicks = 300; -@@ -114,6 +114,6 @@ +@@ -114,6 +_,6 @@ } protected void alertOther(Mob mob, LivingEntity target) { diff --git a/paper-server/patches/unapplied/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java.patch similarity index 96% rename from paper-server/patches/unapplied/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java.patch rename to paper-server/patches/sources/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java.patch index 5d304f4ac8..a6474a3a6b 100644 --- a/paper-server/patches/unapplied/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java +++ b/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java -@@ -70,7 +70,7 @@ +@@ -73,7 +_,7 @@ @Override public void start() { diff --git a/paper-server/patches/unapplied/net/minecraft/world/entity/ai/goal/target/OwnerHurtByTargetGoal.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/ai/goal/target/OwnerHurtByTargetGoal.java.patch similarity index 70% rename from paper-server/patches/unapplied/net/minecraft/world/entity/ai/goal/target/OwnerHurtByTargetGoal.java.patch rename to paper-server/patches/sources/net/minecraft/world/entity/ai/goal/target/OwnerHurtByTargetGoal.java.patch index edaee8e182..e411caa1e3 100644 --- a/paper-server/patches/unapplied/net/minecraft/world/entity/ai/goal/target/OwnerHurtByTargetGoal.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/ai/goal/target/OwnerHurtByTargetGoal.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/ai/goal/target/OwnerHurtByTargetGoal.java +++ b/net/minecraft/world/entity/ai/goal/target/OwnerHurtByTargetGoal.java -@@ -38,7 +38,7 @@ +@@ -37,7 +_,7 @@ @Override public void start() { - this.mob.setTarget(this.ownerLastHurtBy); + this.mob.setTarget(this.ownerLastHurtBy, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_OWNER, true); // CraftBukkit - reason - LivingEntity entityliving = this.tameAnimal.getOwner(); - - if (entityliving != null) { + LivingEntity owner = this.tameAnimal.getOwner(); + if (owner != null) { + this.timestamp = owner.getLastHurtByMobTimestamp(); diff --git a/paper-server/patches/unapplied/net/minecraft/world/entity/ai/goal/target/OwnerHurtTargetGoal.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/ai/goal/target/OwnerHurtTargetGoal.java.patch similarity index 70% rename from paper-server/patches/unapplied/net/minecraft/world/entity/ai/goal/target/OwnerHurtTargetGoal.java.patch rename to paper-server/patches/sources/net/minecraft/world/entity/ai/goal/target/OwnerHurtTargetGoal.java.patch index 696e8ea9fa..d7274fc9a1 100644 --- a/paper-server/patches/unapplied/net/minecraft/world/entity/ai/goal/target/OwnerHurtTargetGoal.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/ai/goal/target/OwnerHurtTargetGoal.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/ai/goal/target/OwnerHurtTargetGoal.java +++ b/net/minecraft/world/entity/ai/goal/target/OwnerHurtTargetGoal.java -@@ -38,7 +38,7 @@ +@@ -37,7 +_,7 @@ @Override public void start() { - this.mob.setTarget(this.ownerLastHurt); + this.mob.setTarget(this.ownerLastHurt, org.bukkit.event.entity.EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET, true); // CraftBukkit - reason - LivingEntity entityliving = this.tameAnimal.getOwner(); - - if (entityliving != null) { + LivingEntity owner = this.tameAnimal.getOwner(); + if (owner != null) { + this.timestamp = owner.getLastHurtMobTimestamp(); diff --git a/paper-server/patches/sources/net/minecraft/world/entity/ai/goal/target/TargetGoal.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/ai/goal/target/TargetGoal.java.patch new file mode 100644 index 0000000000..9973960f95 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/entity/ai/goal/target/TargetGoal.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/world/entity/ai/goal/target/TargetGoal.java ++++ b/net/minecraft/world/entity/ai/goal/target/TargetGoal.java +@@ -63,7 +_,7 @@ + } + } + +- this.mob.setTarget(target); ++ this.mob.setTarget(target, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_ENTITY, true); // CraftBukkit + return true; + } + } +@@ -83,7 +_,7 @@ + + @Override + public void stop() { +- this.mob.setTarget(null); ++ this.mob.setTarget((LivingEntity) null, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit + this.targetMob = null; + } + diff --git a/paper-server/patches/unapplied/net/minecraft/world/entity/ai/goal/target/TargetGoal.java.patch b/paper-server/patches/unapplied/net/minecraft/world/entity/ai/goal/target/TargetGoal.java.patch deleted file mode 100644 index ab51c6b369..0000000000 --- a/paper-server/patches/unapplied/net/minecraft/world/entity/ai/goal/target/TargetGoal.java.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- a/net/minecraft/world/entity/ai/goal/target/TargetGoal.java -+++ b/net/minecraft/world/entity/ai/goal/target/TargetGoal.java -@@ -10,6 +10,9 @@ - import net.minecraft.world.level.pathfinder.Node; - import net.minecraft.world.level.pathfinder.Path; - import net.minecraft.world.scores.PlayerTeam; -+// CraftBukkit start -+import org.bukkit.event.entity.EntityTargetEvent; -+// CraftBukkit end - - public abstract class TargetGoal extends Goal { - -@@ -69,7 +72,7 @@ - } - } - -- this.mob.setTarget(entityliving); -+ this.mob.setTarget(entityliving, EntityTargetEvent.TargetReason.CLOSEST_ENTITY, true); // CraftBukkit - return true; - } - } -@@ -89,7 +92,7 @@ - - @Override - public void stop() { -- this.mob.setTarget((LivingEntity) null); -+ this.mob.setTarget((LivingEntity) null, EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit - this.targetMob = null; - } -