3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-27 16:40:07 +01:00
Paper/nms-patches/EntityEnderCrystal.patch
2019-12-11 09:00:00 +11:00

52 Zeilen
2.3 KiB
Diff

--- a/net/minecraft/server/EntityEnderCrystal.java
+++ b/net/minecraft/server/EntityEnderCrystal.java
@@ -3,6 +3,11 @@
import java.util.Optional;
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 {
private static final DataWatcherObject<Optional<BlockPosition>> c = DataWatcher.a(EntityEnderCrystal.class, DataWatcherRegistry.m);
@@ -38,7 +43,11 @@
BlockPosition blockposition = new BlockPosition(this);
if (this.world.worldProvider instanceof WorldProviderTheEnd && this.world.getType(blockposition).isAir()) {
- this.world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData());
+ // CraftBukkit start
+ if (!CraftEventFactory.callBlockIgniteEvent(this.world, blockposition, this).isCancelled()) {
+ this.world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData());
+ }
+ // CraftBukkit end
}
}
@@ -78,9 +87,22 @@
return false;
} else {
if (!this.dead && !this.world.isClientSide) {
+ // CraftBukkit start - All non-living entities need this
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
+ 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);