SPIGOT-5466: Bees still get angry even if damage event cancelled

This commit is contained in:
md_5 2019-12-19 12:25:11 +11:00
parent 4499fec567
commit fb7abcb37a

View file

@ -9,7 +9,26 @@
this.a(SoundEffects.ENTITY_BEE_STING, 1.0F, 1.0F); this.a(SoundEffects.ENTITY_BEE_STING, 1.0F, 1.0F);
} }
@@ -572,7 +572,7 @@ @@ -546,12 +546,16 @@
} else {
Entity entity = damagesource.getEntity();
- if (!this.world.isClientSide && entity instanceof EntityHuman && !((EntityHuman) entity).isCreative() && this.hasLineOfSight(entity) && !this.isNoAI()) {
+ // CraftBukkit start
+ boolean result = super.damageEntity(damagesource, f);
+
+ if (result && !this.world.isClientSide && entity instanceof EntityHuman && !((EntityHuman) entity).isCreative() && this.hasLineOfSight(entity) && !this.isNoAI()) {
this.bJ.l();
this.a(entity);
}
- return super.damageEntity(damagesource, f);
+ return result;
+ // CraftBukkit end
}
}
@@ -572,7 +576,7 @@
class d extends EntityBee.a { class d extends EntityBee.a {
private d() { private d() {
@ -18,7 +37,7 @@
} }
@Override @Override
@@ -632,7 +632,7 @@ @@ -632,7 +636,7 @@
class g extends EntityBee.a { class g extends EntityBee.a {
private g() { private g() {
@ -27,7 +46,7 @@
} }
@Override @Override
@@ -696,7 +696,7 @@ @@ -696,7 +700,7 @@
class i extends EntityBee.a { class i extends EntityBee.a {
private i() { private i() {
@ -36,7 +55,7 @@
} }
@Override @Override
@@ -760,7 +760,7 @@ @@ -760,7 +764,7 @@
private int h = 0; private int h = 0;
k() { k() {
@ -45,7 +64,7 @@
this.a(EnumSet.of(PathfinderGoal.Type.MOVE)); this.a(EnumSet.of(PathfinderGoal.Type.MOVE));
} }
@@ -944,7 +944,7 @@ @@ -944,7 +948,7 @@
private int c; private int c;
f() { f() {
@ -54,7 +73,7 @@
this.c = EntityBee.this.world.random.nextInt(10); this.c = EntityBee.this.world.random.nextInt(10);
this.a(EnumSet.of(PathfinderGoal.Type.MOVE)); this.a(EnumSet.of(PathfinderGoal.Type.MOVE));
} }
@@ -1001,7 +1001,7 @@ @@ -1001,7 +1005,7 @@
private PathEntity e; private PathEntity e;
e() { e() {
@ -63,7 +82,7 @@
this.c = EntityBee.this.world.random.nextInt(10); this.c = EntityBee.this.world.random.nextInt(10);
this.d = Lists.newArrayList(); this.d = Lists.newArrayList();
this.e = null; this.e = null;
@@ -1210,7 +1210,7 @@ @@ -1210,7 +1214,7 @@
@Override @Override
protected void a(EntityInsentient entityinsentient, EntityLiving entityliving) { protected void a(EntityInsentient entityinsentient, EntityLiving entityliving) {
if (entityinsentient instanceof EntityBee && this.e.hasLineOfSight(entityliving) && ((EntityBee) entityinsentient).a((Entity) entityliving)) { if (entityinsentient instanceof EntityBee && this.e.hasLineOfSight(entityliving) && ((EntityBee) entityinsentient).a((Entity) entityliving)) {