Paper/nms-patches/EntityEnderCrystal.patch

52 lines
2.4 KiB
Diff
Raw Normal View History

2015-05-25 18:37:24 +08:00
--- a/net/minecraft/server/EntityEnderCrystal.java
+++ b/net/minecraft/server/EntityEnderCrystal.java
2016-05-10 19:47:39 +08:00
@@ -3,6 +3,11 @@
2016-03-01 05:32:46 +08:00
import com.google.common.base.Optional;
2016-05-10 19:47:39 +08: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 {
2016-03-01 05:32:46 +08:00
private static final DataWatcherObject<Optional<BlockPosition>> b = DataWatcher.a(EntityEnderCrystal.class, DataWatcherRegistry.k);
2016-05-10 19:47:39 +08:00
@@ -39,7 +44,11 @@
2016-03-01 05:32:46 +08:00
BlockPosition blockposition = new BlockPosition(this);
2016-03-01 05:32:46 +08:00
if (this.world.worldProvider instanceof WorldProviderTheEnd && this.world.getType(blockposition).getBlock() != Blocks.FIRE) {
- this.world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData());
+ // CraftBukkit start
+ if (!CraftEventFactory.callBlockIgniteEvent(this.world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this).isCancelled()) {
+ this.world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData());
+ }
+ // CraftBukkit end
}
}
2016-05-10 19:47:39 +08:00
@@ -75,9 +84,22 @@
return false;
} else {
2015-02-27 06:41:06 +08: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-03-01 05:32:46 +08:00
this.die();
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, true);
+ this.world.getServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ this.dead = false;
+ return false;
+ }
+ this.world.explode(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
+ // CraftBukkit end
this.a(damagesource);
}
}