Paper/nms-patches/EntityEnderCrystal.patch

52 lines
2.3 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/EntityEnderCrystal.java
+++ b/net/minecraft/server/EntityEnderCrystal.java
2016-05-10 13:47:39 +02:00
@@ -3,6 +3,11 @@
2018-07-15 02:00:00 +02:00
import java.util.Optional;
2016-05-10 13:47:39 +02:00
import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.entity.ExplosionPrimeEvent;
+// CraftBukkit end
+
public class EntityEnderCrystal extends Entity {
2019-04-23 04:00:00 +02:00
private static final DataWatcherObject<Optional<BlockPosition>> c = DataWatcher.a(EntityEnderCrystal.class, DataWatcherRegistry.m);
2019-12-10 23:00:00 +01:00
@@ -38,7 +43,11 @@
2016-02-29 22:32:46 +01:00
BlockPosition blockposition = new BlockPosition(this);
2018-07-15 02:00:00 +02:00
if (this.world.worldProvider instanceof WorldProviderTheEnd && this.world.getType(blockposition).isAir()) {
2016-02-29 22:32:46 +01:00
- this.world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData());
+ // CraftBukkit start
2018-07-15 02:00:00 +02:00
+ if (!CraftEventFactory.callBlockIgniteEvent(this.world, blockposition, this).isCancelled()) {
2016-02-29 22:32:46 +01:00
+ this.world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData());
+ }
+ // CraftBukkit end
}
}
2019-12-10 23:00:00 +01:00
@@ -78,9 +87,22 @@
return false;
} else {
2015-02-26 23:41:06 +01:00
if (!this.dead && !this.world.isClientSide) {
+ // CraftBukkit start - All non-living entities need this
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
+ return false;
+ }
+ // CraftBukkit end
2016-02-29 22:32:46 +01:00
this.die();
2019-05-27 22:30:00 +02:00
if (!damagesource.isExplosion()) {
2019-12-10 23:00:00 +01:00
- this.world.explode((Entity) null, this.locX(), this.locY(), this.locZ(), 6.0F, Explosion.Effect.DESTROY);
2019-05-27 22:30:00 +02:00
+ // CraftBukkit start
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 6.0F, false);
+ this.world.getServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ this.dead = false;
+ return false;
+ }
2019-12-10 23:00:00 +01:00
+ this.world.createExplosion(this, this.locX(), this.locY(), this.locZ(), event.getRadius(), event.getFire(), Explosion.Effect.DESTROY);
2019-05-27 22:30:00 +02:00
+ // CraftBukkit end
}
2017-05-30 13:25:59 +02:00
2019-05-27 22:30:00 +02:00
this.a(damagesource);