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
|
|
@@ -28,6 +28,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);
|
|
@@ -143,7 +145,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 +160,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 +180,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 +194,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);
|
|
@@ -210,7 +224,9 @@
|
|
|
|
if (f > 0.0F) {
|
|
if (this.attachedToEntity != null) {
|
|
+ CraftEventFactory.entityDamage = this; // CraftBukkit
|
|
this.attachedToEntity.hurt(this.damageSources().fireworks(this, this.getOwner()), 5.0F + (float) (nbttaglist.size() * 2));
|
|
+ CraftEventFactory.entityDamage = null; // CraftBukkit
|
|
}
|
|
|
|
double d0 = 5.0D;
|
|
@@ -237,7 +253,9 @@
|
|
if (flag) {
|
|
float f1 = f * (float) Math.sqrt((5.0D - (double) this.distanceTo(entityliving)) / 5.0D);
|
|
|
|
+ CraftEventFactory.entityDamage = this; // CraftBukkit
|
|
entityliving.hurt(this.damageSources().fireworks(this, this.getOwner()), f1);
|
|
+ CraftEventFactory.entityDamage = null; // CraftBukkit
|
|
}
|
|
}
|
|
}
|