80 lines
3.1 KiB
Diff
80 lines
3.1 KiB
Diff
--- a/net/minecraft/world/entity/projectile/EntityFireworks.java
|
|
+++ b/net/minecraft/world/entity/projectile/EntityFireworks.java
|
|
@@ -29,6 +29,8 @@
|
|
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
|
import net.minecraft.world.phys.Vec3D;
|
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
|
+
|
|
public class EntityFireworks extends IProjectile implements ItemSupplier {
|
|
|
|
public static final DataWatcherObject<ItemStack> DATA_ID_FIREWORKS_ITEM = DataWatcher.defineId(EntityFireworks.class, DataWatcherRegistry.ITEM_STACK);
|
|
@@ -141,7 +143,7 @@
|
|
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResult(this, this::canHitEntity);
|
|
|
|
if (!this.noPhysics) {
|
|
- this.onHit(movingobjectposition);
|
|
+ this.preOnHit(movingobjectposition); // CraftBukkit - projectile hit event
|
|
this.hasImpulse = true;
|
|
}
|
|
|
|
@@ -156,7 +158,11 @@
|
|
}
|
|
|
|
if (!this.level.isClientSide && this.life > this.lifetime) {
|
|
- this.explode();
|
|
+ // CraftBukkit start
|
|
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
|
|
+ this.explode();
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
}
|
|
@@ -172,7 +178,11 @@
|
|
protected void onHitEntity(MovingObjectPositionEntity movingobjectpositionentity) {
|
|
super.onHitEntity(movingobjectpositionentity);
|
|
if (!this.level.isClientSide) {
|
|
- this.explode();
|
|
+ // CraftBukkit start
|
|
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
|
|
+ this.explode();
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
}
|
|
|
|
@@ -182,7 +192,11 @@
|
|
|
|
this.level.getBlockState(blockposition).entityInside(this.level, blockposition, this);
|
|
if (!this.level.isClientSide() && this.hasExplosion()) {
|
|
- this.explode();
|
|
+ // CraftBukkit start
|
|
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
|
|
+ this.explode();
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
super.onHitBlock(movingobjectpositionblock);
|
|
@@ -208,7 +222,9 @@
|
|
|
|
if (f > 0.0F) {
|
|
if (this.attachedToEntity != null) {
|
|
+ CraftEventFactory.entityDamage = this; // CraftBukkit
|
|
this.attachedToEntity.hurt(DamageSource.fireworks(this, this.getOwner()), 5.0F + (float) (nbttaglist.size() * 2));
|
|
+ CraftEventFactory.entityDamage = null; // CraftBukkit
|
|
}
|
|
|
|
double d0 = 5.0D;
|
|
@@ -235,7 +251,9 @@
|
|
if (flag) {
|
|
float f1 = f * (float) Math.sqrt((5.0D - (double) this.distanceTo(entityliving)) / 5.0D);
|
|
|
|
+ CraftEventFactory.entityDamage = this; // CraftBukkit
|
|
entityliving.hurt(DamageSource.fireworks(this, this.getOwner()), f1);
|
|
+ CraftEventFactory.entityDamage = null; // CraftBukkit
|
|
}
|
|
}
|
|
}
|