--- ../src-base/minecraft/net/minecraftforge/event/world/ExplosionEvent.java
+++ ../src-work/minecraft/net/minecraftforge/event/world/ExplosionEvent.java
@@ -1,13 +1,18 @@
package net.minecraftforge.event.world;
import java.util.List;
-
+import org.bukkit.event.entity.ExplosionPrimeEvent;
import cpw.mods.fml.common.eventhandler.Cancelable;
import cpw.mods.fml.common.eventhandler.Event;
import net.minecraft.entity.Entity;
+import net.minecraft.entity.item.*;
import net.minecraft.world.ChunkPosition;
import net.minecraft.world.Explosion;
-import net.minecraft.world.World;
+import net.minecraft.world.*;
+
+import net.minecraftforge.common.util.*;
+
+import com.mojang.authlib.GameProfile;
/** ExplosionEvent triggers when an explosion happens in the world.
*
@@ -23,9 +28,12 @@
{
public final World world;
public final Explosion explosion;
+ public static FakePlayer exploder_fake = null;
+ public static final GameProfile exploder_profile = new GameProfile(null, "[Explosive]");
public ExplosionEvent(World world, Explosion explosion)
{
+ if(exploder_fake == null || !exploder_fake.worldObj.equals(world)) { exploder_fake = FakePlayerFactory.get( (WorldServer) world, exploder_profile); }
this.world = world;
this.explosion = explosion;
}
@@ -39,10 +47,41 @@
@Cancelable
public static class Start extends ExplosionEvent
{
+ private ExplosionPrimeEvent event;
public Start(World world, Explosion explosion)
{
super(world, explosion);
+ // CraftBukkit start
+ // float f = 4.0F;
+ org.bukkit.craftbukkit.CraftServer server = world.getServer();
+ org.bukkit.craftbukkit.entity.CraftEntity ce = null;
+ if(explosion.exploder != null)
+ {
+ ce = org.bukkit.craftbukkit.entity.CraftEntity.getEntity(server, explosion.exploder);
+ }
+ if(ce == null)
+ {
+ ce = org.bukkit.craftbukkit.entity.CraftEntity.getEntity(server, new EntityTNTPrimed(world, explosion.explosionX, explosion.explosionY, explosion.explosionZ, exploder_fake ));
+ }
+ event = new ExplosionPrimeEvent(ce, 8.0F, true);
+ server.getPluginManager().callEvent(event);
+ }
+ @Override
+ public boolean isCanceled()
+ {
+ Entity p_72885_1_ = explosion.exploder;
+ return super.isCanceled() || this.event.isCancelled();
+ }
+ @Override
+ public void setCanceled(boolean cancel)
+ {
+ if (!isCancelable())
+ {
+ throw new IllegalArgumentException("Attempted to cancel a uncancelable event");
+ }
+ super.setCanceled(cancel); this.event.setCancelled(cancel);
}
+
}
/** ExplosionEvent.Detonate is fired once the explosion has a list of affected blocks and entities. These lists can be modified to change the outcome.
@@ -73,4 +112,4 @@
return entityList;
}
}
-}
+}