2015-09-30 01:02:11 +02:00
|
|
|
--- a/net/minecraft/server/EntityFireworks.java
|
|
|
|
+++ b/net/minecraft/server/EntityFireworks.java
|
2019-08-02 11:32:10 +02:00
|
|
|
@@ -3,12 +3,13 @@
|
2016-12-22 10:26:27 +01:00
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.List;
|
2019-04-23 04:00:00 +02:00
|
|
|
import java.util.OptionalInt;
|
2016-12-22 10:26:27 +01:00
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
public class EntityFireworks extends Entity implements IProjectile {
|
2016-12-22 10:26:27 +01:00
|
|
|
|
2019-08-02 11:32:10 +02:00
|
|
|
public static final DataWatcherObject<ItemStack> FIREWORK_ITEM = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.g);
|
|
|
|
private static final DataWatcherObject<OptionalInt> c = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.r);
|
|
|
|
- private static final DataWatcherObject<Boolean> d = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.i);
|
|
|
|
+ public static final DataWatcherObject<Boolean> d = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.i); // PAIL
|
|
|
|
private int ticksFlown;
|
|
|
|
public int expectedLifespan;
|
|
|
|
private EntityLiving ridingEntity;
|
2019-04-23 04:00:00 +02:00
|
|
|
@@ -133,7 +134,11 @@
|
2015-09-30 01:02:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!this.world.isClientSide && this.ticksFlown > this.expectedLifespan) {
|
2019-04-23 04:00:00 +02:00
|
|
|
- this.explode();
|
2016-12-20 21:00:00 +01:00
|
|
|
+ // CraftBukkit start
|
|
|
|
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
|
2019-04-23 04:00:00 +02:00
|
|
|
+ this.explode();
|
2016-12-20 21:00:00 +01:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2015-09-30 01:02:11 +02:00
|
|
|
}
|
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
}
|
|
|
|
@@ -184,7 +189,9 @@
|
2016-12-22 10:26:27 +01:00
|
|
|
|
|
|
|
if (f > 0.0F) {
|
2019-04-23 04:00:00 +02:00
|
|
|
if (this.ridingEntity != null) {
|
2016-12-22 10:26:27 +01:00
|
|
|
+ CraftEventFactory.entityDamage = this; // CraftBukkit
|
2019-04-23 04:00:00 +02:00
|
|
|
this.ridingEntity.damageEntity(DamageSource.FIREWORKS, 5.0F + (float) (nbttaglist.size() * 2));
|
2016-12-22 10:26:27 +01:00
|
|
|
+ CraftEventFactory.entityDamage = null; // CraftBukkit
|
|
|
|
}
|
|
|
|
|
|
|
|
double d0 = 5.0D;
|
2019-04-23 04:00:00 +02:00
|
|
|
@@ -211,7 +218,9 @@
|
2016-12-23 12:32:40 +01:00
|
|
|
if (flag) {
|
|
|
|
float f1 = f * (float) Math.sqrt((5.0D - (double) this.g(entityliving)) / 5.0D);
|
|
|
|
|
|
|
|
+ CraftEventFactory.entityDamage = this; // CraftBukkit
|
2018-07-15 02:00:00 +02:00
|
|
|
entityliving.damageEntity(DamageSource.FIREWORKS, f1);
|
2016-12-23 12:32:40 +01:00
|
|
|
+ CraftEventFactory.entityDamage = null; // CraftBukkit
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|