mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 02:20:01 +03:00
98 lines
4.0 KiB
Diff
98 lines
4.0 KiB
Diff
--- ../src-base/minecraft/net/minecraft/entity/monster/EntityCreeper.java
|
|
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityCreeper.java
|
|
@@ -36,6 +36,8 @@
|
|
import net.minecraft.world.storage.loot.LootTableList;
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
+import org.bukkit.event.entity.ExplosionPrimeEvent;
|
|
|
|
public class EntityCreeper extends EntityMob
|
|
{
|
|
@@ -44,8 +46,8 @@
|
|
private static final DataParameter<Boolean> IGNITED = EntityDataManager.<Boolean>createKey(EntityCreeper.class, DataSerializers.BOOLEAN);
|
|
private int lastActiveTime;
|
|
private int timeSinceIgnited;
|
|
- private int fuseTime = 30;
|
|
- private int explosionRadius = 3;
|
|
+ public int fuseTime = 30;
|
|
+ public int explosionRadius = 3;
|
|
private int droppedSkulls;
|
|
|
|
public EntityCreeper(World worldIn)
|
|
@@ -184,7 +186,7 @@
|
|
|
|
public void onDeath(DamageSource cause)
|
|
{
|
|
- super.onDeath(cause);
|
|
+// super.onDeath(cause); // CraftBukkit - Moved to end
|
|
|
|
if (this.world.getGameRules().getBoolean("doMobLoot"))
|
|
{
|
|
@@ -201,6 +203,7 @@
|
|
this.entityDropItem(new ItemStack(Items.SKULL, 1, 4), 0.0F);
|
|
}
|
|
}
|
|
+ super.onDeath(cause); // CraftBukkit - Moved from above
|
|
}
|
|
|
|
public boolean attackEntityAsMob(Entity entityIn)
|
|
@@ -237,10 +240,20 @@
|
|
|
|
public void onStruckByLightning(EntityLightningBolt lightningBolt)
|
|
{
|
|
+ if (lightningBolt == null) lightningBolt = new EntityLightningBolt(this.world, this.posX, this.posY, this.posZ, true); // CatServer - if null, create EntityLightningBolt for Bukkit
|
|
super.onStruckByLightning(lightningBolt);
|
|
- this.dataManager.set(POWERED, Boolean.valueOf(true));
|
|
+
|
|
+ if (CraftEventFactory.callCreeperPowerEvent(this, lightningBolt, org.bukkit.event.entity.CreeperPowerEvent.PowerCause.LIGHTNING).isCancelled()) {
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ this.setPowered(true);
|
|
}
|
|
|
|
+ public void setPowered(boolean powered) {
|
|
+ this.dataManager.set(EntityCreeper.POWERED, powered);
|
|
+ }
|
|
+
|
|
protected boolean processInteract(EntityPlayer player, EnumHand hand)
|
|
{
|
|
ItemStack itemstack = player.getHeldItem(hand);
|
|
@@ -265,12 +278,22 @@
|
|
{
|
|
if (!this.world.isRemote)
|
|
{
|
|
- boolean flag = this.world.getGameRules().getBoolean("mobGriefing");
|
|
+ boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.world, this);
|
|
float f = this.getPowered() ? 2.0F : 1.0F;
|
|
- this.dead = true;
|
|
- this.world.createExplosion(this, this.posX, this.posY, this.posZ, (float)this.explosionRadius * f, flag);
|
|
- this.setDead();
|
|
- this.spawnLingeringCloud();
|
|
+// this.dead = true;
|
|
+// this.world.createExplosion(this, this.posX, this.posY, this.posZ, (float)this.explosionRadius * f, flag);
|
|
+// this.setDead();
|
|
+// this.spawnLingeringCloud();
|
|
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), this.explosionRadius * f, false);
|
|
+ this.world.getServer().getPluginManager().callEvent(event);
|
|
+ if (!event.isCancelled()) {
|
|
+ this.dead = true;
|
|
+ this.world.newExplosion(this, this.posX, this.posY, this.posZ, event.getRadius(), event.getFire(), flag);
|
|
+ this.setDead();
|
|
+ this.spawnLingeringCloud();
|
|
+ } else {
|
|
+ timeSinceIgnited = 0;
|
|
+ }
|
|
}
|
|
}
|
|
|
|
@@ -281,6 +304,7 @@
|
|
if (!collection.isEmpty())
|
|
{
|
|
EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.world, this.posX, this.posY, this.posZ);
|
|
+ entityareaeffectcloud.setOwner(this);
|
|
entityareaeffectcloud.setRadius(2.5F);
|
|
entityareaeffectcloud.setRadiusOnUse(-0.5F);
|
|
entityareaeffectcloud.setWaitTime(10);
|