|
@@ -13,6 +13,7 @@ import me.km.entities.EntityItemProjectile;
|
|
import me.km.events.CommandEvent;
|
|
import me.km.events.CommandEvent;
|
|
import me.km.inventory.ModInventory;
|
|
import me.km.inventory.ModInventory;
|
|
import me.km.permissions.Permissions;
|
|
import me.km.permissions.Permissions;
|
|
|
|
+import me.km.utils.ExplosionUtils;
|
|
import me.km.utils.Location;
|
|
import me.km.utils.Location;
|
|
import net.minecraft.command.ICommandSource;
|
|
import net.minecraft.command.ICommandSource;
|
|
import net.minecraft.entity.Entity;
|
|
import net.minecraft.entity.Entity;
|
|
@@ -601,9 +602,21 @@ public class ScriptEvents {
|
|
}
|
|
}
|
|
|
|
|
|
@SubscribeEvent(receiveCanceled = true, priority = EventPriority.HIGHEST)
|
|
@SubscribeEvent(receiveCanceled = true, priority = EventPriority.HIGHEST)
|
|
- public void onExplosion(ExplosionEvent.Start e) {
|
|
|
|
|
|
+ public void onPreExplosion(ExplosionEvent.Start e) {
|
|
e.setCanceled(true);
|
|
e.setCanceled(true);
|
|
|
|
+ handleEvent(e, "pre_explosion", sc -> {
|
|
|
|
+ sc.setVar("damage_source", e.getExplosion().getDamageSource());
|
|
|
|
+ sc.setVar("location", new Location(e.getWorld(), e.getExplosion().getPosition()));
|
|
|
|
+ }, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @SubscribeEvent
|
|
|
|
+ public void onExplosion(ExplosionEvent.Detonate e) {
|
|
|
|
+ ExplosionUtils.explosion(e.getExplosion(), e.getWorld());
|
|
handleEvent(e, "explosion", sc -> {
|
|
handleEvent(e, "explosion", sc -> {
|
|
|
|
+ sc.setVar("affected_blocks", e.getAffectedBlocks());
|
|
|
|
+ sc.setVar("affected_entities", e.getAffectedEntities());
|
|
|
|
+ sc.setVar("damage_source", e.getExplosion().getDamageSource());
|
|
sc.setVar("location", new Location(e.getWorld(), e.getExplosion().getPosition()));
|
|
sc.setVar("location", new Location(e.getWorld(), e.getExplosion().getPosition()));
|
|
}, null);
|
|
}, null);
|
|
}
|
|
}
|