94 Zeilen
3.5 KiB
Diff
94 Zeilen
3.5 KiB
Diff
--- a/net/minecraft/server/EntityCreeper.java
|
|
+++ b/net/minecraft/server/EntityCreeper.java
|
|
@@ -3,6 +3,10 @@
|
|
import java.util.Collection;
|
|
import java.util.Iterator;
|
|
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 {
|
|
|
|
@@ -11,8 +15,8 @@
|
|
private static final DataWatcherObject<Boolean> c = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.h);
|
|
private int bx;
|
|
private int fuseTicks;
|
|
- private int maxFuseTicks = 30;
|
|
- private int explosionRadius = 3;
|
|
+ public int maxFuseTicks = 30; // PAIL private -> public
|
|
+ public int explosionRadius = 3; // PAIL private -> public
|
|
private int bB;
|
|
|
|
public EntityCreeper(World world) {
|
|
@@ -125,7 +129,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);
|
|
@@ -138,6 +142,7 @@
|
|
this.a(new ItemStack(Items.SKULL, 1, 4), 0.0F);
|
|
}
|
|
}
|
|
+ super.die(damagesource); // CraftBukkit - Moved from above
|
|
|
|
}
|
|
|
|
@@ -164,9 +169,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) {
|
|
ItemStack itemstack = entityhuman.b(enumhand);
|
|
|
|
@@ -188,10 +203,18 @@
|
|
boolean flag = this.world.getGameRules().getBoolean("mobGriefing");
|
|
float f = this.isPowered() ? 2.0F : 1.0F;
|
|
|
|
- this.aU = true;
|
|
- this.world.explode(this, this.locX, this.locY, this.locZ, (float) this.explosionRadius * f, flag);
|
|
- this.die();
|
|
- this.ds();
|
|
+ // CraftBukkit start
|
|
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), this.explosionRadius * f, false);
|
|
+ this.world.getServer().getPluginManager().callEvent(event);
|
|
+ if (!event.isCancelled()) {
|
|
+ this.aU = true;
|
|
+ this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), flag);
|
|
+ this.die();
|
|
+ this.ds();
|
|
+ } else {
|
|
+ fuseTicks = 0;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
}
|
|
@@ -202,6 +225,7 @@
|
|
if (!collection.isEmpty()) {
|
|
EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.world, this.locX, this.locY, this.locZ);
|
|
|
|
+ entityareaeffectcloud.setSource(this); // CraftBukkit
|
|
entityareaeffectcloud.setRadius(2.5F);
|
|
entityareaeffectcloud.setRadiusOnUse(-0.5F);
|
|
entityareaeffectcloud.setWaitTime(10);
|