PaperMC/paper-server/nms-patches/EntityFireworks.patch
CraftBukkit/Spigot 6450eb0ab7 Update to Minecraft 1.16.4
By: md_5 <git@md-5.net>
2020-11-03 07:00:00 +11:00

69 lines
2.5 KiB
Diff

--- a/net/minecraft/server/EntityFireworks.java
+++ b/net/minecraft/server/EntityFireworks.java
@@ -4,6 +4,7 @@
import java.util.List;
import java.util.OptionalInt;
import javax.annotation.Nullable;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class EntityFireworks extends IProjectile {
@@ -121,7 +122,11 @@
}
if (!this.world.isClientSide && this.ticksFlown > this.expectedLifespan) {
- this.explode();
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
+ this.explode();
+ }
+ // CraftBukkit end
}
}
@@ -136,7 +141,11 @@
protected void a(MovingObjectPositionEntity movingobjectpositionentity) {
super.a(movingobjectpositionentity);
if (!this.world.isClientSide) {
- this.explode();
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
+ this.explode();
+ }
+ // CraftBukkit end
}
}
@@ -146,7 +155,11 @@
this.world.getType(blockposition).a(this.world, blockposition, (Entity) this);
if (!this.world.s_() && this.hasExplosions()) {
- this.explode();
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
+ this.explode();
+ }
+ // CraftBukkit end
}
super.a(movingobjectpositionblock);
@@ -172,7 +185,9 @@
if (f > 0.0F) {
if (this.ridingEntity != null) {
+ CraftEventFactory.entityDamage = this; // CraftBukkit
this.ridingEntity.damageEntity(DamageSource.a(this, this.getShooter()), 5.0F + (float) (nbttaglist.size() * 2));
+ CraftEventFactory.entityDamage = null; // CraftBukkit
}
double d0 = 5.0D;
@@ -199,7 +214,9 @@
if (flag) {
float f1 = f * (float) Math.sqrt((5.0D - (double) this.g((Entity) entityliving)) / 5.0D);
+ CraftEventFactory.entityDamage = this; // CraftBukkit
entityliving.damageEntity(DamageSource.a(this, this.getShooter()), f1);
+ CraftEventFactory.entityDamage = null; // CraftBukkit
}
}
}