Paper/nms-patches/EntityBee.patch

103 lines
3.7 KiB
Diff

--- a/net/minecraft/server/EntityBee.java
+++ b/net/minecraft/server/EntityBee.java
@@ -157,7 +157,7 @@
}
this.setHasStung(true);
- this.setGoalTarget((EntityLiving) null);
+ this.setGoalTarget((EntityLiving) null, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit
this.a(SoundEffects.ENTITY_BEE_STING, 1.0F, 1.0F);
}
@@ -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 {
private d() {
- super(null);
+ super(); // CraftBukkit - decompile error
}
@Override
@@ -632,7 +636,7 @@
class g extends EntityBee.a {
private g() {
- super(null);
+ super(); // CraftBukkit - decompile error
}
@Override
@@ -681,7 +685,7 @@
}
}
- if (flag) {
+ if (flag && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(EntityBee.this, blockposition, iblockdata.set(blockstateinteger, (Integer) iblockdata.get(blockstateinteger) + 1)).isCancelled()) { // Spigot
EntityBee.this.world.triggerEffect(2005, blockposition, 0);
EntityBee.this.world.setTypeUpdate(blockposition, (IBlockData) iblockdata.set(blockstateinteger, (Integer) iblockdata.get(blockstateinteger) + 1));
EntityBee.this.eO();
@@ -696,7 +700,7 @@
class i extends EntityBee.a {
private i() {
- super(null);
+ super(); // CraftBukkit - decompile error
}
@Override
@@ -760,7 +764,7 @@
private int h = 0;
k() {
- super(null);
+ super(); // CraftBukkit - decompile error
this.a(EnumSet.of(PathfinderGoal.Type.MOVE));
}
@@ -944,7 +948,7 @@
private int c;
f() {
- super(null);
+ super(); // CraftBukkit - decompile error
this.c = EntityBee.this.world.random.nextInt(10);
this.a(EnumSet.of(PathfinderGoal.Type.MOVE));
}
@@ -1001,7 +1005,7 @@
private PathEntity e;
e() {
- super(null);
+ super(); // CraftBukkit - decompile error
this.c = EntityBee.this.world.random.nextInt(10);
this.d = Lists.newArrayList();
this.e = null;
@@ -1210,7 +1214,7 @@
@Override
protected void a(EntityInsentient entityinsentient, EntityLiving entityliving) {
if (entityinsentient instanceof EntityBee && this.e.hasLineOfSight(entityliving) && ((EntityBee) entityinsentient).a((Entity) entityliving)) {
- entityinsentient.setGoalTarget(entityliving);
+ entityinsentient.setGoalTarget(entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit - reason
}
}