package team.creative.enhancedvisuals.mixin;

import java.util.List;
import java.util.Set;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

import net.minecraft.world.level.Explosion;
import team.creative.enhancedvisuals.EnhancedVisuals;

@Mixin(Explosion.class)
public class MixinExplosion {
    
    @Inject(at = @At(value = "INVOKE_ASSIGN",
            target = "Lnet/minecraft/world/level/Level;getEntities(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/phys/AABB;)Ljava/util/List;"),
            method = "Lnet/minecraft/world/level/Explosion;explode()V", locals = LocalCapture.CAPTURE_FAILHARD, require = 1)
    private void onDetonate(CallbackInfo ci, Set set, int i, float f2, int k1, int l1, int i2, int i1, int j2, int j1, List list) {
        EnhancedVisuals.EVENTS.explosion((Explosion) (Object) this, list);
    }
}

@@ -50,136 +50,163 @@
 ort 
-java.util.List;%0Aimport java.util.Set;%0A%0Aimport org.spongepowered.asm.mixin.Mixin;%0Aimport org.spongepowered.asm.mixin.injection.At
+net.minecraft.world.entity.Entity;%0Aimport net.minecraft.world.level.Explosion;%0Aimport net.minecraft.world.level.Level;%0Aimport net.minecraft.world.phys.AABB
 ;%0Aim
@@ -242,24 +242,13 @@
 xin.
-injection.Inject
+Mixin
 ;%0Aim
@@ -294,29 +294,10 @@
 ion.
-callback.CallbackInfo
+At
 ;%0Aim
@@ -343,74 +343,16 @@
 ion.
-callback.LocalCapture;%0A%0Aimport net.minecraft.world.level.Explosion
+Redirect
 ;%0Aim
@@ -404,16 +404,40 @@
 suals;%0A%0A
+import java.util.List;%0A%0A
 @Mixin(E
@@ -490,17 +490,14 @@
     
-%0A    @Inj
+@Redir
 ect(
@@ -524,29 +524,10 @@
 VOKE
-_ASSIGN%22,%0A           
+%22,
  tar
@@ -668,20 +668,8 @@
 ;%22),
-%0A           
  met
@@ -729,192 +729,156 @@
 V%22, 
-locals = LocalCapture.CAPTURE_FAILHARD, require = 1)%0A    private void onDetonate(CallbackInfo ci, Set set, int i, float f2, int k1, int l1, int i2, int i1, int j2, int j1, List list) %7B
+require = 1)%0A    private List%3CEntity%3E onDetonate(Level world, Entity causer, AABB box) %7B%0A        List%3CEntity%3E list = world.getEntities(causer, box);
 %0A   
@@ -949,16 +949,37 @@
  list);%0A
+        return list;%0A
     %7D%0A%7D%0A

Fix crash with Lithium