package net.minecraft.server.packs.resources;

import java.util.concurrent.CompletionStage;
import java.util.function.Function;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import net.minecraft.util.profiling.ProfilerFiller;

public abstract class SimplePreparableReloadListener<T> implements PreparableReloadListener {
    @Override
    public final CompletableFuture<Void> reload(final PreparationBarrier a, final ResourceManager abc, final ProfilerFiller ami3, final ProfilerFiller ami4, final Executor executor5, final Executor executor6) {
        return CompletableFuture.supplyAsync(() -> this.prepare(abc, ami3), executor5).thenCompose(a::wait).thenAcceptAsync(object -> this.apply(object, abc, ami4), executor6);
    }
    
    protected abstract T prepare(final ResourceManager abc, final ProfilerFiller ami);
    
    protected abstract void apply(final T object, final ResourceManager abc, final ProfilerFiller ami);
}
