Volver al índice

src/main/java/ar/com/companeros/memory/MemoryQuery.java

package ar.com.companeros.memory;

import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import net.minecraft.core.GlobalPos;

/** Recuperación acotada: filtros vacíos significan cualquier tipo, no toda la memoria. */
public record MemoryQuery(String text, Set<MemoryType> types, GlobalPos near,
        UUID relatedAgent, int limit, int maxChars, long nowGameTime, boolean includeSuperseded) {
    public MemoryQuery {
        Objects.requireNonNull(text, "text"); types = Set.copyOf(types);
        if (text.length() > 512 || limit < 1 || limit > 32 || maxChars < 128 || maxChars > 16384
                || nowGameTime < 0) throw new IllegalArgumentException("Consulta de memoria fuera de límite");
        if (near != null) near = GlobalPos.of(near.dimension(), near.pos().immutable());
    }

    public static MemoryQuery relevant(String text, GlobalPos near, long gameTime) {
        return new MemoryQuery(text, Set.of(), near, null, 8, 6000, gameTime, false);
    }
}