This commit is contained in:
Owen1212055 2024-12-14 14:43:19 -05:00
parent ea5c599077
commit c31ab10475

View file

@ -1,14 +1,12 @@
--- a/net/minecraft/world/entity/monster/EnderMan.java
+++ b/net/minecraft/world/entity/monster/EnderMan.java
@@ -116,10 +_,26 @@
}
@@ -117,7 +_,23 @@
@Override
- public void setTarget(@Nullable LivingEntity livingEntity) {
public void setTarget(@Nullable LivingEntity livingEntity) {
- super.setTarget(livingEntity);
+ public void setTarget(@Nullable LivingEntity target) {
+ // CraftBukkit start - fire event
+ this.setTarget(target, org.bukkit.event.entity.EntityTargetEvent.TargetReason.UNKNOWN, true);
+ this.setTarget(livingEntity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.UNKNOWN, true);
+ }
+
+ // Paper start - EndermanEscapeEvent
@ -18,18 +16,15 @@
+ // Paper end - EndermanEscapeEvent
+
+ @Override
+ public boolean setTarget(LivingEntity target, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) {
+ if (!super.setTarget(target, reason, fireEvent)) {
+ public boolean setTarget(LivingEntity livingEntity, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) {
+ if (!super.setTarget(livingEntity, reason, fireEvent)) {
+ return false;
+ }
+ target = this.getTarget();
+ livingEntity = this.getTarget();
+ // CraftBukkit end
AttributeInstance attribute = this.getAttribute(Attributes.MOVEMENT_SPEED);
- if (livingEntity == null) {
+ if (target == null) {
if (livingEntity == null) {
this.targetChangeTime = 0;
this.entityData.set(DATA_CREEPY, false);
this.entityData.set(DATA_STARED_AT, false);
@@ -131,6 +_,7 @@
attribute.addTransientModifier(SPEED_MODIFIER_ATTACKING);
}