mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 22:44:17 +01:00
73 lines
2.7 KiB
Diff
73 lines
2.7 KiB
Diff
--- a/net/minecraft/server/EntityCreeper.java
|
|
+++ b/net/minecraft/server/EntityCreeper.java
|
|
@@ -1,6 +1,10 @@
|
|
package net.minecraft.server;
|
|
|
|
import javax.annotation.Nullable;
|
|
+// CraftBukkit start
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
+import org.bukkit.event.entity.ExplosionPrimeEvent;
|
|
+// CraftBukkit end
|
|
|
|
public class EntityCreeper extends EntityMonster {
|
|
|
|
@@ -123,7 +127,7 @@
|
|
}
|
|
|
|
public void die(DamageSource damagesource) {
|
|
- super.die(damagesource);
|
|
+ // super.die(damagesource); // CraftBukkit - Moved to end
|
|
if (this.world.getGameRules().getBoolean("doMobLoot")) {
|
|
if (damagesource.getEntity() instanceof EntitySkeleton) {
|
|
int i = Item.getId(Items.RECORD_13);
|
|
@@ -136,6 +140,7 @@
|
|
this.a(new ItemStack(Items.SKULL, 1, 4), 0.0F);
|
|
}
|
|
}
|
|
+ super.die(damagesource); // CraftBukkit - Moved from above
|
|
|
|
}
|
|
|
|
@@ -162,9 +167,19 @@
|
|
|
|
public void onLightningStrike(EntityLightning entitylightning) {
|
|
super.onLightningStrike(entitylightning);
|
|
- this.datawatcher.set(EntityCreeper.b, Boolean.valueOf(true));
|
|
+ // CraftBukkit start
|
|
+ if (CraftEventFactory.callCreeperPowerEvent(this, entitylightning, org.bukkit.event.entity.CreeperPowerEvent.PowerCause.LIGHTNING).isCancelled()) {
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ this.setPowered(true);
|
|
}
|
|
|
|
+ public void setPowered(boolean powered) {
|
|
+ this.datawatcher.set(EntityCreeper.b, powered);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
protected boolean a(EntityHuman entityhuman, EnumHand enumhand, @Nullable ItemStack itemstack) {
|
|
if (itemstack != null && itemstack.getItem() == Items.FLINT_AND_STEEL) {
|
|
this.world.a(entityhuman, this.locX, this.locY, this.locZ, SoundEffects.by, this.bC(), 1.0F, this.random.nextFloat() * 0.4F + 0.8F);
|
|
@@ -184,9 +199,17 @@
|
|
boolean flag = this.world.getGameRules().getBoolean("mobGriefing");
|
|
float f = this.isPowered() ? 2.0F : 1.0F;
|
|
|
|
- this.aV = true;
|
|
- this.world.explode(this, this.locX, this.locY, this.locZ, (float) this.explosionRadius * f, flag);
|
|
- this.die();
|
|
+ // CraftBukkit start
|
|
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), this.explosionRadius * f, false);
|
|
+ this.world.getServer().getPluginManager().callEvent(event);
|
|
+ if (!event.isCancelled()) {
|
|
+ this.aV = true;
|
|
+ this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), flag);
|
|
+ this.die();
|
|
+ } else {
|
|
+ fuseTicks = 0;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
}
|