Package net.minecraft.resource
Class SimpleResourceReload<S>
java.lang.Object
net.minecraft.resource.SimpleResourceReload<S>
- Type Parameters:
S
- the result type for each reloader in the reload
- All Implemented Interfaces:
ResourceReload
- Direct Known Subclasses:
ProfiledResourceReload
public class SimpleResourceReload<S> extends Object implements ResourceReload
A simple implementation of resource reload.
- Mappings:
Namespace Name official adq
intermediary net/minecraft/class_4014
named net/minecraft/resource/SimpleResourceReload
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
SimpleResourceReload.Factory<S>
A factory that creates a completable future for each reloader in the resource reload. -
Field Summary
Fields Modifier and Type Field Description private int
appliedCount
protected CompletableFuture<List<S>>
applyStageFuture
private static int
FIRST_PREPARE_APPLY_WEIGHT
The weight of either prepare or apply stages' progress in the total progress calculation.protected ResourceManager
manager
private AtomicInteger
preparedCount
protected CompletableFuture<Unit>
prepareStageFuture
private static int
RELOADER_WEIGHT
The weight of reloaders' progress in the total progress calculation.private int
reloaderCount
private static int
SECOND_PREPARE_APPLY_WEIGHT
The weight of either prepare or apply stages' progress in the total progress calculation.private int
toApplyCount
private AtomicInteger
toPrepareCount
private Set<ResourceReloader>
waitingReloaders
-
Constructor Summary
Constructors Modifier Constructor Description protected
SimpleResourceReload(Executor prepareExecutor, Executor applyExecutor, ResourceManager manager, List<ResourceReloader> reloaders, SimpleResourceReload.Factory<S> factory, CompletableFuture<Unit> initialStage)
-
Method Summary
Modifier and Type Method Description static SimpleResourceReload<Void>
create(ResourceManager manager, List<ResourceReloader> reloaders, Executor prepareExecutor, Executor applyExecutor, CompletableFuture<Unit> initialStage)
Creates a simple resource reload without additional results.float
getProgress()
Returns a fraction between 0 and 1 indicating the progress of this reload.boolean
isComplete()
Returns if this reload has completed, either normally or abnormally.void
throwException()
Throws an unchecked exception from this reload, if there is any.CompletableFuture<Unit>
whenComplete()
Returns a future for the reload.
-
Field Details
-
FIRST_PREPARE_APPLY_WEIGHT
private static final int FIRST_PREPARE_APPLY_WEIGHTThe weight of either prepare or apply stages' progress in the total progress calculation. Has value 2.- See Also:
- Constant Field Values
- Mappings:
Namespace Name Mixin selector official d
Ladq;d:I
intermediary field_29784
Lnet/minecraft/class_4014;field_29784:I
named FIRST_PREPARE_APPLY_WEIGHT
Lnet/minecraft/resource/SimpleResourceReload;FIRST_PREPARE_APPLY_WEIGHT:I
-
SECOND_PREPARE_APPLY_WEIGHT
private static final int SECOND_PREPARE_APPLY_WEIGHTThe weight of either prepare or apply stages' progress in the total progress calculation. Has value 2.- See Also:
- Constant Field Values
- Mappings:
Namespace Name Mixin selector official e
Ladq;e:I
intermediary field_29785
Lnet/minecraft/class_4014;field_29785:I
named SECOND_PREPARE_APPLY_WEIGHT
Lnet/minecraft/resource/SimpleResourceReload;SECOND_PREPARE_APPLY_WEIGHT:I
-
RELOADER_WEIGHT
private static final int RELOADER_WEIGHTThe weight of reloaders' progress in the total progress calculation. Has value 1.- See Also:
- Constant Field Values
- Mappings:
Namespace Name Mixin selector official f
Ladq;f:I
intermediary field_29786
Lnet/minecraft/class_4014;field_29786:I
named RELOADER_WEIGHT
Lnet/minecraft/resource/SimpleResourceReload;RELOADER_WEIGHT:I
-
manager
- Mappings:
Namespace Name Mixin selector official a
Ladq;a:Ladl;
intermediary field_17927
Lnet/minecraft/class_4014;field_17927:Lnet/minecraft/class_3300;
named manager
Lnet/minecraft/resource/SimpleResourceReload;manager:Lnet/minecraft/resource/ResourceManager;
-
prepareStageFuture
- Mappings:
Namespace Name Mixin selector official b
Ladq;b:Ljava/util/concurrent/CompletableFuture;
intermediary field_18042
Lnet/minecraft/class_4014;field_18042:Ljava/util/concurrent/CompletableFuture;
named prepareStageFuture
Lnet/minecraft/resource/SimpleResourceReload;prepareStageFuture:Ljava/util/concurrent/CompletableFuture;
-
applyStageFuture
- Mappings:
Namespace Name Mixin selector official c
Ladq;c:Ljava/util/concurrent/CompletableFuture;
intermediary field_18043
Lnet/minecraft/class_4014;field_18043:Ljava/util/concurrent/CompletableFuture;
named applyStageFuture
Lnet/minecraft/resource/SimpleResourceReload;applyStageFuture:Ljava/util/concurrent/CompletableFuture;
-
waitingReloaders
- Mappings:
Namespace Name Mixin selector official g
Ladq;g:Ljava/util/Set;
intermediary field_18044
Lnet/minecraft/class_4014;field_18044:Ljava/util/Set;
named waitingReloaders
Lnet/minecraft/resource/SimpleResourceReload;waitingReloaders:Ljava/util/Set;
-
reloaderCount
private final int reloaderCount- Mappings:
Namespace Name Mixin selector official h
Ladq;h:I
intermediary field_18045
Lnet/minecraft/class_4014;field_18045:I
named reloaderCount
Lnet/minecraft/resource/SimpleResourceReload;reloaderCount:I
-
toApplyCount
private int toApplyCount- Mappings:
Namespace Name Mixin selector official i
Ladq;i:I
intermediary field_18046
Lnet/minecraft/class_4014;field_18046:I
named toApplyCount
Lnet/minecraft/resource/SimpleResourceReload;toApplyCount:I
-
appliedCount
private int appliedCount- Mappings:
Namespace Name Mixin selector official j
Ladq;j:I
intermediary field_18047
Lnet/minecraft/class_4014;field_18047:I
named appliedCount
Lnet/minecraft/resource/SimpleResourceReload;appliedCount:I
-
toPrepareCount
- Mappings:
Namespace Name Mixin selector official k
Ladq;k:Ljava/util/concurrent/atomic/AtomicInteger;
intermediary field_18048
Lnet/minecraft/class_4014;field_18048:Ljava/util/concurrent/atomic/AtomicInteger;
named toPrepareCount
Lnet/minecraft/resource/SimpleResourceReload;toPrepareCount:Ljava/util/concurrent/atomic/AtomicInteger;
-
preparedCount
- Mappings:
Namespace Name Mixin selector official l
Ladq;l:Ljava/util/concurrent/atomic/AtomicInteger;
intermediary field_18049
Lnet/minecraft/class_4014;field_18049:Ljava/util/concurrent/atomic/AtomicInteger;
named preparedCount
Lnet/minecraft/resource/SimpleResourceReload;preparedCount:Ljava/util/concurrent/atomic/AtomicInteger;
-
-
Constructor Details
-
SimpleResourceReload
protected SimpleResourceReload(Executor prepareExecutor, Executor applyExecutor, ResourceManager manager, List<ResourceReloader> reloaders, SimpleResourceReload.Factory<S> factory, CompletableFuture<Unit> initialStage)- Mappings:
Namespace Name Mixin selector official <init>
Ladq;<init>(Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ladl;Ljava/util/List;Ladq$a;Ljava/util/concurrent/CompletableFuture;)V
intermediary <init>
Lnet/minecraft/class_4014;<init>(Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Lnet/minecraft/class_3300;Ljava/util/List;Lnet/minecraft/class_4014$class_4047;Ljava/util/concurrent/CompletableFuture;)V
named <init>
Lnet/minecraft/resource/SimpleResourceReload;<init>(Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Lnet/minecraft/resource/ResourceManager;Ljava/util/List;Lnet/minecraft/resource/SimpleResourceReload$Factory;Ljava/util/concurrent/CompletableFuture;)V
-
-
Method Details
-
create
public static SimpleResourceReload<Void> create(ResourceManager manager, List<ResourceReloader> reloaders, Executor prepareExecutor, Executor applyExecutor, CompletableFuture<Unit> initialStage)Creates a simple resource reload without additional results.- Mappings:
Namespace Name Mixin selector official a
Ladq;a(Ladl;Ljava/util/List;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/concurrent/CompletableFuture;)Ladq;
intermediary method_18369
Lnet/minecraft/class_4014;method_18369(Lnet/minecraft/class_3300;Ljava/util/List;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/concurrent/CompletableFuture;)Lnet/minecraft/class_4014;
named create
Lnet/minecraft/resource/SimpleResourceReload;create(Lnet/minecraft/resource/ResourceManager;Ljava/util/List;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/concurrent/CompletableFuture;)Lnet/minecraft/resource/SimpleResourceReload;
-
whenComplete
Returns a future for the reload. The returned future is completed when the reload completes.- Specified by:
whenComplete
in interfaceResourceReload
- Mappings:
Namespace Name Mixin selector official a
Ladi;a()Ljava/util/concurrent/CompletableFuture;
intermediary method_18364
Lnet/minecraft/class_4011;method_18364()Ljava/util/concurrent/CompletableFuture;
named whenComplete
Lnet/minecraft/resource/ResourceReload;whenComplete()Ljava/util/concurrent/CompletableFuture;
-
getProgress
public float getProgress()Returns a fraction between 0 and 1 indicating the progress of this reload.- Specified by:
getProgress
in interfaceResourceReload
- Mappings:
Namespace Name Mixin selector official b
Ladi;b()F
intermediary method_18229
Lnet/minecraft/class_4011;method_18229()F
named getProgress
Lnet/minecraft/resource/ResourceReload;getProgress()F
-
isComplete
public boolean isComplete()Returns if this reload has completed, either normally or abnormally.- Specified by:
isComplete
in interfaceResourceReload
- Mappings:
Namespace Name Mixin selector official c
Ladi;c()Z
intermediary method_18787
Lnet/minecraft/class_4011;method_18787()Z
named isComplete
Lnet/minecraft/resource/ResourceReload;isComplete()Z
-
throwException
public void throwException()Throws an unchecked exception from this reload, if there is any. Does nothing if the reload has not completed or terminated.- Specified by:
throwException
in interfaceResourceReload
- Mappings:
Namespace Name Mixin selector official d
Ladi;d()V
intermediary method_18849
Lnet/minecraft/class_4011;method_18849()V
named throwException
Lnet/minecraft/resource/ResourceReload;throwException()V
-