diff --git a/1.12-mcp940/.gitignore b/1.12-mcp940/.gitignore new file mode 100644 index 0000000..7ef77c4 --- /dev/null +++ b/1.12-mcp940/.gitignore @@ -0,0 +1,3 @@ +/build/ +/src/main/ + diff --git a/1.12-mcp940/build.properties b/1.12-mcp940/build.properties index a2aa268..985cf3a 100644 --- a/1.12-mcp940/build.properties +++ b/1.12-mcp940/build.properties @@ -3,4 +3,4 @@ minecraft_full_versions=1.12 #forge gradle needs forge version forge_mc_version=1.12 forge_version=14.21.1.2387 -mappings_version=snapshot_20170813 \ No newline at end of file +mappings_version=snapshot_20180203 \ No newline at end of file diff --git a/1.12.1-test/.gitignore b/1.12.1-test/.gitignore new file mode 100644 index 0000000..2779e59 --- /dev/null +++ b/1.12.1-test/.gitignore @@ -0,0 +1,2 @@ +/build/ +/src/main/ diff --git a/1.12.1-test/build.properties b/1.12.1-test/build.properties index f45e609..737f8b6 100644 --- a/1.12.1-test/build.properties +++ b/1.12.1-test/build.properties @@ -1,6 +1,6 @@ minecraft_version=1.12.1 -minecraft_full_versions=1.12.1 +minecraft_full_versions=1.12.1,1.12.2 #forge gradle needs forge version -forge_mc_version=1.12.1 -forge_version=14.22.0.2452 -mappings_version=snapshot_20170813 \ No newline at end of file +forge_mc_version=1.12.2 +forge_version=14.23.1.2555 +mappings_version=snapshot_20180203 \ No newline at end of file diff --git a/Common/source/customskinloader/CustomSkinLoader.java b/Common/source/customskinloader/CustomSkinLoader.java index d7e1f31..81767c5 100644 --- a/Common/source/customskinloader/CustomSkinLoader.java +++ b/Common/source/customskinloader/CustomSkinLoader.java @@ -52,6 +52,7 @@ public class CustomSkinLoader { //For User Skin public static Map loadProfile(GameProfile gameProfile){ String username=gameProfile.getName(); + String credential=MinecraftUtil.getCredential(gameProfile); //Fix: http://hopper.minecraft.net/crashes/minecraft/MCX-2773713 if(username==null){ logger.warning("Could not load profile: username is null."); @@ -60,18 +61,18 @@ public class CustomSkinLoader { String tempName=Thread.currentThread().getName(); Thread.currentThread().setName(username);//Change Thread Name UserProfile profile=null; - if(profileCache.isReady(username)){ + if(profileCache.isReady(credential)){ logger.info("Cached profile will be used."); - profile=profileCache.getProfile(username); + profile=profileCache.getProfile(credential); if(profile==null){ - logger.warning("(!Cached Profile is empty!) Expiry:"+profileCache.getExpiry(username)); - if(profileCache.isExpired(username))//force load + logger.warning("(!Cached Profile is empty!) Expiry:"+profileCache.getExpiry(credential)); + if(profileCache.isExpired(credential))//force load profile=loadProfile0(gameProfile); } else - logger.info(profile.toString(profileCache.getExpiry(username))); + logger.info(profile.toString(profileCache.getExpiry(credential))); }else{ - profileCache.setLoading(username, true); + profileCache.setLoading(credential, true); profile=loadProfile0(gameProfile); } Thread.currentThread().setName(tempName); @@ -80,7 +81,9 @@ public class CustomSkinLoader { //Core public static UserProfile loadProfile0(GameProfile gameProfile){ String username=gameProfile.getName(); - profileCache.setLoading(username, true); + String credential=MinecraftUtil.getCredential(gameProfile); + + profileCache.setLoading(credential, true); logger.info("Loading "+username+"'s profile."); if(config.loadlist==null||config.loadlist.isEmpty()){ logger.info("LoadList is Empty."); @@ -115,36 +118,38 @@ public class CustomSkinLoader { } if(!profile0.isEmpty()){ logger.info(username+"'s profile loaded."); - profileCache.updateCache(username, profile0); - profileCache.setLoading(username, false); - logger.info(profile0.toString(profileCache.getExpiry(username))); + profileCache.updateCache(credential, profile0); + profileCache.setLoading(credential, false); + logger.info(profile0.toString(profileCache.getExpiry(credential))); return profile0; } logger.info(username+"'s profile not found in load list."); if(config.enableLocalProfileCache){ - UserProfile profile=profileCache.getLocalProfile(username); + UserProfile profile=profileCache.getLocalProfile(credential); if(profile==null) logger.info(username+"'s LocalProfile not found."); else{ - profileCache.updateCache(username, profile, false); - profileCache.setLoading(username, false); + profileCache.updateCache(credential, profile, false); + profileCache.setLoading(credential, false); logger.info(username+"'s LocalProfile will be used."); - logger.info(profile.toString(profileCache.getExpiry(username))); + logger.info(profile.toString(profileCache.getExpiry(credential))); return profile; } } - profileCache.setLoading(username, false); + profileCache.setLoading(credential, false); return null; } //For Skull public static Map loadProfileFromCache(final GameProfile gameProfile) { String username=gameProfile.getName(); - if(username==null) + String credential=MinecraftUtil.getCredential(gameProfile); + + if(credential==null) return dynamicSkullManager.getTexture(gameProfile); - if(config.enableUpdateSkull?profileCache.isReady(username):profileCache.isExist(username)){ - UserProfile profile=profileCache.getProfile(username); + if(config.enableUpdateSkull?profileCache.isReady(credential):profileCache.isExist(credential)){ + UserProfile profile=profileCache.getProfile(credential); return ModelManager0.fromUserProfile(profile); } //profileCache.setLoading(username, true); diff --git a/Common/source/customskinloader/loader/jsonapi/CustomSkinAPI.java b/Common/source/customskinloader/loader/jsonapi/CustomSkinAPI.java index 2f89059..b47735d 100644 --- a/Common/source/customskinloader/loader/jsonapi/CustomSkinAPI.java +++ b/Common/source/customskinloader/loader/jsonapi/CustomSkinAPI.java @@ -71,9 +71,9 @@ public class CustomSkinAPI implements IJsonAPI { } private class CustomSkinAPIProfile{ public String username; - public Map textures; + public LinkedHashMap textures; - public Map skins; + public LinkedHashMap skins; public String skin; public String cape; diff --git a/Common/source/customskinloader/utils/MinecraftUtil.java b/Common/source/customskinloader/utils/MinecraftUtil.java index baaa7cb..b3fc911 100644 --- a/Common/source/customskinloader/utils/MinecraftUtil.java +++ b/Common/source/customskinloader/utils/MinecraftUtil.java @@ -10,6 +10,7 @@ import java.util.regex.Pattern; import org.apache.commons.lang3.StringUtils; +import com.mojang.authlib.GameProfile; import com.mojang.authlib.minecraft.MinecraftSessionService; import net.minecraft.client.renderer.texture.TextureManager; @@ -121,4 +122,12 @@ public class MinecraftUtil { } return m!=null && m.matches(); } + + public static String getCredential(GameProfile profile) { + if(profile!=null&&profile.hashCode()!=0) + return new StringBuilder(). + append(profile.getName()).append("-").append(profile.getId().toString()).toString(); + else + return null; + } } diff --git a/Forge/.gitignore b/Forge/.gitignore new file mode 100644 index 0000000..4a95481 --- /dev/null +++ b/Forge/.gitignore @@ -0,0 +1,2 @@ +/bin/ +/build/ diff --git a/Forge/build.gradle b/Forge/build.gradle index b472de2..4c72c2d 100644 --- a/Forge/build.gradle +++ b/Forge/build.gradle @@ -13,10 +13,10 @@ buildscript { } apply plugin: 'net.minecraftforge.gradle.forge' -ext.MINECRAFT_VERSION="1.12" -ext.FORGE_VERSION="14.21.1.2387" -ext.MAPPING_VERSION="snapshot_20170813" -ext.MINECRAFT_FULL_VERSIONS="1.8,1.8.8,1.8.9,1.9,1.9.4,1.10,1.10.2,1.11,1.11.2,1.12,1.12.1" +ext.MINECRAFT_VERSION="1.12.2" +ext.FORGE_VERSION="14.23.1.2555" +ext.MAPPING_VERSION="snapshot_20180203" +ext.MINECRAFT_FULL_VERSIONS="1.8,1.8.8,1.8.9,1.9,1.9.4,1.10,1.10.2,1.11,1.11.2,1.12,1.12.1,1.12.2" ext.snapshot = !(rootProject.ext.config.snapshot==""||rootProject.ext.config.snapshot=="0"||rootProject.ext.config.snapshot==0) diff --git a/build.properties b/build.properties index 5a4f072..d2f73f9 100644 --- a/build.properties +++ b/build.properties @@ -1,6 +1,6 @@ name=CustomSkinLoader group=customskinloader -version=14.7 +version=14.8 dev_version= #RELEASE: snapshot=0 -snapshot=0 \ No newline at end of file +snapshot=1 \ No newline at end of file