2022-12-07 19:38:24 +08:00
|
|
|
package customskinloader.fake;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.util.Map;
|
2023-05-07 16:38:36 +08:00
|
|
|
import java.util.Optional;
|
2022-12-07 19:38:24 +08:00
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-18 11:07:34 +08:00
|
|
|
public String getRawUrl() {
|
|
|
|
|
return super.getUrl();
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-07 19:38:24 +08:00
|
|
|
@Override
|
|
|
|
|
public String getHash() {
|
2023-05-07 16:38:36 +08:00
|
|
|
return this.info.hash == null ? super.getHash() : this.info.hash;
|
2022-12-07 19:38:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public File getCacheFile() {
|
|
|
|
|
return this.info.cacheFile;
|
|
|
|
|
}
|
|
|
|
|
}
|