Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 04:20:08 +01:00
SPIGOT-2157: Fix enderman not playing their animation when attacking
Dieser Commit ist enthalten in:
Ursprung
a4786c824f
Commit
199b11bdd0
@ -1,6 +1,43 @@
|
|||||||
--- a/net/minecraft/server/EntityEnderman.java
|
--- a/net/minecraft/server/EntityEnderman.java
|
||||||
+++ b/net/minecraft/server/EntityEnderman.java
|
+++ b/net/minecraft/server/EntityEnderman.java
|
||||||
@@ -306,8 +306,12 @@
|
@@ -4,6 +4,8 @@
|
||||||
|
import com.google.common.base.Optional;
|
||||||
|
import com.google.common.base.Predicate;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
+import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
|
+
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
@@ -55,7 +57,18 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGoalTarget(EntityLiving entityliving) {
|
||||||
|
- super.setGoalTarget(entityliving);
|
||||||
|
+ // CraftBukkit start - fire event
|
||||||
|
+ setGoalTarget(entityliving, EntityTargetEvent.TargetReason.UNKNOWN, true);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public boolean setGoalTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) {
|
||||||
|
+ if (!super.setGoalTarget(entityliving, reason, fireEvent)) {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ entityliving = getGoalTarget();
|
||||||
|
+ System.out.println(entityliving);
|
||||||
|
+ // CraftBukkit end
|
||||||
|
AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
||||||
|
|
||||||
|
if (entityliving == null) {
|
||||||
|
@@ -69,6 +82,7 @@
|
||||||
|
attributeinstance.b(EntityEnderman.b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+ return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -306,8 +320,12 @@
|
||||||
boolean flag = movingobjectposition != null && movingobjectposition.a().equals(blockposition);
|
boolean flag = movingobjectposition != null && movingobjectposition.a().equals(blockposition);
|
||||||
|
|
||||||
if (EntityEnderman.c.contains(block) && flag) {
|
if (EntityEnderman.c.contains(block) && flag) {
|
||||||
@ -15,7 +52,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -337,8 +341,12 @@
|
@@ -337,8 +355,12 @@
|
||||||
IBlockData iblockdata2 = this.a.getCarried();
|
IBlockData iblockdata2 = this.a.getCarried();
|
||||||
|
|
||||||
if (iblockdata2 != null && this.a(world, blockposition, iblockdata2.getBlock(), iblockdata, iblockdata1)) {
|
if (iblockdata2 != null && this.a(world, blockposition, iblockdata2.getBlock(), iblockdata, iblockdata1)) {
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void r() {}
|
protected void r() {}
|
||||||
@@ -110,7 +122,37 @@
|
@@ -110,7 +122,38 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGoalTarget(EntityLiving entityliving) {
|
public void setGoalTarget(EntityLiving entityliving) {
|
||||||
@ -34,8 +34,8 @@
|
|||||||
+ setGoalTarget(entityliving, EntityTargetEvent.TargetReason.UNKNOWN, true);
|
+ setGoalTarget(entityliving, EntityTargetEvent.TargetReason.UNKNOWN, true);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public void setGoalTarget(EntityLiving entityliving, EntityTargetEvent.TargetReason reason, boolean fireEvent) {
|
+ public boolean setGoalTarget(EntityLiving entityliving, EntityTargetEvent.TargetReason reason, boolean fireEvent) {
|
||||||
+ if (getGoalTarget() == entityliving) return;
|
+ if (getGoalTarget() == entityliving) return false;
|
||||||
+ if (fireEvent) {
|
+ if (fireEvent) {
|
||||||
+ if (reason == EntityTargetEvent.TargetReason.UNKNOWN && getGoalTarget() != null && entityliving == null) {
|
+ if (reason == EntityTargetEvent.TargetReason.UNKNOWN && getGoalTarget() != null && entityliving == null) {
|
||||||
+ reason = getGoalTarget().isAlive() ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
|
+ reason = getGoalTarget().isAlive() ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
|
||||||
@ -50,7 +50,7 @@
|
|||||||
+ EntityTargetLivingEntityEvent event = new EntityTargetLivingEntityEvent(this.getBukkitEntity(), ctarget, reason);
|
+ EntityTargetLivingEntityEvent event = new EntityTargetLivingEntityEvent(this.getBukkitEntity(), ctarget, reason);
|
||||||
+ world.getServer().getPluginManager().callEvent(event);
|
+ world.getServer().getPluginManager().callEvent(event);
|
||||||
+ if (event.isCancelled()) {
|
+ if (event.isCancelled()) {
|
||||||
+ return;
|
+ return false;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ if (event.getTarget() != null) {
|
+ if (event.getTarget() != null) {
|
||||||
@ -60,11 +60,12 @@
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
this.goalTarget = entityliving;
|
this.goalTarget = entityliving;
|
||||||
|
+ return true;
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean d(Class<? extends EntityLiving> oclass) {
|
public boolean d(Class<? extends EntityLiving> oclass) {
|
||||||
@@ -321,11 +363,20 @@
|
@@ -321,11 +364,20 @@
|
||||||
|
|
||||||
public void a(NBTTagCompound nbttagcompound) {
|
public void a(NBTTagCompound nbttagcompound) {
|
||||||
super.a(nbttagcompound);
|
super.a(nbttagcompound);
|
||||||
@ -87,7 +88,7 @@
|
|||||||
NBTTagList nbttaglist;
|
NBTTagList nbttaglist;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -549,11 +600,11 @@
|
@@ -549,11 +601,11 @@
|
||||||
double d2 = entityhuman.locZ - this.locZ;
|
double d2 = entityhuman.locZ - this.locZ;
|
||||||
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
|
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
|
||||||
|
|
||||||
@ -101,7 +102,7 @@
|
|||||||
this.die();
|
this.die();
|
||||||
} else if (d3 < 1024.0D) {
|
} else if (d3 < 1024.0D) {
|
||||||
this.ticksFarFromPlayer = 0;
|
this.ticksFarFromPlayer = 0;
|
||||||
@@ -931,9 +982,21 @@
|
@@ -931,9 +983,21 @@
|
||||||
|
|
||||||
public final boolean a(EntityHuman entityhuman, ItemStack itemstack, EnumHand enumhand) {
|
public final boolean a(EntityHuman entityhuman, ItemStack itemstack, EnumHand enumhand) {
|
||||||
if (this.isLeashed() && this.getLeashHolder() == entityhuman) {
|
if (this.isLeashed() && this.getLeashHolder() == entityhuman) {
|
||||||
@ -123,7 +124,7 @@
|
|||||||
this.setLeashHolder(entityhuman, true);
|
this.setLeashHolder(entityhuman, true);
|
||||||
--itemstack.count;
|
--itemstack.count;
|
||||||
return true;
|
return true;
|
||||||
@@ -953,10 +1016,12 @@
|
@@ -953,10 +1017,12 @@
|
||||||
|
|
||||||
if (this.bC) {
|
if (this.bC) {
|
||||||
if (!this.isAlive()) {
|
if (!this.isAlive()) {
|
||||||
@ -136,7 +137,7 @@
|
|||||||
this.unleash(true, true);
|
this.unleash(true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -967,7 +1032,9 @@
|
@@ -967,7 +1033,9 @@
|
||||||
this.bC = false;
|
this.bC = false;
|
||||||
this.leashHolder = null;
|
this.leashHolder = null;
|
||||||
if (!this.world.isClientSide && flag1) {
|
if (!this.world.isClientSide && flag1) {
|
||||||
@ -146,7 +147,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this.world.isClientSide && flag && this.world instanceof WorldServer) {
|
if (!this.world.isClientSide && flag && this.world instanceof WorldServer) {
|
||||||
@@ -1037,6 +1104,7 @@
|
@@ -1037,6 +1105,7 @@
|
||||||
|
|
||||||
this.leashHolder = entityleash;
|
this.leashHolder = entityleash;
|
||||||
} else {
|
} else {
|
||||||
|
@ -12,26 +12,30 @@
|
|||||||
public class EntityWolf extends EntityTameableAnimal {
|
public class EntityWolf extends EntityTameableAnimal {
|
||||||
|
|
||||||
private static final DataWatcherObject<Float> DATA_HEALTH = DataWatcher.a(EntityWolf.class, DataWatcherRegistry.c);
|
private static final DataWatcherObject<Float> DATA_HEALTH = DataWatcher.a(EntityWolf.class, DataWatcherRegistry.c);
|
||||||
@@ -59,6 +64,18 @@
|
@@ -59,6 +64,22 @@
|
||||||
this.getAttributeMap().b(GenericAttributes.ATTACK_DAMAGE).setValue(2.0D);
|
this.getAttributeMap().b(GenericAttributes.ATTACK_DAMAGE).setValue(2.0D);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // CraftBukkit - add overriden version
|
+ // CraftBukkit - add overriden version
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void setGoalTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fire) {
|
+ public boolean setGoalTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fire) {
|
||||||
+ super.setGoalTarget(entityliving, reason, fire);
|
+ if (!super.setGoalTarget(entityliving, reason, fire)) {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ entityliving = getGoalTarget();
|
||||||
+ if (entityliving == null) {
|
+ if (entityliving == null) {
|
||||||
+ this.setAngry(false);
|
+ this.setAngry(false);
|
||||||
+ } else if (!this.isTamed()) {
|
+ } else if (!this.isTamed()) {
|
||||||
+ this.setAngry(true);
|
+ this.setAngry(true);
|
||||||
+ }
|
+ }
|
||||||
|
+ return true;
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
+
|
||||||
public void setGoalTarget(EntityLiving entityliving) {
|
public void setGoalTarget(EntityLiving entityliving) {
|
||||||
super.setGoalTarget(entityliving);
|
super.setGoalTarget(entityliving);
|
||||||
if (entityliving == null) {
|
if (entityliving == null) {
|
||||||
@@ -192,9 +209,10 @@
|
@@ -192,9 +213,10 @@
|
||||||
Entity entity = damagesource.getEntity();
|
Entity entity = damagesource.getEntity();
|
||||||
|
|
||||||
if (this.goalSit != null) {
|
if (this.goalSit != null) {
|
||||||
@ -44,7 +48,7 @@
|
|||||||
if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) {
|
if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) {
|
||||||
f = (f + 1.0F) / 2.0F;
|
f = (f + 1.0F) / 2.0F;
|
||||||
}
|
}
|
||||||
@@ -235,7 +253,7 @@
|
@@ -235,7 +257,7 @@
|
||||||
--itemstack.count;
|
--itemstack.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +57,7 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (itemstack.getItem() == Items.DYE) {
|
} else if (itemstack.getItem() == Items.DYE) {
|
||||||
@@ -256,7 +274,7 @@
|
@@ -256,7 +278,7 @@
|
||||||
this.goalSit.setSitting(!this.isSitting());
|
this.goalSit.setSitting(!this.isSitting());
|
||||||
this.bc = false;
|
this.bc = false;
|
||||||
this.navigation.o();
|
this.navigation.o();
|
||||||
@ -62,7 +66,7 @@
|
|||||||
}
|
}
|
||||||
} else if (itemstack != null && itemstack.getItem() == Items.BONE && !this.isAngry()) {
|
} else if (itemstack != null && itemstack.getItem() == Items.BONE && !this.isAngry()) {
|
||||||
if (!entityhuman.abilities.canInstantlyBuild) {
|
if (!entityhuman.abilities.canInstantlyBuild) {
|
||||||
@@ -264,12 +282,14 @@
|
@@ -264,12 +286,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.world.isClientSide) {
|
if (!this.world.isClientSide) {
|
||||||
@ -78,7 +82,7 @@
|
|||||||
this.setOwnerUUID(entityhuman.getUniqueID());
|
this.setOwnerUUID(entityhuman.getUniqueID());
|
||||||
this.o(true);
|
this.o(true);
|
||||||
this.world.broadcastEntityEffect(this, (byte) 7);
|
this.world.broadcastEntityEffect(this, (byte) 7);
|
||||||
@@ -351,7 +371,7 @@
|
@@ -351,7 +375,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isTypeNotPersistent() {
|
protected boolean isTypeNotPersistent() {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren