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
|
||||
+++ 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);
|
||||
|
||||
if (EntityEnderman.c.contains(block) && flag) {
|
||||
@ -15,7 +52,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -337,8 +341,12 @@
|
||||
@@ -337,8 +355,12 @@
|
||||
IBlockData iblockdata2 = this.a.getCarried();
|
||||
|
||||
if (iblockdata2 != null && this.a(world, blockposition, iblockdata2.getBlock(), iblockdata, iblockdata1)) {
|
||||
|
@ -26,7 +26,7 @@
|
||||
}
|
||||
|
||||
protected void r() {}
|
||||
@@ -110,7 +122,37 @@
|
||||
@@ -110,7 +122,38 @@
|
||||
}
|
||||
|
||||
public void setGoalTarget(EntityLiving entityliving) {
|
||||
@ -34,8 +34,8 @@
|
||||
+ setGoalTarget(entityliving, EntityTargetEvent.TargetReason.UNKNOWN, true);
|
||||
+ }
|
||||
+
|
||||
+ public void setGoalTarget(EntityLiving entityliving, EntityTargetEvent.TargetReason reason, boolean fireEvent) {
|
||||
+ if (getGoalTarget() == entityliving) return;
|
||||
+ public boolean setGoalTarget(EntityLiving entityliving, EntityTargetEvent.TargetReason reason, boolean fireEvent) {
|
||||
+ if (getGoalTarget() == entityliving) return false;
|
||||
+ if (fireEvent) {
|
||||
+ if (reason == EntityTargetEvent.TargetReason.UNKNOWN && getGoalTarget() != null && entityliving == null) {
|
||||
+ reason = getGoalTarget().isAlive() ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
|
||||
@ -50,7 +50,7 @@
|
||||
+ EntityTargetLivingEntityEvent event = new EntityTargetLivingEntityEvent(this.getBukkitEntity(), ctarget, reason);
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (event.getTarget() != null) {
|
||||
@ -60,11 +60,12 @@
|
||||
+ }
|
||||
+ }
|
||||
this.goalTarget = entityliving;
|
||||
+ return true;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public boolean d(Class<? extends EntityLiving> oclass) {
|
||||
@@ -321,11 +363,20 @@
|
||||
@@ -321,11 +364,20 @@
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
@ -87,7 +88,7 @@
|
||||
NBTTagList nbttaglist;
|
||||
int i;
|
||||
|
||||
@@ -549,11 +600,11 @@
|
||||
@@ -549,11 +601,11 @@
|
||||
double d2 = entityhuman.locZ - this.locZ;
|
||||
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
|
||||
|
||||
@ -101,7 +102,7 @@
|
||||
this.die();
|
||||
} else if (d3 < 1024.0D) {
|
||||
this.ticksFarFromPlayer = 0;
|
||||
@@ -931,9 +982,21 @@
|
||||
@@ -931,9 +983,21 @@
|
||||
|
||||
public final boolean a(EntityHuman entityhuman, ItemStack itemstack, EnumHand enumhand) {
|
||||
if (this.isLeashed() && this.getLeashHolder() == entityhuman) {
|
||||
@ -123,7 +124,7 @@
|
||||
this.setLeashHolder(entityhuman, true);
|
||||
--itemstack.count;
|
||||
return true;
|
||||
@@ -953,10 +1016,12 @@
|
||||
@@ -953,10 +1017,12 @@
|
||||
|
||||
if (this.bC) {
|
||||
if (!this.isAlive()) {
|
||||
@ -136,7 +137,7 @@
|
||||
this.unleash(true, true);
|
||||
}
|
||||
}
|
||||
@@ -967,7 +1032,9 @@
|
||||
@@ -967,7 +1033,9 @@
|
||||
this.bC = false;
|
||||
this.leashHolder = null;
|
||||
if (!this.world.isClientSide && flag1) {
|
||||
@ -146,7 +147,7 @@
|
||||
}
|
||||
|
||||
if (!this.world.isClientSide && flag && this.world instanceof WorldServer) {
|
||||
@@ -1037,6 +1104,7 @@
|
||||
@@ -1037,6 +1105,7 @@
|
||||
|
||||
this.leashHolder = entityleash;
|
||||
} else {
|
||||
|
@ -12,26 +12,30 @@
|
||||
public class EntityWolf extends EntityTameableAnimal {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
+ // CraftBukkit - add overriden version
|
||||
+ @Override
|
||||
+ public void setGoalTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fire) {
|
||||
+ super.setGoalTarget(entityliving, reason, fire);
|
||||
+ public boolean setGoalTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fire) {
|
||||
+ if (!super.setGoalTarget(entityliving, reason, fire)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ entityliving = getGoalTarget();
|
||||
+ if (entityliving == null) {
|
||||
+ this.setAngry(false);
|
||||
+ } else if (!this.isTamed()) {
|
||||
+ this.setAngry(true);
|
||||
+ }
|
||||
+ return true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public void setGoalTarget(EntityLiving entityliving) {
|
||||
super.setGoalTarget(entityliving);
|
||||
if (entityliving == null) {
|
||||
@@ -192,9 +209,10 @@
|
||||
@@ -192,9 +213,10 @@
|
||||
Entity entity = damagesource.getEntity();
|
||||
|
||||
if (this.goalSit != null) {
|
||||
@ -44,7 +48,7 @@
|
||||
if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) {
|
||||
f = (f + 1.0F) / 2.0F;
|
||||
}
|
||||
@@ -235,7 +253,7 @@
|
||||
@@ -235,7 +257,7 @@
|
||||
--itemstack.count;
|
||||
}
|
||||
|
||||
@ -53,7 +57,7 @@
|
||||
return true;
|
||||
}
|
||||
} else if (itemstack.getItem() == Items.DYE) {
|
||||
@@ -256,7 +274,7 @@
|
||||
@@ -256,7 +278,7 @@
|
||||
this.goalSit.setSitting(!this.isSitting());
|
||||
this.bc = false;
|
||||
this.navigation.o();
|
||||
@ -62,7 +66,7 @@
|
||||
}
|
||||
} else if (itemstack != null && itemstack.getItem() == Items.BONE && !this.isAngry()) {
|
||||
if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
@@ -264,12 +282,14 @@
|
||||
@@ -264,12 +286,14 @@
|
||||
}
|
||||
|
||||
if (!this.world.isClientSide) {
|
||||
@ -78,7 +82,7 @@
|
||||
this.setOwnerUUID(entityhuman.getUniqueID());
|
||||
this.o(true);
|
||||
this.world.broadcastEntityEffect(this, (byte) 7);
|
||||
@@ -351,7 +371,7 @@
|
||||
@@ -351,7 +375,7 @@
|
||||
}
|
||||
|
||||
protected boolean isTypeNotPersistent() {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren