PaperMC/nms-patches/EntityEnderCrystal.patch

53 lines
2.3 KiB
Diff
Raw Normal View History

2015-02-26 23:41:06 +01:00
--- /home/matt/mc-dev-private//net/minecraft/server/EntityEnderCrystal.java 2015-02-26 22:40:22.511608140 +0000
+++ src/main/java/net/minecraft/server/EntityEnderCrystal.java 2015-02-26 22:40:22.511608140 +0000
@@ -1,5 +1,10 @@
package net.minecraft.server;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.entity.ExplosionPrimeEvent;
+// CraftBukkit end
+
public class EntityEnderCrystal extends Entity {
public int a;
@@ -32,7 +37,11 @@
int k = MathHelper.floor(this.locZ);
if (this.world.worldProvider instanceof WorldProviderTheEnd && this.world.getType(new BlockPosition(i, j, k)).getBlock() != Blocks.FIRE) {
- this.world.setTypeUpdate(new BlockPosition(i, j, k), Blocks.FIRE.getBlockData());
+ // CraftBukkit start
+ if (!CraftEventFactory.callBlockIgniteEvent(this.world, i, j, k, this).isCancelled()) {
+ this.world.setTypeUpdate(new BlockPosition(i, j, k), Blocks.FIRE.getBlockData());
+ }
+ // CraftBukkit end
}
}
2015-02-26 23:41:06 +01:00
@@ -50,11 +59,24 @@
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
this.b = 0;
if (this.b <= 0) {
this.die();
2015-02-26 23:41:06 +01:00
if (!this.world.isClientSide) {
- this.world.explode((Entity) null, this.locX, this.locY, this.locZ, 6.0F, true);
+ // 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(), true);
+ // CraftBukkit end
}
}
}