public class ResourceReloader<S> extends Object implements ResourceReloadMonitor
Modifier and Type | Class and Description |
---|---|
static interface |
ResourceReloader.Factory<S> |
Modifier and Type | Field and Description |
---|---|
private int |
appliedCount |
private int |
applyingCount |
protected CompletableFuture<List<S>> |
applyStageFuture |
private int |
listenerCount |
protected ResourceManager |
manager |
private AtomicInteger |
preparedCount |
protected CompletableFuture<Unit> |
prepareStageFuture |
private AtomicInteger |
preparingCount |
private Set<ResourceReloadListener> |
waitingListeners |
Modifier | Constructor and Description |
---|---|
protected |
ResourceReloader(Executor prepareExecutor,
Executor applyExecutor,
ResourceManager manager,
List<ResourceReloadListener> listeners,
ResourceReloader.Factory<S> creator,
CompletableFuture<Unit> initialStage) |
Modifier and Type | Method and Description |
---|---|
static ResourceReloader<Void> |
create(ResourceManager manager,
List<ResourceReloadListener> listeners,
Executor prepareExecutor,
Executor applyExecutor,
CompletableFuture<Unit> initialStage) |
float |
getProgress() |
boolean |
isApplyStageComplete() |
boolean |
isPrepareStageComplete() |
void |
throwExceptions() |
CompletableFuture<Unit> |
whenComplete() |
protected final ResourceManager manager
protected final CompletableFuture<Unit> prepareStageFuture
protected final CompletableFuture<List<S>> applyStageFuture
private final Set<ResourceReloadListener> waitingListeners
private final int listenerCount
private int applyingCount
private int appliedCount
private final AtomicInteger preparingCount
private final AtomicInteger preparedCount
protected ResourceReloader(Executor prepareExecutor, Executor applyExecutor, ResourceManager manager, List<ResourceReloadListener> listeners, ResourceReloader.Factory<S> creator, CompletableFuture<Unit> initialStage)
public static ResourceReloader<Void> create(ResourceManager manager, List<ResourceReloadListener> listeners, Executor prepareExecutor, Executor applyExecutor, CompletableFuture<Unit> initialStage)
public CompletableFuture<Unit> whenComplete()
whenComplete
in interface ResourceReloadMonitor
@Environment(value=CLIENT) public float getProgress()
getProgress
in interface ResourceReloadMonitor
@Environment(value=CLIENT) public boolean isPrepareStageComplete()
isPrepareStageComplete
in interface ResourceReloadMonitor
@Environment(value=CLIENT) public boolean isApplyStageComplete()
isApplyStageComplete
in interface ResourceReloadMonitor
@Environment(value=CLIENT) public void throwExceptions()
throwExceptions
in interface ResourceReloadMonitor