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"))
|
@Inject(method = "getBasicSpriteInfos", at = @At("HEAD"))
|
||||||
private void loadImages(ResourceManager manager, Set<ResourceLocation> imageLocations, CallbackInfoReturnable<Collection<TextureAtlasSprite.Info>> cir) {
|
private void loadImages(ResourceManager manager, Set<ResourceLocation> imageLocations, CallbackInfoReturnable<Collection<TextureAtlasSprite.Info>> cir) {
|
||||||
usingFasterLoad = ModernFixPlatformHooks.isLoadingNormally();
|
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
|
// bail if Forge is erroring to avoid AT crashes
|
||||||
if(!usingFasterLoad) {
|
if(!usingFasterLoad)
|
||||||
return;
|
return instance.iterator();
|
||||||
}
|
|
||||||
List<CompletableFuture<?>> futures = new ArrayList<>();
|
List<CompletableFuture<?>> futures = new ArrayList<>();
|
||||||
ConcurrentLinkedQueue<TextureAtlasSprite.Info> results = new ConcurrentLinkedQueue<>();
|
ConcurrentLinkedQueue<TextureAtlasSprite.Info> results = new ConcurrentLinkedQueue<>();
|
||||||
for(ResourceLocation location : imageLocations) {
|
for(ResourceLocation location : imageLocations) {
|
||||||
|
|
@ -72,11 +75,7 @@ public abstract class TextureAtlasMixin {
|
||||||
}
|
}
|
||||||
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
|
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
|
||||||
storedResults = results;
|
storedResults = results;
|
||||||
}
|
return Collections.emptyIterator();
|
||||||
|
|
||||||
@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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "getBasicSpriteInfos", at = @At("RETURN"))
|
@Inject(method = "getBasicSpriteInfos", at = @At("RETURN"))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user