You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

74 lines
2.8 KiB

--- ../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.<br>
* <br>
@@ -23,6 +28,8 @@
{
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)
{
@@ -39,10 +46,35 @@
@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;
+ if(exploder_fake == null) { exploder_fake = FakePlayerFactory.get( (WorldServer) world, exploder_profile); }
+ org.bukkit.craftbukkit.CraftServer server = world.getServer();
+ org.bukkit.craftbukkit.entity.CraftEntity 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.exploder.posX, explosion.exploder.posY, explosion.exploder.posZ, 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.<br>
@@ -73,4 +105,4 @@
return entityList;
}
}
-}
+}