package net.minecraft.world.level.storage.loot.entries;

import java.util.Objects;
import java.util.function.Consumer;
import net.minecraft.world.level.storage.loot.LootContext;

@FunctionalInterface
interface ComposableEntryContainer {
    public static final ComposableEntryContainer ALWAYS_FALSE = (crx, consumer) -> false;
    public static final ComposableEntryContainer ALWAYS_TRUE = (crx, consumer) -> true;
    
    boolean expand(final LootContext crx, final Consumer<LootPoolEntry> consumer);
    
    default ComposableEntryContainer and(final ComposableEntryContainer csi) {
        Objects.<ComposableEntryContainer>requireNonNull(csi);
        return (crx, consumer) -> this.expand(crx, consumer) && csi.expand(crx, consumer);
    }
    
    default ComposableEntryContainer or(final ComposableEntryContainer csi) {
        Objects.<ComposableEntryContainer>requireNonNull(csi);
        return (crx, consumer) -> this.expand(crx, consumer) || csi.expand(crx, consumer);
    }
}
