mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-25 11:04:31 +00:00
1 parent
6d44d738a8
commit
adbde5334d
5 files changed
+42
-12
No files matched your search
@@ -1,9 +1,11 @@
|
||||
package customskinloader;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.gson.Gson;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
||||
|
||||
@@ -52,12 +54,28 @@ public class ModelManager {
|
||||
public static Map fromUserProfile(UserProfile profile){
|
||||
Map map=Maps.newHashMap();
|
||||
if(profile.skinUrl!=null)
|
||||
map.put(Type.SKIN, new MinecraftProfileTexture(profile.skinUrl));
|
||||
map.put(Type.SKIN, getProfileTexture(profile.skinUrl));
|
||||
if(profile.capeUrl!=null)
|
||||
map.put(Type.CAPE, new MinecraftProfileTexture(profile.capeUrl));
|
||||
map.put(Type.CAPE, getProfileTexture(profile.capeUrl));
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse url to MinecraftProfileTexture
|
||||
* Fix authlib 21 bug
|
||||
* @param url - textureUrl
|
||||
* @return MinecraftProfileTexture
|
||||
* @since 13.2
|
||||
*/
|
||||
public static MinecraftProfileTexture getProfileTexture(String url){
|
||||
Map hashMap=new HashMap<String,String>();
|
||||
hashMap.put("url", url);
|
||||
Gson gson=new Gson();
|
||||
String json=gson.toJson(hashMap);
|
||||
MinecraftProfileTexture pt=gson.fromJson(json, MinecraftProfileTexture.class);
|
||||
return pt;
|
||||
}
|
||||
|
||||
private static void refreshModels(){
|
||||
models=new ArrayList<String>();
|
||||
models.add("default");
|
||||
|
||||
@@ -136,8 +136,13 @@ public class SkinManager
|
||||
}*/
|
||||
|
||||
//CustomSkinLoader Begin
|
||||
var1.clear();
|
||||
var1.putAll(customskinloader.CustomSkinLoader.loadProfile(p_152790_1_.getName(), var1));
|
||||
if(customskinloader.CustomSkinLoader.config.enable){
|
||||
Map newMap=customskinloader.CustomSkinLoader.loadProfile(profile.getName(), var1);
|
||||
if(!newMap.isEmpty()){
|
||||
var1.clear();
|
||||
var1.putAll(newMap);
|
||||
}
|
||||
}
|
||||
//CustomSkinLoader End
|
||||
|
||||
Minecraft.getMinecraft().func_152344_a(new Runnable()
|
||||
|
||||
@@ -137,8 +137,13 @@ public class SkinManager
|
||||
}*/
|
||||
|
||||
//CustomSkinLoader Begin
|
||||
var1.clear();
|
||||
var1.putAll(customskinloader.CustomSkinLoader.loadProfile(p_152790_1_.getName(), var1));
|
||||
if(customskinloader.CustomSkinLoader.config.enable){
|
||||
Map newMap=customskinloader.CustomSkinLoader.loadProfile(profile.getName(), var1);
|
||||
if(!newMap.isEmpty()){
|
||||
var1.clear();
|
||||
var1.putAll(newMap);
|
||||
}
|
||||
}
|
||||
//CustomSkinLoader End
|
||||
|
||||
Minecraft.getMinecraft().addScheduledTask(new Runnable()
|
||||
|
||||
@@ -8,9 +8,6 @@ import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.minecraft.InsecureTextureException;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
import com.mojang.authlib.minecraft.MinecraftSessionService;
|
||||
|
||||
import customskinloader.CustomSkinLoader;
|
||||
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
@@ -133,7 +130,7 @@ public class SkinManager
|
||||
}*/
|
||||
|
||||
//CustomSkinLoader Begin
|
||||
if(CustomSkinLoader.config.enable){
|
||||
if(customskinloader.CustomSkinLoader.config.enable){
|
||||
Map newMap=customskinloader.CustomSkinLoader.loadProfile(profile.getName(), map);
|
||||
if(!newMap.isEmpty()){
|
||||
map.clear();
|
||||
|
||||
+7
-2
@@ -105,8 +105,13 @@ public class bwn
|
||||
map.putAll(bwn.this.d.getTextures(profile, false));
|
||||
}*/
|
||||
//CustomSkinLoader Begin
|
||||
map.clear();
|
||||
map.putAll(customskinloader.CustomSkinLoader.loadProfile(profile.getName(), map));
|
||||
if(customskinloader.CustomSkinLoader.config.enable){
|
||||
Map newMap=customskinloader.CustomSkinLoader.loadProfile(profile.getName(), map);
|
||||
if(!newMap.isEmpty()){
|
||||
map.clear();
|
||||
map.putAll(newMap);
|
||||
}
|
||||
}
|
||||
//CustomSkinLoader End
|
||||
bcf.z().a(new Runnable() {
|
||||
|
||||
|
||||
Reference in new issue
Block a user