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 zb, final ProfilerFiller aio3, final ProfilerFiller aio4, final Executor executor5, final Executor executor6) {
        return CompletableFuture.supplyAsync(() -> this.prepare(zb, aio3), executor5).thenCompose(a::wait).thenAcceptAsync(object -> this.apply(object, zb, aio4), executor6);
    }
    
    protected abstract T prepare(final ResourceManager zb, final ProfilerFiller aio);
    
    protected abstract void apply(final T object, final ResourceManager zb, final ProfilerFiller aio);
}
