mirror of
https://github.com/PaperMC/Paper.git
synced 2024-09-12 15:08:27 +02:00
SPIGOT-2765: Special case entity triggered explosions for HangingBreakEvent
This commit is contained in:
parent
7691c87df6
commit
c1462a24d8
@ -1,18 +1,19 @@
|
||||
--- a/net/minecraft/server/EntityHanging.java
|
||||
+++ b/net/minecraft/server/EntityHanging.java
|
||||
@@ -4,6 +4,11 @@
|
||||
@@ -4,6 +4,12 @@
|
||||
import javax.annotation.Nullable;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.entity.Hanging;
|
||||
+import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||
+import org.bukkit.event.hanging.HangingBreakEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class EntityHanging extends Entity {
|
||||
|
||||
private static final Predicate<Entity> c = new Predicate() {
|
||||
@@ -41,43 +46,52 @@
|
||||
@@ -41,43 +47,52 @@
|
||||
this.updateBoundingBox();
|
||||
}
|
||||
|
||||
@ -97,7 +98,7 @@
|
||||
return i % 32 == 0 ? 0.5D : 0.0D;
|
||||
}
|
||||
|
||||
@@ -88,6 +102,24 @@
|
||||
@@ -88,6 +103,24 @@
|
||||
if (this.d++ == 100 && !this.world.isClientSide) {
|
||||
this.d = 0;
|
||||
if (!this.dead && !this.survives()) {
|
||||
@ -122,14 +123,14 @@
|
||||
this.die();
|
||||
this.a((Entity) null);
|
||||
}
|
||||
@@ -140,6 +172,21 @@
|
||||
@@ -140,6 +173,21 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.dead && !this.world.isClientSide) {
|
||||
+ // CraftBukkit start - fire break events
|
||||
+ HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.DEFAULT);
|
||||
+ if (damagesource.getEntity() != null) {
|
||||
+ event = new org.bukkit.event.hanging.HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damagesource.getEntity() == null ? null : damagesource.getEntity().getBukkitEntity());
|
||||
+ event = new HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damagesource.getEntity() == null ? null : damagesource.getEntity().getBukkitEntity(), damagesource.isExplosion() ? HangingBreakEvent.RemoveCause.EXPLOSION : HangingBreakEvent.RemoveCause.ENTITY);
|
||||
+ } else if (damagesource.isExplosion()) {
|
||||
+ event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.EXPLOSION);
|
||||
+ }
|
||||
@ -144,7 +145,7 @@
|
||||
this.die();
|
||||
this.ap();
|
||||
this.a(damagesource.getEntity());
|
||||
@@ -151,6 +198,18 @@
|
||||
@@ -151,6 +199,18 @@
|
||||
|
||||
public void move(EnumMoveType enummovetype, double d0, double d1, double d2) {
|
||||
if (!this.world.isClientSide && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) {
|
||||
@ -163,7 +164,7 @@
|
||||
this.die();
|
||||
this.a((Entity) null);
|
||||
}
|
||||
@@ -158,7 +217,7 @@
|
||||
@@ -158,7 +218,7 @@
|
||||
}
|
||||
|
||||
public void f(double d0, double d1, double d2) {
|
||||
|
Loading…
Reference in New Issue
Block a user