2021-03-16 09:00:00 +11:00

52 lines
2.5 KiB
Diff

--- a/net/minecraft/world/entity/boss/enderdragon/EntityEnderCrystal.java
+++ b/net/minecraft/world/entity/boss/enderdragon/EntityEnderCrystal.java
@@ -20,6 +20,11 @@
import net.minecraft.world.level.block.BlockFireAbstract;
import net.minecraft.world.level.dimension.end.EnderDragonBattle;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.entity.ExplosionPrimeEvent;
+// CraftBukkit end
+
public class EntityEnderCrystal extends Entity {
private static final DataWatcherObject<Optional<BlockPosition>> c = DataWatcher.a(EntityEnderCrystal.class, DataWatcherRegistry.m);
@@ -55,7 +60,11 @@
BlockPosition blockposition = this.getChunkCoordinates();
if (((WorldServer) this.world).getDragonBattle() != null && this.world.getType(blockposition).isAir()) {
- this.world.setTypeUpdate(blockposition, BlockFireAbstract.a((IBlockAccess) this.world, blockposition));
+ // CraftBukkit start
+ if (!CraftEventFactory.callBlockIgniteEvent(this.world, blockposition, this).isCancelled()) {
+ this.world.setTypeUpdate(blockposition, BlockFireAbstract.a((IBlockAccess) this.world, blockposition));
+ }
+ // CraftBukkit end
}
}
@@ -95,9 +104,22 @@
return false;
} else {
if (!this.dead && !this.world.isClientSide) {
+ // CraftBukkit start - All non-living entities need this
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, false)) {
+ return false;
+ }
+ // CraftBukkit end
this.die();
if (!damagesource.isExplosion()) {
- this.world.explode((Entity) null, this.locX(), this.locY(), this.locZ(), 6.0F, Explosion.Effect.DESTROY);
+ // 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;
+ }
+ this.world.createExplosion(this, this.locX(), this.locY(), this.locZ(), event.getRadius(), event.getFire(), Explosion.Effect.DESTROY);
+ // CraftBukkit end
}
this.a(damagesource);