51 lines
1.8 KiB
Diff

--- a/net/minecraft/world/entity/projectile/EntityFireworks.java
+++ b/net/minecraft/world/entity/projectile/EntityFireworks.java
@@ -143,7 +143,7 @@
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResultOnMoveVector(this, this::canHitEntity);
if (!this.noPhysics) {
- this.onHit(movingobjectposition);
+ this.preOnHit(movingobjectposition); // CraftBukkit - projectile hit event
this.hasImpulse = true;
}
@@ -158,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
}
}
@@ -174,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
}
}
@@ -184,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);