mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-18 18:29:16 +00:00
1 parent
a9b2484b3e
commit
1cb4cf40b0
93 files changed
+762
-181
No files matched your search
@@ -0,0 +1,38 @@
|
||||
package customskinloader.fake.texture;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
import customskinloader.fake.FakeSkinBuffer;
|
||||
import net.minecraft.client.renderer.texture.NativeImage;
|
||||
import net.minecraft.client.renderer.texture.SimpleTexture;
|
||||
import net.minecraft.client.renderer.texture.SkinTextureDownloader;
|
||||
import net.minecraft.client.renderer.texture.TextureContents;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
// 24w46a+
|
||||
public class FakeThreadDownloadImageData extends SimpleTexture {
|
||||
private final Path cacheFile;
|
||||
private final String imageUrl;
|
||||
private final boolean legacySkin;
|
||||
private final Runnable processTask;
|
||||
|
||||
public static Object createTexture(Object location, Object cacheFile, Object imageUrl, Object legacySkin, Object processTask) {
|
||||
return new FakeThreadDownloadImageData((ResourceLocation) location, (Path) cacheFile, (String) imageUrl, (boolean) legacySkin, (Runnable) processTask);
|
||||
}
|
||||
|
||||
public FakeThreadDownloadImageData(ResourceLocation location, Path cacheFile, String imageUrl, boolean legacySkin, Runnable processTask) {
|
||||
super(location);
|
||||
this.cacheFile = cacheFile;
|
||||
this.imageUrl = imageUrl;
|
||||
this.legacySkin = legacySkin;
|
||||
this.processTask = processTask;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureContents loadContents(IResourceManager resourceManager) {
|
||||
NativeImage image = FakeSkinBuffer.processLegacySkin(SkinTextureDownloader.lambda$downloadAndRegisterSkin$0(this.cacheFile, this.imageUrl, this.legacySkin), this.processTask, i -> SkinTextureDownloader.processLegacySkin(i, this.imageUrl));
|
||||
this.processTask.run();
|
||||
return new TextureContents(image, null);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user