Files
MCCustomSkinLoader/Common/source/customskinloader/fake/FakeMinecraftProfileTexture.java
ZekerZhayard 4ce00d07b5 Fix crash when the URL of skull profiles is not valid. (#255)
* Fix crash when the URL of skull profiles is not valid.

* Fix crash when the URL of skull profiles is not valid.
2023-06-27 14:02:45 +08:00

46 lines
1.2 KiB
Java

package customskinloader.fake;
import java.io.File;
import java.util.Map;
import java.util.Optional;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import customskinloader.utils.HttpTextureUtil;
import net.minecraft.util.ResourceLocation;
public class FakeMinecraftProfileTexture extends MinecraftProfileTexture {
private HttpTextureUtil.HttpTextureInfo info;
private ResourceLocation resourceLocation;
public FakeMinecraftProfileTexture(String url, Map<String, String> metadata) {
super(url, metadata);
this.info = HttpTextureUtil.toHttpTextureInfo(url);
}
public void setResourceLocation(ResourceLocation resourceLocation) {
this.resourceLocation = resourceLocation;
}
public ResourceLocation getResourceLocation() {
return this.resourceLocation;
}
@Override
public String getUrl() {
return this.info.url;
}
public String getRawUrl() {
return super.getUrl();
}
@Override
public String getHash() {
return this.info.hash == null ? super.getHash() : this.info.hash;
}
public File getCacheFile() {
return this.info.cacheFile;
}
}