Merge remote-tracking branch 'origin/main' into 1.18
This commit is contained in:
commit
6bda05a5fc
|
|
@ -42,10 +42,13 @@ public abstract class TextureAtlasMixin {
|
|||
@Inject(method = "getBasicSpriteInfos", at = @At("HEAD"))
|
||||
private void loadImages(ResourceManager manager, Set<ResourceLocation> imageLocations, CallbackInfoReturnable<Collection<TextureAtlasSprite.Info>> cir) {
|
||||
usingFasterLoad = ModernFixPlatformHooks.isLoadingNormally();
|
||||
}
|
||||
|
||||
@Redirect(method = "getBasicSpriteInfos", at = @At(value = "INVOKE", target = "Ljava/util/Set;iterator()Ljava/util/Iterator;", ordinal = 0))
|
||||
private Iterator<?> skipIteration(Set<?> instance, ResourceManager manager, Set<ResourceLocation> imageLocations) {
|
||||
// bail if Forge is erroring to avoid AT crashes
|
||||
if(!usingFasterLoad) {
|
||||
return;
|
||||
}
|
||||
if(!usingFasterLoad)
|
||||
return instance.iterator();
|
||||
List<CompletableFuture<?>> futures = new ArrayList<>();
|
||||
ConcurrentLinkedQueue<TextureAtlasSprite.Info> results = new ConcurrentLinkedQueue<>();
|
||||
for(ResourceLocation location : imageLocations) {
|
||||
|
|
@ -72,11 +75,7 @@ public abstract class TextureAtlasMixin {
|
|||
}
|
||||
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
|
||||
storedResults = results;
|
||||
}
|
||||
|
||||
@Redirect(method = "getBasicSpriteInfos", at = @At(value = "INVOKE", target = "Ljava/util/Set;iterator()Ljava/util/Iterator;", ordinal = 0))
|
||||
private Iterator<?> skipIteration(Set<?> instance) {
|
||||
return usingFasterLoad ? Collections.emptyIterator() : instance.iterator();
|
||||
return Collections.emptyIterator();
|
||||
}
|
||||
|
||||
@Inject(method = "getBasicSpriteInfos", at = @At("RETURN"))
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user