Paper/nms-patches/EntityFireworks.patch

70 Zeilen
2.5 KiB
Diff

2015-09-30 01:02:11 +02:00
--- a/net/minecraft/server/EntityFireworks.java
+++ b/net/minecraft/server/EntityFireworks.java
2020-06-25 02:00:00 +02:00
@@ -4,6 +4,7 @@
2016-12-22 10:26:27 +01:00
import java.util.List;
2019-04-23 04:00:00 +02:00
import java.util.OptionalInt;
2020-06-25 02:00:00 +02:00
import javax.annotation.Nullable;
2016-12-22 10:26:27 +01:00
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
2020-06-25 02:00:00 +02:00
public class EntityFireworks extends IProjectile {
2016-12-22 10:26:27 +01:00
2020-06-25 02:00:00 +02:00
@@ -119,7 +120,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
}
2020-06-25 02:00:00 +02:00
@@ -134,7 +139,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
2020-06-25 02:00:00 +02:00
}
}
2020-06-25 02:00:00 +02:00
@@ -144,7 +153,11 @@
2020-06-25 02:00:00 +02:00
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
}
2020-06-25 02:00:00 +02:00
super.a(movingobjectpositionblock);
@@ -170,7 +183,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
2020-06-25 02:00:00 +02:00
this.ridingEntity.damageEntity(DamageSource.a(this, this.getShooter()), 5.0F + (float) (nbttaglist.size() * 2));
2016-12-22 10:26:27 +01:00
+ CraftEventFactory.entityDamage = null; // CraftBukkit
}
double d0 = 5.0D;
2020-06-25 02:00:00 +02:00
@@ -197,7 +212,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
2020-06-25 02:00:00 +02:00
entityliving.damageEntity(DamageSource.a(this, this.getShooter()), f1);
2016-12-23 12:32:40 +01:00
+ CraftEventFactory.entityDamage = null; // CraftBukkit
}
}
}