#929: Call EntityBlockFormEvent for Wither Rose placed by dead entity

By: Doc <nachito94@msn.com>
This commit is contained in:
CraftBukkit/Spigot 2021-09-06 18:57:16 +10:00
parent fcb8ac59ec
commit b4da42047a

View File

@ -497,7 +497,18 @@
}
}
@@ -1378,6 +1619,13 @@
@@ -1370,14 +1611,22 @@
IBlockData iblockdata = Blocks.WITHER_ROSE.getBlockData();
if (this.level.getType(blockposition).isAir() && iblockdata.canPlace(this.level, blockposition)) {
- this.level.setTypeAndData(blockposition, iblockdata, 3);
- flag = true;
+ // CraftBukkit start - call EntityBlockFormEvent for Wither Rose
+ flag = org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.level, blockposition, iblockdata, 3, this);
+ // CraftBukkit end
}
}
if (!flag) {
EntityItem entityitem = new EntityItem(this.level, this.locX(), this.locY(), this.locZ(), new ItemStack(Items.WITHER_ROSE));
@ -511,7 +522,7 @@
this.level.addEntity(entityitem);
}
}
@@ -1397,21 +1645,40 @@
@@ -1397,21 +1646,40 @@
boolean flag = this.lastHurtByPlayerTime > 0;
@ -555,7 +566,7 @@
}
@@ -1527,9 +1794,14 @@
@@ -1527,9 +1795,14 @@
int i = this.d(f, f1);
if (i > 0) {
@ -571,7 +582,7 @@
return true;
} else {
return flag;
@@ -1578,7 +1850,7 @@
@@ -1578,7 +1851,7 @@
protected float applyArmorModifier(DamageSource damagesource, float f) {
if (!damagesource.ignoresArmor()) {
@ -580,7 +591,7 @@
f = CombatMath.a(f, (float) this.getArmorStrength(), (float) this.b(GenericAttributes.ARMOR_TOUGHNESS));
}
@@ -1591,7 +1863,8 @@
@@ -1591,7 +1864,8 @@
} else {
int i;
@ -590,7 +601,7 @@
i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
int j = 25 - i;
float f1 = f * (float) j;
@@ -1622,29 +1895,172 @@
@@ -1622,29 +1896,172 @@
}
}
@ -773,7 +784,7 @@
}
public CombatTracker getCombatTracker() {
@@ -1665,8 +2081,18 @@
@@ -1665,8 +2082,18 @@
}
public final void setArrowCount(int i) {
@ -793,7 +804,7 @@
public final int eh() {
return (Integer) this.entityData.get(EntityLiving.DATA_STINGER_COUNT_ID);
@@ -1962,6 +2388,12 @@
@@ -1962,6 +2389,12 @@
public abstract ItemStack getEquipment(EnumItemSlot enumitemslot);
@ -806,7 +817,7 @@
@Override
public abstract void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack);
@@ -2205,6 +2637,7 @@
@@ -2205,6 +2638,7 @@
}
if (this.onGround && !this.level.isClientSide) {
@ -814,7 +825,7 @@
this.setFlag(7, false);
}
} else {
@@ -2735,6 +3168,7 @@
@@ -2735,6 +3169,7 @@
}
if (!this.level.isClientSide) {
@ -822,7 +833,7 @@
this.setFlag(7, flag);
}
@@ -2902,14 +3336,21 @@
@@ -2902,14 +3337,21 @@
@Override
public boolean isInteractable() {
@ -846,7 +857,7 @@
@Override
protected void velocityChanged() {
this.hurtMarked = this.random.nextDouble() >= this.b(GenericAttributes.KNOCKBACK_RESISTANCE);
@@ -3107,7 +3548,25 @@
@@ -3107,7 +3549,25 @@
} else {
if (!this.useItem.isEmpty() && this.isHandRaised()) {
this.b(this.useItem, 16);
@ -873,7 +884,7 @@
if (itemstack != this.useItem) {
this.a(enumhand, itemstack);
@@ -3179,6 +3638,12 @@
@@ -3179,6 +3639,12 @@
}
public boolean a(double d0, double d1, double d2, boolean flag) {
@ -886,7 +897,7 @@
double d3 = this.locX();
double d4 = this.locY();
double d5 = this.locZ();
@@ -3203,16 +3668,41 @@
@@ -3203,16 +3669,41 @@
}
if (flag2) {
@ -931,7 +942,7 @@
} else {
if (flag) {
world.broadcastEntityEffect(this, (byte) 46);
@@ -3222,7 +3712,7 @@
@@ -3222,7 +3713,7 @@
((EntityCreature) this).getNavigation().o();
}
@ -940,7 +951,7 @@
}
}
@@ -3305,7 +3795,7 @@
@@ -3305,7 +3796,7 @@
}
public void entityWakeup() {
@ -949,7 +960,7 @@
World world = this.level;
java.util.Objects.requireNonNull(this.level);
@@ -3337,7 +3827,7 @@
@@ -3337,7 +3828,7 @@
@Nullable
public EnumDirection eX() {
@ -958,7 +969,7 @@
return blockposition != null ? BlockBed.a((IBlockAccess) this.level, blockposition) : null;
}
@@ -3386,7 +3876,7 @@
@@ -3386,7 +3877,7 @@
Pair<MobEffect, Float> pair = (Pair) iterator.next();
if (!world.isClientSide && pair.getFirst() != null && world.random.nextFloat() < (Float) pair.getSecond()) {