mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 02:25:28 +01:00
SPIGOT-5290: Invulnerable and/or Marker armor stand triggers EntityDamageEvent
This commit is contained in:
parent
631eaeb09b
commit
6ed8a18966
@ -52,21 +52,24 @@
|
||||
|
||||
if (entityhuman.abilities.canInstantlyBuild && itemstack1.isEmpty() && !itemstack.isEmpty()) {
|
||||
itemstack2 = itemstack.cloneItemStack();
|
||||
@@ -396,14 +427,19 @@
|
||||
|
||||
@Override
|
||||
@@ -398,12 +429,22 @@
|
||||
public boolean damageEntity(DamageSource damagesource, float f) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (!this.world.isClientSide && !this.dead) {
|
||||
if (DamageSource.OUT_OF_WORLD.equals(damagesource)) {
|
||||
- this.die();
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ this.killEntity(); // CraftBukkit - this.die() -> this.killEntity()
|
||||
return false;
|
||||
} else if (!this.isInvulnerable(damagesource) && !this.bD && !this.isMarker()) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (damagesource.isExplosion()) {
|
||||
this.g(damagesource);
|
||||
- this.die();
|
||||
@ -74,7 +77,7 @@
|
||||
return false;
|
||||
} else if (DamageSource.FIRE.equals(damagesource)) {
|
||||
if (this.isBurning()) {
|
||||
@@ -428,7 +464,7 @@
|
||||
@@ -428,7 +469,7 @@
|
||||
} else if (damagesource.v()) {
|
||||
this.F();
|
||||
this.D();
|
||||
@ -83,7 +86,7 @@
|
||||
return flag1;
|
||||
} else {
|
||||
long i = this.world.getTime();
|
||||
@@ -439,7 +475,7 @@
|
||||
@@ -439,7 +480,7 @@
|
||||
} else {
|
||||
this.f(damagesource);
|
||||
this.D();
|
||||
@ -92,7 +95,7 @@
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -466,7 +502,7 @@
|
||||
@@ -466,7 +507,7 @@
|
||||
f1 -= f;
|
||||
if (f1 <= 0.5F) {
|
||||
this.g(damagesource);
|
||||
@ -101,7 +104,7 @@
|
||||
} else {
|
||||
this.setHealth(f1);
|
||||
}
|
||||
@@ -474,13 +510,13 @@
|
||||
@@ -474,13 +515,13 @@
|
||||
}
|
||||
|
||||
private void f(DamageSource damagesource) {
|
||||
@ -117,7 +120,7 @@
|
||||
|
||||
ItemStack itemstack;
|
||||
int i;
|
||||
@@ -488,7 +524,7 @@
|
||||
@@ -488,7 +529,7 @@
|
||||
for (i = 0; i < this.handItems.size(); ++i) {
|
||||
itemstack = (ItemStack) this.handItems.get(i);
|
||||
if (!itemstack.isEmpty()) {
|
||||
@ -126,7 +129,7 @@
|
||||
this.handItems.set(i, ItemStack.a);
|
||||
}
|
||||
}
|
||||
@@ -496,10 +532,11 @@
|
||||
@@ -496,10 +537,11 @@
|
||||
for (i = 0; i < this.armorItems.size(); ++i) {
|
||||
itemstack = (ItemStack) this.armorItems.get(i);
|
||||
if (!itemstack.isEmpty()) {
|
||||
@ -139,7 +142,7 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -600,8 +637,16 @@
|
||||
@@ -600,8 +642,16 @@
|
||||
return this.isSmall();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user