Paper/nms-patches/EntityFireworks.patch

46 Zeilen
1.6 KiB
Diff

2015-09-30 01:02:11 +02:00
--- a/net/minecraft/server/EntityFireworks.java
+++ b/net/minecraft/server/EntityFireworks.java
2016-12-22 10:26:27 +01:00
@@ -2,6 +2,7 @@
import java.util.Iterator;
import java.util.List;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class EntityFireworks extends Entity {
@@ -117,8 +118,12 @@
2015-09-30 01:02:11 +02:00
}
if (!this.world.isClientSide && this.ticksFlown > this.expectedLifespan) {
- this.world.broadcastEntityEffect(this, (byte) 17);
2016-12-20 21:00:00 +01:00
- this.k();
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
+ this.world.broadcastEntityEffect(this, (byte) 17);
+ this.k();
+ }
+ // CraftBukkit end
2015-09-30 01:02:11 +02:00
this.die();
}
2016-12-22 10:26:27 +01:00
@@ -136,7 +141,9 @@
if (f > 0.0F) {
if (this.e != null) {
+ CraftEventFactory.entityDamage = this; // CraftBukkit
this.e.damageEntity(DamageSource.t, (float) (5 + nbttaglist.size() * 2));
+ CraftEventFactory.entityDamage = null; // CraftBukkit
}
double d0 = 5.0D;
2016-12-23 12:32:40 +01:00
@@ -162,7 +169,9 @@
if (flag) {
float f1 = f * (float) Math.sqrt((5.0D - (double) this.g(entityliving)) / 5.0D);
+ CraftEventFactory.entityDamage = this; // CraftBukkit
entityliving.damageEntity(DamageSource.t, f1);
+ CraftEventFactory.entityDamage = null; // CraftBukkit
}
}
}