Paper/nms-patches/EntityFireworks.patch

46 lines
1.6 KiB
Diff
Raw Normal View History

2015-09-30 07:02:11 +08:00
--- a/net/minecraft/server/EntityFireworks.java
+++ b/net/minecraft/server/EntityFireworks.java
2016-12-22 17:26:27 +08: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 {
2018-07-15 08:00:00 +08:00
@@ -114,8 +115,12 @@
2015-09-30 07:02:11 +08:00
}
if (!this.world.isClientSide && this.ticksFlown > this.expectedLifespan) {
- this.world.broadcastEntityEffect(this, (byte) 17);
2018-07-15 08:00:00 +08:00
- this.i();
2016-12-21 04:00:00 +08:00
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
+ this.world.broadcastEntityEffect(this, (byte) 17);
2018-07-15 08:00:00 +08:00
+ this.i();
2016-12-21 04:00:00 +08:00
+ }
+ // CraftBukkit end
2015-09-30 07:02:11 +08:00
this.die();
}
2018-07-15 08:00:00 +08:00
@@ -133,7 +138,9 @@
2016-12-22 17:26:27 +08:00
if (f > 0.0F) {
if (this.e != null) {
+ CraftEventFactory.entityDamage = this; // CraftBukkit
2018-07-15 08:00:00 +08:00
this.e.damageEntity(DamageSource.FIREWORKS, (float) (5 + nbttaglist.size() * 2));
2016-12-22 17:26:27 +08:00
+ CraftEventFactory.entityDamage = null; // CraftBukkit
}
double d0 = 5.0D;
2018-07-15 08:00:00 +08:00
@@ -159,7 +166,9 @@
2016-12-23 19:32:40 +08:00
if (flag) {
float f1 = f * (float) Math.sqrt((5.0D - (double) this.g(entityliving)) / 5.0D);
+ CraftEventFactory.entityDamage = this; // CraftBukkit
2018-07-15 08:00:00 +08:00
entityliving.damageEntity(DamageSource.FIREWORKS, f1);
2016-12-23 19:32:40 +08:00
+ CraftEventFactory.entityDamage = null; // CraftBukkit
}
}
}