More work

This commit is contained in:
Bjarne Koll 2024-12-13 17:24:35 +01:00
parent 92ef45d166
commit ee51737be6
No known key found for this signature in database
GPG Key ID: 9576DAF3FDDB088F
8 changed files with 32 additions and 43 deletions

View File

@ -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

View File

@ -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() {

View File

@ -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) {

View File

@ -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() {

View File

@ -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();

View File

@ -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();

View File

@ -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;
}

View File

@ -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;
}