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

This commit is contained in:
Doc 2021-09-06 18:57:16 +10:00 committed by md_5
parent 757d42aef6
commit 9217b523e5
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

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