67 lines
3.5 KiB
Diff
67 lines
3.5 KiB
Diff
--- a/net/minecraft/world/entity/boss/enderdragon/EntityEnderCrystal.java
|
|
+++ b/net/minecraft/world/entity/boss/enderdragon/EntityEnderCrystal.java
|
|
@@ -19,6 +19,12 @@
|
|
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.EntityRemoveEvent;
|
|
+import org.bukkit.event.entity.ExplosionPrimeEvent;
|
|
+// CraftBukkit end
|
|
+
|
|
public class EntityEnderCrystal extends Entity {
|
|
|
|
private static final DataWatcherObject<Optional<BlockPosition>> DATA_BEAM_TARGET = DataWatcher.<Optional<BlockPosition>>defineId(EntityEnderCrystal.class, DataWatcherRegistry.OPTIONAL_BLOCK_POS);
|
|
@@ -57,7 +63,11 @@
|
|
BlockPosition blockposition = this.blockPosition();
|
|
|
|
if (((WorldServer) this.level()).getDragonFight() != null && this.level().getBlockState(blockposition).isAir()) {
|
|
- this.level().setBlockAndUpdate(blockposition, BlockFireAbstract.getState(this.level(), blockposition));
|
|
+ // CraftBukkit start
|
|
+ if (!CraftEventFactory.callBlockIgniteEvent(this.level(), blockposition, this).isCancelled()) {
|
|
+ this.level().setBlockAndUpdate(blockposition, BlockFireAbstract.getState(this.level(), blockposition));
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
}
|
|
|
|
@@ -71,7 +81,7 @@
|
|
|
|
@Override
|
|
protected void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
|
- this.setBeamTarget((BlockPosition) nbttagcompound.read("beam_target", BlockPosition.CODEC).orElse((Object) null));
|
|
+ this.setBeamTarget((BlockPosition) nbttagcompound.read("beam_target", BlockPosition.CODEC).orElse(null)); // CraftBukkit - decompile error
|
|
this.setShowBottom(nbttagcompound.getBooleanOr("ShowBottom", true));
|
|
}
|
|
|
|
@@ -93,12 +103,26 @@
|
|
return false;
|
|
} else {
|
|
if (!this.isRemoved()) {
|
|
- this.remove(Entity.RemovalReason.KILLED);
|
|
+ // CraftBukkit start - All non-living entities need this
|
|
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, false)) {
|
|
+ return false;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
if (!damagesource.is(DamageTypeTags.IS_EXPLOSION)) {
|
|
DamageSource damagesource1 = damagesource.getEntity() != null ? this.damageSources().explosion(this, damagesource.getEntity()) : null;
|
|
|
|
- worldserver.explode(this, damagesource1, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), 6.0F, false, World.a.BLOCK);
|
|
+ // CraftBukkit start
|
|
+ ExplosionPrimeEvent event = CraftEventFactory.callExplosionPrimeEvent(this, 6.0F, false);
|
|
+ if (event.isCancelled()) {
|
|
+ return false;
|
|
+ }
|
|
+
|
|
+ this.remove(Entity.RemovalReason.KILLED, EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause
|
|
+ worldserver.explode(this, damagesource1, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.BLOCK);
|
|
+ } else {
|
|
+ this.remove(Entity.RemovalReason.KILLED, EntityRemoveEvent.Cause.DEATH); // CraftBukkit - add Bukkit remove cause
|
|
}
|
|
+ // CraftBukkit end
|
|
|
|
this.onDestroyedBy(worldserver, damagesource);
|
|
}
|