2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/EntityCreeper.java
|
|
|
|
+++ b/net/minecraft/server/EntityCreeper.java
|
2016-11-17 02:41:03 +01:00
|
|
|
@@ -3,6 +3,10 @@
|
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.Iterator;
|
2016-05-10 13:47:39 +02:00
|
|
|
import javax.annotation.Nullable;
|
2014-11-25 22:32:16 +01:00
|
|
|
+// CraftBukkit start
|
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
|
|
+import org.bukkit.event.entity.ExplosionPrimeEvent;
|
|
|
|
+// CraftBukkit end
|
2016-05-10 13:47:39 +02:00
|
|
|
|
2014-11-25 22:32:16 +01:00
|
|
|
public class EntityCreeper extends EntityMonster {
|
|
|
|
|
2017-11-07 13:38:58 +01:00
|
|
|
@@ -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) {
|
2016-11-17 02:41:03 +01:00
|
|
|
@@ -125,7 +129,7 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void die(DamageSource damagesource) {
|
|
|
|
- super.die(damagesource);
|
|
|
|
+ // super.die(damagesource); // CraftBukkit - Moved to end
|
2016-02-29 22:32:46 +01:00
|
|
|
if (this.world.getGameRules().getBoolean("doMobLoot")) {
|
|
|
|
if (damagesource.getEntity() instanceof EntitySkeleton) {
|
|
|
|
int i = Item.getId(Items.RECORD_13);
|
2016-11-17 02:41:03 +01:00
|
|
|
@@ -138,6 +142,7 @@
|
2016-03-07 09:51:42 +01:00
|
|
|
this.a(new ItemStack(Items.SKULL, 1, 4), 0.0F);
|
2016-02-29 22:32:46 +01:00
|
|
|
}
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
+ super.die(damagesource); // CraftBukkit - Moved from above
|
2016-03-07 09:51:42 +01:00
|
|
|
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
|
2016-11-17 02:41:03 +01:00
|
|
|
@@ -164,9 +169,19 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
public void onLightningStrike(EntityLightning entitylightning) {
|
|
|
|
super.onLightningStrike(entitylightning);
|
2016-05-31 12:53:37 +02:00
|
|
|
- this.datawatcher.set(EntityCreeper.b, Boolean.valueOf(true));
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit start
|
|
|
|
+ if (CraftEventFactory.callCreeperPowerEvent(this, entitylightning, org.bukkit.event.entity.CreeperPowerEvent.PowerCause.LIGHTNING).isCancelled()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setPowered(true);
|
|
|
|
}
|
|
|
|
|
2016-05-31 12:53:37 +02:00
|
|
|
+ public void setPowered(boolean powered) {
|
|
|
|
+ this.datawatcher.set(EntityCreeper.b, powered);
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
+
|
2016-11-17 02:41:03 +01:00
|
|
|
protected boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
|
|
|
ItemStack itemstack = entityhuman.b(enumhand);
|
|
|
|
|
|
|
|
@@ -188,10 +203,18 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
boolean flag = this.world.getGameRules().getBoolean("mobGriefing");
|
|
|
|
float f = this.isPowered() ? 2.0F : 1.0F;
|
2015-02-26 23:41:06 +01:00
|
|
|
|
2016-11-17 02:41:03 +01:00
|
|
|
- this.aU = true;
|
2014-11-25 22:32:16 +01:00
|
|
|
- this.world.explode(this, this.locX, this.locY, this.locZ, (float) this.explosionRadius * f, flag);
|
|
|
|
- this.die();
|
2017-06-08 10:00:00 +02:00
|
|
|
- this.ds();
|
2016-02-29 22:32:46 +01:00
|
|
|
+ // CraftBukkit start
|
2014-11-25 22:32:16 +01:00
|
|
|
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), this.explosionRadius * f, false);
|
|
|
|
+ this.world.getServer().getPluginManager().callEvent(event);
|
|
|
|
+ if (!event.isCancelled()) {
|
2016-11-17 02:41:03 +01:00
|
|
|
+ this.aU = true;
|
2014-11-25 22:32:16 +01:00
|
|
|
+ this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), flag);
|
|
|
|
+ this.die();
|
2017-06-08 10:00:00 +02:00
|
|
|
+ this.ds();
|
2014-11-25 22:32:16 +01:00
|
|
|
+ } else {
|
|
|
|
+ fuseTicks = 0;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2017-07-22 01:51:22 +02:00
|
|
|
@@ -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);
|