package jesse.keeblarcraft.Callbacks;

import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.util.ActionResult;
import net.minecraft.world.World;

public interface MobSpawnCallback {
    Event<MobSpawnCallback> EVENT = EventFactory.createArrayBacked(MobSpawnCallback.class,
    (listeners) -> (world, mob) -> {
        for (MobSpawnCallback listener : listeners) {
            ActionResult result = listener.interact(world, mob);

            if (result != ActionResult.PASS) {
                return result;
            }
        }

        return ActionResult.PASS;
    });

    ActionResult interact(World world, MobEntity mob);
}
