Refactor SkinManager (#230)

This commit is contained in:
ZekerZhayard authored and GitHub committed 2022-12-07 19:38:24 +08:00
1 parent 63251c9f5e
commit f38a8ddcef
53 files changed
+1063 -562

No files matched your search

+8 -8
View File
@@ -31,7 +31,7 @@ There are the available versions in different environments below:
Forge 1.17.1 ~ latest: ./local-repo/mods/CustomSkinLoader_ForgeActive/${version}
Fabric: ./local-repo/mods/CustomSkinLoader_Fabric/${version}
```
*`${version}` should be repalced with something like `14.14-SNAPSHOT-00` manually*
*`${version}` should be repalced with something like `14.15-SNAPSHOT-00` manually*
1. Create a pom file in the same folder:
- Forge 1.8 ~ 1.16.5: `CustomSkinLoader_ForgeLegacy-${version}.pom`
```xml
@@ -40,7 +40,7 @@ There are the available versions in different environments below:
<modelVersion>4.0.0</modelVersion>
<groupId>mods</groupId>
<artifactId>CustomSkinLoader_ForgeLegacy</artifactId>
<!-- `${version}` should be repalced with something like `14.14-SNAPSHOT-00` manually -->
<!-- `${version}` should be repalced with something like `14.15-SNAPSHOT-00` manually -->
<version>${version}</version>
</project>
```
@@ -51,7 +51,7 @@ There are the available versions in different environments below:
<modelVersion>4.0.0</modelVersion>
<groupId>mods</groupId>
<artifactId>CustomSkinLoader_ForgeActive</artifactId>
<!-- `${version}` should be repalced with something like `14.14-SNAPSHOT-00` manually -->
<!-- `${version}` should be repalced with something like `14.15-SNAPSHOT-00` manually -->
<version>${version}</version>
</project>
```
@@ -62,7 +62,7 @@ There are the available versions in different environments below:
<modelVersion>4.0.0</modelVersion>
<groupId>mods</groupId>
<artifactId>CustomSkinLoader_Fabric</artifactId>
<!-- `${version}` should be repalced with something like `14.14-SNAPSHOT-00` manually -->
<!-- `${version}` should be repalced with something like `14.15-SNAPSHOT-00` manually -->
<version>${version}</version>
</project>
```
@@ -71,7 +71,7 @@ There are the available versions in different environments below:
1. Add below contents to `build.gradle`:
```gradle
dependencies {
deobfCompile "mods:CustomSkinLoader_ForgeLegacy:14.14-SNAPSHOT-00"
deobfCompile "mods:CustomSkinLoader_ForgeLegacy:14.15-SNAPSHOT-00"
}
minecraft {
@@ -88,8 +88,8 @@ There are the available versions in different environments below:
1. Add below contents to `build.gradle`:
```gradle
dependencies {
implementation fg.deobf("mods:CustomSkinLoader_ForgeLegacy:14.14-SNAPSHOT-00") // Only required for MinecraftForge 1.8 ~ 1.16.5
implementation fg.deobf("mods:CustomSkinLoader_ForgeActive:14.14-SNAPSHOT-00") // Only required for MinecraftForge 1.17.1 ~ latest
implementation fg.deobf("mods:CustomSkinLoader_ForgeLegacy:14.15-SNAPSHOT-00") // Only required for MinecraftForge 1.8 ~ 1.16.5
implementation fg.deobf("mods:CustomSkinLoader_ForgeActive:14.15-SNAPSHOT-00") // Only required for MinecraftForge 1.17.1 ~ latest
}
minecraft {
@@ -107,7 +107,7 @@ There are the available versions in different environments below:
1. Add below contents to `build.gradle`:
```gradle
dependencies {
modImplementation "mods:CustomSkinLoader_Fabric:14.14-SNAPSHOT-00"
modImplementation "mods:CustomSkinLoader_Fabric:14.15-SNAPSHOT-00"
}
tasks.runClient {
@@ -235,7 +235,7 @@ public class Config {
profiles.addAll(defaultProfiles);
}
}
profiles.sort(Comparator.comparingInt(ICustomSkinLoaderPlugin.IDefaultProfile::getPriority));
profiles.sort((c1, c2) -> Integer.compare(c1.getPriority(), c2.getPriority()));
List<SkinSiteProfile> loadlist = new ArrayList<>();
for (ICustomSkinLoaderPlugin.IDefaultProfile profile : profiles) {
@@ -21,6 +21,16 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StringUtils;
public class FakeClientPlayer {
/**
* Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinManager.SkinAvailableCallback)}
*/
public static ThreadDownloadImageData putCache(ThreadDownloadImageData threaddownloadimagedata, SkinManager.SkinAvailableCallback skinAvailableCallback, ResourceLocation resourcelocation) {
if (skinAvailableCallback instanceof FakeClientPlayer.LegacyBuffer) {//Cache for client player
textureCache.put(resourcelocation, threaddownloadimagedata);
}
return threaddownloadimagedata;
}
//For Legacy Skin
public static ThreadDownloadImageData getDownloadImageSkin(ResourceLocation resourceLocationIn, String username) {
//CustomSkinLoader.logger.debug("FakeClientPlayer/getDownloadImageSkin "+username);
@@ -0,0 +1,40 @@
package customskinloader.fake;
import java.io.File;
import java.util.Map;
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;
}
@Override
public String getHash() {
return this.info.hash;
}
public File getCacheFile() {
return this.info.cacheFile;
}
}
@@ -4,22 +4,22 @@ import java.awt.image.BufferedImage;
import java.io.File;
import java.util.Iterator;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Maps;
import com.google.common.hash.Hashing;
import com.google.common.collect.Multimap;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import customskinloader.CustomSkinLoader;
import customskinloader.fake.itf.FakeInterfaceManager;
import customskinloader.utils.HttpTextureUtil;
import net.minecraft.client.Minecraft;
import customskinloader.utils.MinecraftUtil;
import net.minecraft.client.renderer.IImageBuffer;
import net.minecraft.client.renderer.texture.SimpleTexture;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.DefaultPlayerSkin;
import net.minecraft.client.resources.SkinManager;
import net.minecraft.client.resources.SkinManager.SkinAvailableCallback;
import net.minecraft.util.ResourceLocation;
public class FakeSkinManager {
@@ -32,59 +32,87 @@ public class FakeSkinManager {
HttpTextureUtil.defaultCacheDir = skinCacheDirectory;
}
public ResourceLocation loadSkin(MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType) {
return this.loadSkin(profileTexture, textureType, null);
}
public ResourceLocation loadSkin(final MinecraftProfileTexture profileTexture, final MinecraftProfileTexture.Type textureType, final SkinManager.SkinAvailableCallback skinAvailableCallback) {
return this.loadSkin(profileTexture, HttpTextureUtil.toHttpTextureInfo(profileTexture.getUrl()), textureType, skinAvailableCallback);
}
private ResourceLocation loadSkin(final MinecraftProfileTexture profileTexture, final HttpTextureUtil.HttpTextureInfo info, final MinecraftProfileTexture.Type textureType, final SkinManager.SkinAvailableCallback skinAvailableCallback) {
final ResourceLocation resourcelocation = new ResourceLocation("skins/" + Hashing.sha1().hashUnencodedChars(info.hash).toString());
if (FakeInterfaceManager.TextureManager_getTexture(this.textureManager, resourcelocation, null) != null) {//Have already loaded
makeCallback(skinAvailableCallback, textureType, resourcelocation, modelCache.getOrDefault(resourcelocation, profileTexture));
} else {
SimpleTexture threaddownloadimagedata = FakeThreadDownloadImageData.createThreadDownloadImageData(info.cacheFile, info.url, DefaultPlayerSkin.getDefaultSkinLegacy(), new BaseBuffer(skinAvailableCallback, textureType, resourcelocation, profileTexture), textureType);
if (skinAvailableCallback instanceof FakeClientPlayer.LegacyBuffer)//Cache for client player
FakeClientPlayer.textureCache.put(resourcelocation, threaddownloadimagedata);
FakeInterfaceManager.TextureManager_loadTexture(this.textureManager, resourcelocation, threaddownloadimagedata);
/**
* Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinAvailableCallback)}
*/
public static ResourceLocation setResourceLocation(ResourceLocation resourceLocation, MinecraftProfileTexture profileTexture) {
if (profileTexture instanceof FakeMinecraftProfileTexture) {
((FakeMinecraftProfileTexture) profileTexture).setResourceLocation(resourceLocation);
}
return resourcelocation;
return resourceLocation;
}
public void loadProfileTextures(final GameProfile profile, final SkinManager.SkinAvailableCallback skinAvailableCallback, final boolean requireSecure) {
CustomSkinLoader.loadProfileTextures(() -> CustomSkinLoader.loadProfileLazily(profile, m -> {
final Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = Maps.newHashMap();
map.putAll(m);
/**
* Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinAvailableCallback)}
* <p>
* {@code skinAvailableCallback.skinAvailable(textureType, resourcelocation, profileTexture);} -> {@code skinAvailableCallback.skinAvailable(textureType, resourcelocation, this.fakeManager.getModelCache(profileTexture, resourcelocation));}
* <p>
*/
public static MinecraftProfileTexture getModelCache(MinecraftProfileTexture profileTexture, FakeSkinManager fakeManager, ResourceLocation location) {
return fakeManager.modelCache.getOrDefault(location, profileTexture);
}
for (MinecraftProfileTexture.Type type : MinecraftProfileTexture.Type.values()) {
MinecraftProfileTexture profileTexture = map.get(type);
if (profileTexture != null) {
HttpTextureUtil.HttpTextureInfo info = HttpTextureUtil.toHttpTextureInfo(profileTexture.getUrl());
FakeThreadDownloadImageData.downloadTexture(info.cacheFile, info.url);
FakeInterfaceManager.Minecraft_addScheduledTask(Minecraft.getMinecraft(), () -> {
CustomSkinLoader.logger.debug("Loading type: " + type);
try {
this.loadSkin(profileTexture, info, type, skinAvailableCallback);
} catch (Throwable t) {
CustomSkinLoader.logger.warning(t);
}
});
/**
* Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinAvailableCallback)}
*/
public static Object[] createThreadDownloadImageData(ImmutableList<Object> list, FakeSkinManager fakeManager, MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType, SkinManager.SkinAvailableCallback skinAvailableCallback) {
Object[] params = list.toArray();
if (profileTexture instanceof FakeMinecraftProfileTexture && params.length > 1) {
FakeMinecraftProfileTexture fakeProfileTexture = (FakeMinecraftProfileTexture) profileTexture;
ResourceLocation resourcelocation = fakeProfileTexture.getResourceLocation();
if (fakeProfileTexture.getResourceLocation() != null) {
params[0] = ((FakeMinecraftProfileTexture) profileTexture).getCacheFile();
if (params[params.length - 2] instanceof Boolean) {
params[params.length - 2] = true;
}
params[params.length - 1] = fakeManager.new BaseBuffer(skinAvailableCallback, textureType, resourcelocation, profileTexture);
}
}
return params;
}
private final static String KEY = "CustomSkinLoaderInfo";
/**
* Invoked from {@link SkinManager#loadProfileTextures(GameProfile, SkinAvailableCallback, boolean)}
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public static void loadProfileTextures(Runnable runnable, GameProfile profile) {
CustomSkinLoader.loadProfileTextures(() -> CustomSkinLoader.loadProfileLazily(profile, m -> {
// This is a hack.
((Multimap) profile.getProperties()).put(KEY, m);
runnable.run();
}));
}
/**
* Invoked from {@link SkinManager#lambda$loadProfileTextures$1(GameProfile, boolean, SkinAvailableCallback)}
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> getUserProfile(MinecraftSessionService sessionService, GameProfile profile, boolean requireSecure) {
// This is a hack.
return (Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>) ((Optional) profile.getProperties().removeAll(KEY).stream().findFirst()).orElse(Maps.newHashMap());
}
/**
* Invoked from {@link SkinManager#lambda$null$0(Map, SkinAvailableCallback)}
*/
public static void loadElytraTexture(SkinManager skinManager, Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map, SkinManager.SkinAvailableCallback skinAvailableCallback) {
for (int i = 2; i < MinecraftProfileTexture.Type.values().length; i++) {
MinecraftProfileTexture.Type type = MinecraftProfileTexture.Type.values()[i];
if (map.containsKey(type)) {
skinManager.loadSkin(map.get(type), type, skinAvailableCallback);
}
}
}
public Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> loadSkinFromCache(GameProfile profile) {
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = CustomSkinLoader.loadProfileFromCache(profile);
for (Iterator<Map.Entry<MinecraftProfileTexture.Type, MinecraftProfileTexture>> it = map.entrySet().iterator(); it.hasNext(); ) {
Map.Entry<MinecraftProfileTexture.Type, MinecraftProfileTexture> entry = it.next();
MinecraftProfileTexture texture = entry.getValue();
if (shouldJudgeType(texture)) {
texture = this.modelCache.get(this.loadSkin(texture, entry.getKey()));
texture = this.modelCache.get(MinecraftUtil.getSkinManager().loadSkin(texture, entry.getKey()));
if (texture == null) { // remove texture if was not loaded before
it.remove();
} else {
@@ -1,101 +0,0 @@
package customskinloader.fake;
import java.io.File;
import java.util.EnumMap;
import java.util.function.Supplier;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import customskinloader.CustomSkinLoader;
import customskinloader.utils.HttpRequestUtil;
import net.minecraft.client.renderer.IImageBuffer;
import net.minecraft.client.renderer.ThreadDownloadImageData;
import net.minecraft.client.renderer.texture.DownloadingTexture;
import net.minecraft.client.renderer.texture.SimpleTexture;
import net.minecraft.util.ResourceLocation;
public class FakeThreadDownloadImageData {
private static IThreadDownloadImageDataBuilder builder;
public static SimpleTexture createThreadDownloadImageData(File cacheFileIn, String imageUrlIn, ResourceLocation textureResourceLocationIn, IImageBuffer imageBufferIn, MinecraftProfileTexture.Type textureTypeIn) {
SimpleTexture texture = null;
if (FakeThreadDownloadImageData.builder == null) {
EnumMap<ThreadDownloadImageDataBuilder, Throwable> throwables = new EnumMap<>(ThreadDownloadImageDataBuilder.class);
for (ThreadDownloadImageDataBuilder builder : ThreadDownloadImageDataBuilder.values()) {
try {
FakeThreadDownloadImageData.builder = builder.get().get();
texture = FakeThreadDownloadImageData.builder.build(cacheFileIn, imageUrlIn, textureResourceLocationIn, imageBufferIn, textureTypeIn);
CustomSkinLoader.logger.info("ThreadDownloadImageData Class: %s", texture.getClass().getName());
break;
} catch (Throwable t) {
throwables.put(builder, t);
}
}
if (texture == null) {
CustomSkinLoader.logger.warning("Unable to get ThreadDownloadImageData Class: ");
throwables.forEach((k, v) -> {
CustomSkinLoader.logger.warning("Caused by: (%s)", k.name());
CustomSkinLoader.logger.warning(v);
});
throw new RuntimeException("Unable to get ThreadDownloadImageData Class!");
}
} else {
texture = builder.build(cacheFileIn, imageUrlIn, textureResourceLocationIn, imageBufferIn, textureTypeIn);
}
return texture;
}
public static void downloadTexture(File cacheFile, String imageUrl) {
HttpRequestUtil.HttpRequest request = new HttpRequestUtil.HttpRequest(imageUrl).setLoadContent(false).setCacheTime(0).setCacheFile(cacheFile);
for (int i = 0; i <= CustomSkinLoader.config.retryTime; i++) {
if (i != 0) {
CustomSkinLoader.logger.debug("Retry to download texture %s (%s)", imageUrl, i);
}
if (HttpRequestUtil.makeHttpRequest(request).success) {
break;
}
}
}
private interface IThreadDownloadImageDataBuilder {
SimpleTexture build(File cacheFile, String imageUrl, ResourceLocation textureResourceLocation, IImageBuffer imageBuffer, MinecraftProfileTexture.Type textureType);
}
private enum ThreadDownloadImageDataBuilder {
// DO NOT replace new IThreadDownloadImageDataBuilder() with lambda.
V1(() -> new IThreadDownloadImageDataBuilder() { // Forge 1.8.x~1.12.x
@Override
public SimpleTexture build(File cacheFile, String imageUrl, ResourceLocation textureResourceLocation, IImageBuffer imageBuffer, MinecraftProfileTexture.Type textureType) {
return new ThreadDownloadImageData(cacheFile, imageUrl, textureResourceLocation, imageBuffer);
}
}),
V2(() -> new IThreadDownloadImageDataBuilder() { // Forge 1.13.x
@Override
public SimpleTexture build(File cacheFile, String imageUrl, ResourceLocation textureResourceLocation, IImageBuffer imageBuffer, MinecraftProfileTexture.Type textureType) {
return new net.minecraft.client.renderer.texture.ThreadDownloadImageData(cacheFile, imageUrl, textureResourceLocation, imageBuffer);
}
}),
V3(() -> new IThreadDownloadImageDataBuilder() { // Forge 1.14.x
@Override
public SimpleTexture build(File cacheFile, String imageUrl, ResourceLocation textureResourceLocation, IImageBuffer imageBuffer, MinecraftProfileTexture.Type textureType) {
return new DownloadingTexture(cacheFile, imageUrl, textureResourceLocation, imageBuffer);
}
}),
V4(() -> new IThreadDownloadImageDataBuilder() { // Forge 1.15.x~1.16.x
@Override
public SimpleTexture build(File cacheFile, String imageUrl, ResourceLocation textureResourceLocation, IImageBuffer imageBuffer, MinecraftProfileTexture.Type textureType) {
return new DownloadingTexture(cacheFile, imageUrl, textureResourceLocation, true, imageBuffer);
}
});
private final Supplier<IThreadDownloadImageDataBuilder> builder;
ThreadDownloadImageDataBuilder(Supplier<IThreadDownloadImageDataBuilder> builder) {
this.builder = builder;
}
public Supplier<IThreadDownloadImageDataBuilder> get() {
return this.builder;
}
}
}
@@ -6,8 +6,6 @@ import java.io.InputStream;
import java.util.Optional;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.Texture;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.IResource;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
@@ -25,18 +23,6 @@ public class FakeInterfaceManager {
return (IResourceManager) ((IFakeMinecraft) minecraft).func_195551_G();
}
public static void Minecraft_addScheduledTask(Minecraft minecraft, Runnable runnable) {
((IFakeMinecraft) minecraft).execute(runnable);
}
public static void TextureManager_loadTexture(TextureManager textureManager, ResourceLocation textureLocation, Object textureObj) {
((IFakeTextureManager.V2) textureManager).func_229263_a_(textureLocation, (Texture) textureObj);
}
public static Texture TextureManager_getTexture(TextureManager textureManager, ResourceLocation textureLocation, Object textureObj) {
return ((IFakeTextureManager.V1) textureManager).getTexture(textureLocation, (Texture) textureObj);
}
public static void ThreadDownloadImageData_resetNewBufferedImage(Object threadDownloadImageData, BufferedImage image) {
((IFakeThreadDownloadImageData) threadDownloadImageData).resetNewBufferedImage(image);
}
@@ -8,9 +8,4 @@ public interface IFakeMinecraft {
default IResourceManager func_195551_G() {
return (IResourceManager) ((Minecraft) this).getResourceManager();
}
// 1.14+
default void execute(Runnable runnable) {
((Minecraft) this).addScheduledTask(runnable);
}
}
@@ -1,28 +0,0 @@
package customskinloader.fake.itf;
import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.client.renderer.texture.Texture;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.util.ResourceLocation;
public interface IFakeTextureManager {
interface V1 {
default boolean func_229263_a_(ResourceLocation textureLocation, Texture textureObj) {
return ((TextureManager) this).loadTexture(textureLocation, (ITextureObject) textureObj);
}
default Texture func_229267_b_(ResourceLocation textureLocation) {
return (Texture) ((TextureManager) this).getTexture(textureLocation);
}
default Texture getTexture(ResourceLocation textureLocation, Texture textureObj) {
return func_229267_b_(textureLocation);
}
}
interface V2 {
default void func_229263_a_(ResourceLocation textureLocation, Texture textureObj) {
((IFakeTextureManager.V1) this).func_229263_a_(textureLocation, textureObj);
}
}
}
@@ -3,11 +3,10 @@ package customskinloader.profile;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import com.google.common.collect.Maps;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
import customskinloader.fake.FakeMinecraftProfileTexture;
import org.apache.commons.lang3.StringUtils;
/**
* Model Manager for 1.8 and higher.
@@ -25,10 +24,10 @@ public class ModelManager0 {
}
private static HashMap<String, Model> models = new HashMap<String, Model>();
private static Type typeElytra = null;
private static MinecraftProfileTexture.Type typeElytra = null;
static {
for (Type type : Type.values()) {
for (MinecraftProfileTexture.Type type : MinecraftProfileTexture.Type.values()) {
if (type.ordinal() == 2)//ELYTRA
typeElytra = type;
}
@@ -76,17 +75,17 @@ public class ModelManager0 {
* @return profile - UserProfile instance
* @since 13.1
*/
public static UserProfile toUserProfile(Map<Type, MinecraftProfileTexture> profile) {
public static UserProfile toUserProfile(Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> profile) {
UserProfile userProfile = new UserProfile();
if (profile == null)
return userProfile;
MinecraftProfileTexture skin = profile.get(Type.SKIN);
MinecraftProfileTexture skin = profile.get(MinecraftProfileTexture.Type.SKIN);
userProfile.skinUrl = skin == null ? null : skin.getUrl();//Avoid NullPointerException
userProfile.model = skin == null ? null : skin.getMetadata("model");
if (StringUtils.isEmpty(userProfile.model))
userProfile.model = "default";
MinecraftProfileTexture cape = profile.get(Type.CAPE);
MinecraftProfileTexture cape = profile.get(MinecraftProfileTexture.Type.CAPE);
userProfile.capeUrl = cape == null ? null : cape.getUrl();
return userProfile;
}
@@ -98,8 +97,8 @@ public class ModelManager0 {
* @return profile - hashMapProfile (HashMap<String,MinecraftProfileTexture>)
* @since 13.1
*/
public static Map<Type, MinecraftProfileTexture> fromUserProfile(UserProfile profile) {
Map<Type, MinecraftProfileTexture> map = Maps.newHashMap();
public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> fromUserProfile(UserProfile profile) {
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = Maps.newHashMap();
if (profile == null)
return map;
if (profile.skinUrl != null) {
@@ -108,10 +107,10 @@ public class ModelManager0 {
metadata = Maps.newHashMap();
metadata.put("model", profile.model);
}
map.put(Type.SKIN, getProfileTexture(profile.skinUrl, metadata));
map.put(MinecraftProfileTexture.Type.SKIN, getProfileTexture(profile.skinUrl, metadata));
}
if (profile.capeUrl != null)
map.put(Type.CAPE, getProfileTexture(profile.capeUrl, null));
map.put(MinecraftProfileTexture.Type.CAPE, getProfileTexture(profile.capeUrl, null));
if (typeElytra != null && profile.elytraUrl != null)
map.put(typeElytra, getProfileTexture(profile.elytraUrl, null));
return map;
@@ -126,6 +125,6 @@ public class ModelManager0 {
* @since 14.5
*/
public static MinecraftProfileTexture getProfileTexture(String url, Map<String, String> metadata) {
return new MinecraftProfileTexture(url, metadata);
return new FakeMinecraftProfileTexture(url, metadata);
}
}
@@ -1,7 +1,6 @@
package customskinloader.utils;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.LinkedList;
@@ -1,27 +1,19 @@
package customskinloader.utils;
import java.io.File;
import java.io.FileReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Field;
import java.net.URL;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.mojang.authlib.GameProfile;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.SkinManager;
import net.minecraft.realms.RealmsSharedConstants;
import org.apache.commons.lang3.StringUtils;
/**
* @author Alexander Xia
@@ -77,7 +69,7 @@ public class MinecraftUtil {
// (domain|ip)(:port)
public static String getServerAddress() {
net.minecraft.client.multiplayer.ServerData data = Minecraft.getMinecraft().getCurrentServerData();
ServerData data = Minecraft.getMinecraft().getCurrentServerData();
if (data == null)//Single Player
return null;
return data.serverIP;
@@ -1,16 +0,0 @@
package net.minecraft.client.renderer.texture;
import java.io.File;
import net.minecraft.client.renderer.IImageBuffer;
import net.minecraft.util.ResourceLocation;
public class DownloadingTexture extends SimpleTexture {
public DownloadingTexture(File cacheFileIn, String imageUrlIn, ResourceLocation textureResourceLocation, IImageBuffer imageBufferIn) {
super(textureResourceLocation);
}
public DownloadingTexture(File cacheFileIn, String imageUrlIn, ResourceLocation textureResourceLocation, boolean legacySkinIn, Runnable processTaskIn) {
super(textureResourceLocation);
}
}
@@ -1,12 +0,0 @@
package net.minecraft.client.renderer.texture;
import java.io.File;
import net.minecraft.client.renderer.IImageBuffer;
import net.minecraft.util.ResourceLocation;
public class ThreadDownloadImageData extends SimpleTexture {
public ThreadDownloadImageData(File cacheFileIn, String imageUrlIn, ResourceLocation textureResourceLocation, IImageBuffer imageBufferIn) {
super(textureResourceLocation);
}
}
+3 -12
View File
@@ -7,19 +7,11 @@ customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeI
getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; method_14486
customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft
func_195551_G ()Lnet/minecraft/resources/IResourceManager; method_1478
customskinloader/fake/itf/IFakeTextureManager$V1 customskinloader/fake/itf/IFakeTextureManager$V1
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Z method_4616
func_229267_b_ (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/Texture; method_4619
getTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Lnet/minecraft/client/renderer/texture/Texture; method_34590
customskinloader/fake/itf/IFakeTextureManager$V2 customskinloader/fake/itf/IFakeTextureManager$V2
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)V method_4616
net/minecraft/client/Minecraft net/minecraft/class_310
gameDir field_1697
addScheduledTask (Ljava/lang/Runnable;)Lcom/google/common/util/concurrent/ListenableFuture; func_152344_a
getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; method_1558
getMinecraft ()Lnet/minecraft/client/Minecraft; method_1551
getResourceManager ()Lnet/minecraft/client/resources/IResourceManager; method_1478
getSessionService ()Lcom/mojang/authlib/minecraft/MinecraftSessionService; method_1495
getSkinManager ()Lnet/minecraft/client/resources/SkinManager; method_1582
getTextureManager ()Lnet/minecraft/client/renderer/texture/TextureManager; method_1531
net/minecraft/client/gui/GuiPlayerTabOverlay net/minecraft/class_355
@@ -35,7 +27,6 @@ net/minecraft/client/renderer/IImageBuffer net/minecraft/class_760
net/minecraft/client/renderer/ThreadDownloadImageData net/minecraft/class_1046
net/minecraft/client/renderer/entity/RenderPlayer net/minecraft/class_1007
net/minecraft/client/renderer/entity/layers/LayerCape net/minecraft/class_972
net/minecraft/client/renderer/texture/DownloadingTexture net/minecraft/class_1046
net/minecraft/client/renderer/texture/ITextureObject net/minecraft/class_1062
net/minecraft/client/renderer/texture/NativeImage net/minecraft/class_1011
func_195699_a (IIIIIIZZ)V method_4304
@@ -47,20 +38,20 @@ net/minecraft/client/renderer/texture/NativeImage net/minecraft/class_1011
func_195714_b ()I method_4323
func_195715_a (IIIII)V method_4326
net/minecraft/client/renderer/texture/SimpleTexture net/minecraft/class_1049
net/minecraft/client/renderer/texture/Texture net/minecraft/class_1044
net/minecraft/client/renderer/texture/TextureManager net/minecraft/class_1060
getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; method_4619
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z method_4616
net/minecraft/client/renderer/texture/ThreadDownloadImageData net/minecraft/class_1046
net/minecraft/client/resources/DefaultPlayerSkin net/minecraft/class_1068
getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; method_4648
getDefaultSkinLegacy ()Lnet/minecraft/util/ResourceLocation; method_4649
net/minecraft/client/resources/IResource net/minecraft/class_3298
getInputStream ()Ljava/io/InputStream; method_14482
net/minecraft/client/resources/IResourceManager net/minecraft/class_3300
getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; method_14486
net/minecraft/client/resources/SkinManager net/minecraft/class_1071
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V method_4652
net/minecraft/client/resources/SkinManager$3 net/minecraft/class_1071$3
field_152801_c field_152801_c
field_152802_d field_152802_d
net/minecraft/client/resources/SkinManager$SkinAvailableCallback net/minecraft/class_1071$class_1072
skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V onSkinTextureAvailable
net/minecraft/resources/IResource net/minecraft/class_3298
+11
View File
@@ -7,7 +7,9 @@ net/minecraft/client/entity/AbstractClientPlayer net/minecraft/class_742
net/minecraft/client/gui/GuiPlayerTabOverlay net/minecraft/class_355
renderPlayerlist (ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V method_1919
renderPlayerlist (Lcom/mojang/blaze3d/matrix/MatrixStack;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V method_1919
net/minecraft/client/gui/spectator/PlayerMenuObject net/minecraft/class_530
net/minecraft/client/model/ModelRenderer net/minecraft/class_630
net/minecraft/client/renderer/IImageBuffer net/minecraft/class_760
net/minecraft/client/renderer/IRenderTypeBuffer net/minecraft/class_4597
net/minecraft/client/renderer/RenderType net/minecraft/class_1921
getEntitySolid (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType; method_23572
@@ -26,10 +28,19 @@ net/minecraft/client/renderer/entity/layers/LayerCape net/minecraft/class_972
net/minecraft/client/renderer/texture/NativeImage net/minecraft/class_1011
net/minecraft/client/renderer/texture/TextureManager net/minecraft/class_1060
net/minecraft/client/resources/SkinManager net/minecraft/class_1071
func_210275_a (Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V method_4653
func_229297_b_ (Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V method_4655
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V method_4652
loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation; method_4651
loadSkinFromCache (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map; method_4654
net/minecraft/client/resources/SkinManager$3 net/minecraft/class_1071$3
run ()V run
net/minecraft/client/resources/SkinManager$3$1 net/minecraft/class_1071$3$1
field_152803_a field_152803_a
field_152804_b field_152804_b
run ()V run
net/minecraft/client/resources/SkinManager$SkinAvailableCallback net/minecraft/class_1071$class_1072
skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V onSkinTextureAvailable
net/minecraft/scoreboard/ScoreObjective net/minecraft/class_266
net/minecraft/scoreboard/Scoreboard net/minecraft/class_269
net/minecraft/util/ResourceLocation net/minecraft/class_2960
+2 -1
View File
@@ -10,7 +10,8 @@
"MixinMinecraft",
"MixinRenderPlayer",
"MixinSkinManager",
"MixinTextureManager",
"MixinSkinManager$V1",
"MixinSkinManager$V2",
"MixinThreadDownloadImageDataV2",
"MixinThreadDownloadImageDataV3"
],
@@ -56,6 +56,8 @@ public class MixinConfigPlugin implements IMixinConfigPlugin {
boolean result = true;
if (mixinClassName.endsWith(".MixinThreadDownloadImageDataV2")) {
result = (this.world_version >= 2205 && this.world_version <= 2722) && ((this.protocol_version >= 554 && this.protocol_version <= 754) || (this.protocol_version >= 801 && this.protocol_version <= 803) || (this.protocol_version >= 0x40000001 && this.protocol_version <= 0x40000022)); // 19w38a ~ 1.17-rc1
} else if (mixinClassName.endsWith(".MixinSkinManager$V2")) {
result = this.world_version >= 2205 && this.protocol_version >= 554; // 19w38a+
} else if (mixinClassName.endsWith(".MixinLayerCape") || mixinClassName.endsWith(".MixinRenderPlayer")) {
result = this.world_version >= 2210 && this.protocol_version >= 558; // 19w41a+
} else if (mixinClassName.endsWith(".MixinThreadDownloadImageDataV3")) {
+3 -12
View File
@@ -7,19 +7,11 @@ customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeI
getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; m_213713_
customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft
func_195551_G ()Lnet/minecraft/resources/IResourceManager; m_91098_
customskinloader/fake/itf/IFakeTextureManager$V1 customskinloader/fake/itf/IFakeTextureManager$V1
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Z func_229263_a_
func_229267_b_ (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/Texture; m_118506_
getTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Lnet/minecraft/client/renderer/texture/Texture; m_174786_
customskinloader/fake/itf/IFakeTextureManager$V2 customskinloader/fake/itf/IFakeTextureManager$V2
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)V m_118495_
net/minecraft/client/Minecraft net/minecraft/client/Minecraft
gameDir f_91069_
addScheduledTask (Ljava/lang/Runnable;)Lcom/google/common/util/concurrent/ListenableFuture; func_152344_a
getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; m_91089_
getMinecraft ()Lnet/minecraft/client/Minecraft; m_91087_
getResourceManager ()Lnet/minecraft/client/resources/IResourceManager; m_91098_
getSessionService ()Lcom/mojang/authlib/minecraft/MinecraftSessionService; m_91108_
getSkinManager ()Lnet/minecraft/client/resources/SkinManager; m_91109_
getTextureManager ()Lnet/minecraft/client/renderer/texture/TextureManager; m_91097_
net/minecraft/client/gui/GuiPlayerTabOverlay net/minecraft/client/gui/components/PlayerTabOverlay
@@ -35,7 +27,6 @@ net/minecraft/client/renderer/IImageBuffer customskinloader/fake/IFakeImageBuffe
net/minecraft/client/renderer/ThreadDownloadImageData net/minecraft/client/renderer/texture/HttpTexture
net/minecraft/client/renderer/entity/RenderPlayer net/minecraft/client/renderer/entity/player/PlayerRenderer
net/minecraft/client/renderer/entity/layers/LayerCape net/minecraft/client/renderer/entity/layers/CapeLayer
net/minecraft/client/renderer/texture/DownloadingTexture net/minecraft/client/renderer/texture/HttpTexture
net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject
net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/NativeImage
func_195699_a (IIIIIIZZ)V m_85025_
@@ -47,20 +38,20 @@ net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/Na
func_195714_b ()I m_85084_
func_195715_a (IIIII)V m_84997_
net/minecraft/client/renderer/texture/SimpleTexture net/minecraft/client/renderer/texture/SimpleTexture
net/minecraft/client/renderer/texture/Texture net/minecraft/client/renderer/texture/AbstractTexture
net/minecraft/client/renderer/texture/TextureManager net/minecraft/client/renderer/texture/TextureManager
getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; func_110581_b
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z func_110579_a
net/minecraft/client/renderer/texture/ThreadDownloadImageData net/minecraft/client/renderer/texture/HttpTexture
net/minecraft/client/resources/DefaultPlayerSkin net/minecraft/client/resources/DefaultPlayerSkin
getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; m_118627_
getDefaultSkinLegacy ()Lnet/minecraft/util/ResourceLocation; m_118626_
net/minecraft/client/resources/IResource net/minecraft/server/packs/resources/Resource
getInputStream ()Ljava/io/InputStream; m_6679_
net/minecraft/client/resources/IResourceManager net/minecraft/server/packs/resources/ResourceManager
getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; m_142591_
net/minecraft/client/resources/SkinManager net/minecraft/client/resources/SkinManager
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V m_118817_
net/minecraft/client/resources/SkinManager$3 net/minecraft/client/resources/SkinManager$3
field_152801_c field_152801_c
field_152802_d field_152802_d
net/minecraft/client/resources/SkinManager$SkinAvailableCallback net/minecraft/client/resources/SkinManager$SkinTextureCallback
skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V m_118856_
net/minecraft/resources/IResource net/minecraft/server/packs/resources/Resource
+75 -27
View File
@@ -5,6 +5,7 @@ var Type = getJavaType('org.objectweb.asm.Type');
var FieldInsnNode = getJavaType('org.objectweb.asm.tree.FieldInsnNode');
var FieldNode = getJavaType('org.objectweb.asm.tree.FieldNode');
var InsnNode = getJavaType('org.objectweb.asm.tree.InsnNode');
var IntInsnNode = getJavaType('org.objectweb.asm.tree.IntInsnNode');
var InvokeDynamicInsnNode = getJavaType('org.objectweb.asm.tree.InvokeDynamicInsnNode');
var MethodInsnNode = getJavaType('org.objectweb.asm.tree.MethodInsnNode');
var TypeInsnNode = getJavaType('org.objectweb.asm.tree.TypeInsnNode');
@@ -55,23 +56,81 @@ function initializeCoreMod() {
}
}
} else if (checkName(mn.name, "m_118828_") && mn.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;)Lnet/minecraft/resources/ResourceLocation;")) {
var first = mn.instructions.getFirst();
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 0));
mn.instructions.insertBefore(first, new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;"));
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 2));
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 3));
mn.instructions.insertBefore(first, new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "customskinloader/fake/FakeSkinManager", "loadSkin", "(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;)Lnet/minecraft/resources/ResourceLocation;", false));
mn.instructions.insertBefore(first, new InsnNode(Opcodes.ARETURN));
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
var node = iterator.next();
if ((node.getOpcode() === Opcodes.INVOKESPECIAL && node.owner.equals("net/minecraft/resources/ResourceLocation") && checkName(node.name, "<init>") && node.desc.equals("(Ljava/lang/String;)V")) // 1.19-
|| (node.getOpcode() === Opcodes.INVOKESTATIC && node.owner.equals("net/minecraft/client/resources/SkinManager") && checkName(node.name, "m_242632_") && node.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Ljava/lang/String;)Lnet/minecraft/resources/ResourceLocation;"))) { // 1.19.1+
mn.instructions.insert(node, node = new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.insert(node, node = new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "setResourceLocation", "(Lnet/minecraft/resources/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Lnet/minecraft/resources/ResourceLocation;", false));
}
if (node.getOpcode() === Opcodes.INVOKEINTERFACE && node.owner.equals("net/minecraft/client/resources/SkinManager$SkinTextureCallback") && checkName(node.name, "onSkinTextureAvailable") && node.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/resources/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V")) {
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 0));
mn.instructions.insertBefore(node, new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;"));
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 5));
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "getModelCache", "(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcustomskinloader/fake/FakeSkinManager;Lnet/minecraft/resources/ResourceLocation;)Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;", false));
}
if (node.getOpcode() === Opcodes.INVOKESPECIAL && (node.owner.equals("net/minecraft/client/renderer/texture/HttpTexture") && checkName(node.name, "<init>") && node.desc.equals("(Ljava/io/File;Ljava/lang/String;Lnet/minecraft/resources/ResourceLocation;ZLjava/lang/Runnable;)V"))) {
var s = "(";
var args = Type.getType(node.desc).getArgumentTypes();
for (var i = 0; i < args.length; i++) {
s = s + "Ljava/lang/Object;";
}
mn.instructions.insertBefore(node, new InsnNode(Opcodes.SWAP));
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;", false));
mn.instructions.insertBefore(node, new InsnNode(Opcodes.SWAP));
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/google/common/collect/ImmutableList", "of", s + ")Lcom/google/common/collect/ImmutableList;", false));
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 0));
mn.instructions.insertBefore(node, new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;"));
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 2));
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 3));
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "createThreadDownloadImageData", "(Lcom/google/common/collect/ImmutableList;Lcustomskinloader/fake/FakeSkinManager;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;)[Ljava/lang/Object;", false));
for (var i = 0; i < args.length; i++) {
mn.instructions.insertBefore(node, new InsnNode(Opcodes.DUP));
mn.instructions.insertBefore(node, new IntInsnNode(Opcodes.BIPUSH, i));
mn.instructions.insertBefore(node, new InsnNode(Opcodes.AALOAD));
if (args[i].getInternalName().equals("Z")) {
mn.instructions.insertBefore(node, new TypeInsnNode(Opcodes.CHECKCAST, "java/lang/Boolean"));
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "java/lang/Boolean", "booleanValue", "()Z", false));
} else {
mn.instructions.insertBefore(node, new TypeInsnNode(Opcodes.CHECKCAST, args[i].getInternalName()));
}
mn.instructions.insertBefore(node, new InsnNode(Opcodes.SWAP));
}
mn.instructions.insertBefore(node, new InsnNode(Opcodes.POP));
}
}
} else if (checkName(mn.name, "m_118817_") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;Z)V")) {
var first = mn.instructions.getFirst();
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 0));
mn.instructions.insertBefore(first, new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;"));
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 2));
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ILOAD, 3));
mn.instructions.insertBefore(first, new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "customskinloader/fake/FakeSkinManager", "loadProfileTextures", "(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;Z)V", false));
mn.instructions.insertBefore(first, new InsnNode(Opcodes.RETURN));
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
var node = iterator.next();
if (node.getOpcode() === Opcodes.INVOKEINTERFACE
&& (node.owner.equals("java/util/concurrent/Executor") // 1.17.1
|| node.owner.equals("java/util/concurrent/ExecutorService")) // 1.18+
&& checkName(node.name, "execute") && node.desc.equals("(Ljava/lang/Runnable;)V")) {
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.insert(node, new InsnNode(Opcodes.POP));
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadProfileTextures", "(Ljava/lang/Runnable;Lcom/mojang/authlib/GameProfile;)V", false));
}
}
} else if (checkName(mn.name, "m_118821_") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$SkinTextureCallback;)V")) {
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
var node = iterator.next();
if (node.getOpcode() === Opcodes.INVOKEINTERFACE && node.owner.equals("com/mojang/authlib/minecraft/MinecraftSessionService") && checkName(node.name, "getTextures") && node.desc.equals("(Lcom/mojang/authlib/GameProfile;Z)Ljava/util/Map;")) {
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "getUserProfile", "(Lcom/mojang/authlib/minecraft/MinecraftSessionService;Lcom/mojang/authlib/GameProfile;Z)Ljava/util/Map;", false));
break;
}
}
} else if (checkName(mn.name, "m_174849_") && mn.desc.equals("(Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;)V")) {
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
var node = iterator.next();
if (node.getOpcode() === Opcodes.INVOKESTATIC && node.owner.equals("com/google/common/collect/ImmutableList") && checkName(node.name, "of") && node.desc.equals("(Ljava/lang/Object;Ljava/lang/Object;)Lcom/google/common/collect/ImmutableList;")) {
mn.instructions.insertBefore(node, new InsnNode(Opcodes.POP2));
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/mojang/authlib/minecraft/MinecraftProfileTexture$Type", "values", "()[Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;"))
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/google/common/collect/ImmutableList", "copyOf", "([Ljava/lang/Object;)Lcom/google/common/collect/ImmutableList;"))
}
}
} else if (checkName(mn.name, "m_118815_") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;)Ljava/util/Map;")) {
var first = mn.instructions.getFirst();
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 0));
@@ -115,17 +174,6 @@ function initializeCoreMod() {
return cn;
}
},
'TextureManagerTransformer': {
'target': {
'type': 'CLASS',
'name': 'net/minecraft/client/renderer/texture/TextureManager'
},
'transformer': function (cn) {
cn.interfaces.add("customskinloader/fake/itf/IFakeTextureManager$V1");
cn.interfaces.add("customskinloader/fake/itf/IFakeTextureManager$V2");
return cn;
}
},
'RenderPlayer_LayerCapeTransformer': {
'target': {
'type': 'CLASS',
+100 -54
View File
@@ -5,11 +5,9 @@ var Type = getJavaType('org.objectweb.asm.Type');
var FieldInsnNode = getJavaType('org.objectweb.asm.tree.FieldInsnNode');
var FieldNode = getJavaType('org.objectweb.asm.tree.FieldNode');
var InsnNode = getJavaType('org.objectweb.asm.tree.InsnNode');
var IntInsnNode = getJavaType('org.objectweb.asm.tree.IntInsnNode');
var InvokeDynamicInsnNode = getJavaType('org.objectweb.asm.tree.InvokeDynamicInsnNode');
var JumpInsnNode = getJavaType('org.objectweb.asm.tree.JumpInsnNode');
var LabelNode = getJavaType('org.objectweb.asm.tree.LabelNode');
var MethodInsnNode = getJavaType('org.objectweb.asm.tree.MethodInsnNode');
var MethodNode = getJavaType('org.objectweb.asm.tree.MethodNode');
var TypeInsnNode = getJavaType('org.objectweb.asm.tree.TypeInsnNode');
var VarInsnNode = getJavaType('org.objectweb.asm.tree.VarInsnNode');
@@ -69,25 +67,108 @@ function initializeCoreMod() {
} else if (checkName(mn.name, "func_152789_a")
&& (mn.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation;") // 1.13.2-
|| mn.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$ISkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation;"))) { // 1.14.2+
var first = mn.instructions.getFirst();
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 0));
mn.instructions.insertBefore(first, new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;"));
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 2));
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 3));
mn.instructions.insertBefore(first, new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "customskinloader/fake/FakeSkinManager", "loadSkin", "(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation;", false));
mn.instructions.insertBefore(first, new InsnNode(Opcodes.ARETURN));
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
var node = iterator.next();
if (node.getOpcode() === Opcodes.INVOKESPECIAL && node.owner.equals("net/minecraft/util/ResourceLocation") && checkName(node.name, "<init>") && node.desc.equals("(Ljava/lang/String;)V")) {
mn.instructions.insert(node, node = new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.insert(node, node = new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "setResourceLocation", "(Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Lnet/minecraft/util/ResourceLocation;", false));
}
if (node.getOpcode() === Opcodes.INVOKEINTERFACE
&& (node.owner.equals("net/minecraft/client/resources/SkinManager$SkinAvailableCallback") // 1.13.2-
|| node.owner.equals("net/minecraft/client/resources/SkinManager$ISkinAvailableCallback")) // 1.14.2+
&& checkName(node.name, "onSkinTextureAvailable") && node.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V")) {
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 0));
mn.instructions.insertBefore(node, new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;"));
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 5));
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "getModelCache", "(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcustomskinloader/fake/FakeSkinManager;Lnet/minecraft/util/ResourceLocation;)Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;", false));
}
if (node.getOpcode() === Opcodes.INVOKESPECIAL
&& (node.owner.equals("net/minecraft/client/renderer/texture/ThreadDownloadImageData") // 1.13.2-
|| node.owner.equals("net/minecraft/client/renderer/texture/DownloadingTexture")) // 1.14.2+
&& checkName(node.name, "<init>")
&& (node.desc.equals("(Ljava/io/File;Ljava/lang/String;Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/IImageBuffer;)V") // 1.14.4-
|| node.desc.equals("(Ljava/io/File;Ljava/lang/String;Lnet/minecraft/util/ResourceLocation;ZLjava/lang/Runnable;)V"))) { // 1.15+
var args = Type.getType(node.desc).getArgumentTypes();
var s = "(";
for (var i = 0; i < args.length; i++) {
s = s + "Ljava/lang/Object;";
}
if (node.desc.contains("Z")) {
mn.instructions.insertBefore(node, new InsnNode(Opcodes.SWAP));
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;", false));
mn.instructions.insertBefore(node, new InsnNode(Opcodes.SWAP));
}
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/google/common/collect/ImmutableList", "of", s + ")Lcom/google/common/collect/ImmutableList;", false));
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 0));
mn.instructions.insertBefore(node, new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;"));
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 2));
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 3));
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "createThreadDownloadImageData", "(Lcom/google/common/collect/ImmutableList;Lcustomskinloader/fake/FakeSkinManager;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)[Ljava/lang/Object;", false));
for (var i = 0; i < args.length; i++) {
mn.instructions.insertBefore(node, new InsnNode(Opcodes.DUP));
mn.instructions.insertBefore(node, new IntInsnNode(Opcodes.BIPUSH, i));
mn.instructions.insertBefore(node, new InsnNode(Opcodes.AALOAD));
if (args[i].getInternalName().equals("Z")) {
mn.instructions.insertBefore(node, new TypeInsnNode(Opcodes.CHECKCAST, "java/lang/Boolean"));
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "java/lang/Boolean", "booleanValue", "()Z", false));
} else {
mn.instructions.insertBefore(node, new TypeInsnNode(Opcodes.CHECKCAST, args[i].getInternalName()));
}
mn.instructions.insertBefore(node, new InsnNode(Opcodes.SWAP));
}
mn.instructions.insertBefore(node, new InsnNode(Opcodes.POP));
}
}
} else if (checkName(mn.name, "func_152790_a")
&& (mn.desc.equals("(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V") // 1.13.2-
|| mn.desc.equals("(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$ISkinAvailableCallback;Z)V"))) { // 1.14.2+
var first = mn.instructions.getFirst();
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 0));
mn.instructions.insertBefore(first, new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;"));
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 2));
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ILOAD, 3));
mn.instructions.insertBefore(first, new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "customskinloader/fake/FakeSkinManager", "loadProfileTextures", "(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V", false));
mn.instructions.insertBefore(first, new InsnNode(Opcodes.RETURN));
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
var node = iterator.next();
if (node.getOpcode() === Opcodes.INVOKEINTERFACE
&& ((node.owner.equals("java/util/concurrent/ExecutorService") && checkName(node.name, "submit") && node.desc.equals("(Ljava/lang/Runnable;)Ljava/util/concurrent/Future;")) // 1.14.4-
|| (node.owner.equals("java/util/concurrent/Executor") && checkName(node.name, "execute") && node.desc.equals("(Ljava/lang/Runnable;)V")))) { // 1.15+
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 1));
if (node.desc.endsWith("V")) {
mn.instructions.insert(node, new InsnNode(Opcodes.POP));
}
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadProfileTextures", "(Ljava/lang/Runnable;Lcom/mojang/authlib/GameProfile;)V", false));
}
}
} else if (((checkName(mn.name, "func_210275_a") || checkName(mn.name, "lambda$loadProfileTextures$1")) // 1.14.4-
|| (checkName(mn.name, "func_229293_a_") || checkName(mn.name, "lambda$loadProfileTextures$4"))) // 1.15+
&& (mn.desc.equals("(Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V") // 1.13.2-
|| mn.desc.equals("(Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$ISkinAvailableCallback;)V"))) { // 1.14.2+
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
var node = iterator.next();
if (node.getOpcode() === Opcodes.INVOKEINTERFACE && node.owner.equals("com/mojang/authlib/minecraft/MinecraftSessionService") && checkName(node.name, "getTextures") && node.desc.equals("(Lcom/mojang/authlib/GameProfile;Z)Ljava/util/Map;")) {
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "getUserProfile", "(Lcom/mojang/authlib/minecraft/MinecraftSessionService;Lcom/mojang/authlib/GameProfile;Z)Ljava/util/Map;", false));
break;
}
}
} else if ((checkName(mn.name, "func_210276_a") || checkName(mn.name, "lambda$null$0"))
&& (mn.desc.equals("(Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V") // 1.13.2-
|| mn.desc.equals("(Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$ISkinAvailableCallback;)V"))) { // 1.14.2 ~ 1.14.4
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
var node = iterator.next();
if (node.getOpcode() === Opcodes.RETURN) {
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 0));
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 2));
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadElytraTexture", "(Lnet/minecraft/client/resources/SkinManager;" + mn.desc.substring(1), false));
}
}
} else if ((checkName(mn.name, "func_229297_b_") || checkName(mn.name, "lambda$null$2")) && mn.desc.equals("(Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$ISkinAvailableCallback;)V")) { // 1.15+
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
var node = iterator.next();
if (node.getOpcode() === Opcodes.INVOKESTATIC && node.owner.equals("com/google/common/collect/ImmutableList") && checkName(node.name, "of") && node.desc.equals("(Ljava/lang/Object;Ljava/lang/Object;)Lcom/google/common/collect/ImmutableList;")) {
mn.instructions.insertBefore(node, new InsnNode(Opcodes.POP2));
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/mojang/authlib/minecraft/MinecraftProfileTexture$Type", "values", "()[Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;"))
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/google/common/collect/ImmutableList", "copyOf", "([Ljava/lang/Object;)Lcom/google/common/collect/ImmutableList;"))
}
}
} else if (checkName(mn.name, "func_152788_a") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;)Ljava/util/Map;")) {
var first = mn.instructions.getFirst();
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 0));
@@ -124,30 +205,6 @@ function initializeCoreMod() {
}
},
// For 1.13+
'AbstractTextureTransformer': {
'target': {
'type': 'CLASS',
'name': 'net/minecraft/client/renderer/texture/AbstractTexture'
},
'transformer': function (cn) {
cn.interfaces.add("net/minecraft/client/renderer/texture/Texture");
return cn;
}
},
'TextureTransformer': {
'target': {
'type': 'CLASS',
'name': 'net/minecraft/client/renderer/texture/Texture'
},
'transformer': function (cn) {
if (cn.access === 0) {
cn.access = Opcodes.ACC_PUBLIC | Opcodes.ACC_INTERFACE | Opcodes.ACC_ABSTRACT;
}
return cn;
}
},
// For 1.14+
'MinecraftTransformer': {
'target': {
@@ -194,17 +251,6 @@ function initializeCoreMod() {
},
// For 1.15+
'TextureManagerTransformer': {
'target': {
'type': 'CLASS',
'name': 'net/minecraft/client/renderer/texture/TextureManager'
},
'transformer': function (cn) {
cn.interfaces.add("customskinloader/fake/itf/IFakeTextureManager$V1");
cn.interfaces.add("customskinloader/fake/itf/IFakeTextureManager$V2");
return cn;
}
},
'DownloadingTextureTransformer': {
'target': {
'type': 'CLASS',
@@ -48,6 +48,10 @@ public class TransformerManager {
return remapper.mapFieldName(owner, name, desc);
}
public static String mapFieldDesc(String desc) {
return remapper.mapDesc(desc);
}
public static String mapMethodName(String owner, String name, String desc) {
return remapper.mapMethodName(owner, name, desc);
}
@@ -64,6 +68,22 @@ public class TransformerManager {
}
}
public static boolean checkFieldName(String owner, String name, String desc, String srgName) {
if (isDevelopmentEnvironment) {
return mapFieldName(owner, srgName, desc).equals(name);
} else {
return mapFieldName(owner, name, desc).equals(srgName);
}
}
public static boolean checkFieldDesc(String desc, String deobfDesc) {
if (isDevelopmentEnvironment) {
return desc.equals(deobfDesc);
} else {
return mapFieldDesc(desc).equals(deobfDesc);
}
}
public static boolean checkMethodName(String owner, String name, String desc, String srgName) {
if (isDevelopmentEnvironment) {
return mapMethodName(owner, srgName, desc).equals(name);
@@ -8,6 +8,7 @@ import customskinloader.forge.transformer.PlayerTabTransformer;
import customskinloader.forge.transformer.SkinManagerTransformer;
import customskinloader.forge.transformer.SpectatorMenuTransformer;
import net.minecraft.launchwrapper.IClassTransformer;
import net.minecraft.launchwrapper.Launch;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Opcodes;
@@ -19,9 +20,6 @@ public class LaunchWrapper implements IClassTransformer {
private static final TransformerManager.IClassTransformer[] CLASS_TRANSFORMERS = {
new FakeInterfacesTransformer.MinecraftTransformer(),
new FakeInterfacesTransformer.ThreadDownloadImageDataTransformer(),
new FakeInterfacesTransformer.AbstractTextureTransformer(),
new FakeInterfacesTransformer.TextureTransformer(),
new FakeInterfacesTransformer.TextureManagerTransformer(),
new FakeInterfacesTransformer.ClientIResourceTransformer(),
new FakeInterfacesTransformer.ClientIResourceManagerTransformer(),
new FakeInterfacesTransformer.IResourceTransformer(),
@@ -32,6 +30,8 @@ public class LaunchWrapper implements IClassTransformer {
new SkinManagerTransformer.LoadSkinTransformer(),
new SkinManagerTransformer.LoadProfileTexturesTransformer(),
new SkinManagerTransformer.LoadSkinFromCacheTransformer(),
new SkinManagerTransformer.Run0Transformer(),
new SkinManagerTransformer.Run1Transformer(),
new PlayerTabTransformer.ScoreObjectiveTransformer(),
new SpectatorMenuTransformer.PlayerMenuObjectTransformer()
};
@@ -64,7 +64,33 @@ public class LaunchWrapper implements IClassTransformer {
cn.methods.addAll(methods);
//Parse Class Node to bytes
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES) {
@Override
protected String getCommonSuperClass(final String type1, final String type2) {
Class<?> c, d;
ClassLoader classLoader = Launch.classLoader;
try {
c = classLoader.loadClass(type1.replace('/', '.'));
d = classLoader.loadClass(type2.replace('/', '.'));
} catch (Exception e) {
throw new RuntimeException(e);
}
if (c.isAssignableFrom(d)) {
return type1;
}
if (d.isAssignableFrom(c)) {
return type2;
}
if (c.isInterface() || d.isInterface()) {
return "java/lang/Object";
} else {
do {
c = c.getSuperclass();
} while (!c.isAssignableFrom(d));
return c.getName().replace('.', '/');
}
}
};
cn.accept(cw);
return cw.toByteArray();
}
@@ -52,36 +52,6 @@ public class FakeInterfacesTransformer {
}
}
@TransformerManager.TransformTarget(
className = "net.minecraft.client.renderer.texture.AbstractTexture"
)
public static class AbstractTextureTransformer implements TransformerManager.IClassTransformer {
@Override
public ClassNode transform(ClassNode cn) {
cn.interfaces.add("net/minecraft/client/renderer/texture/Texture");
return cn;
}
}
@TransformerManager.TransformTarget(
className = "net.minecraft.client.renderer.texture.Texture"
)
public static class TextureTransformer extends FakeInterfacesTransformer.FakeInterfaceTransformer {
}
@TransformerManager.TransformTarget(
className = "net.minecraft.client.renderer.texture.TextureManager"
)
public static class TextureManagerTransformer implements TransformerManager.IClassTransformer {
@Override
public ClassNode transform(ClassNode cn) {
cn.interfaces.add("customskinloader/fake/itf/IFakeTextureManager$V1");
cn.interfaces.add("customskinloader/fake/itf/IFakeTextureManager$V2");
return cn;
}
}
@TransformerManager.TransformTarget(
className = "net.minecraft.client.resources.IResource"
)
@@ -2,6 +2,7 @@ package customskinloader.forge.transformer;
import customskinloader.forge.TransformerManager;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.AbstractInsnNode;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.FieldInsnNode;
@@ -9,6 +10,8 @@ import org.objectweb.asm.tree.FieldNode;
import org.objectweb.asm.tree.FrameNode;
import org.objectweb.asm.tree.InsnList;
import org.objectweb.asm.tree.InsnNode;
import org.objectweb.asm.tree.IntInsnNode;
import org.objectweb.asm.tree.LabelNode;
import org.objectweb.asm.tree.MethodInsnNode;
import org.objectweb.asm.tree.MethodNode;
import org.objectweb.asm.tree.TypeInsnNode;
@@ -53,16 +56,67 @@ public class SkinManagerTransformer {
public static class LoadSkinTransformer implements TransformerManager.IMethodTransformer {
@Override
public MethodNode transform(ClassNode cn, MethodNode mn) {
InsnList il = new InsnList();
il.add(new VarInsnNode(Opcodes.ALOAD, 0));
il.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;"));
il.add(new VarInsnNode(Opcodes.ALOAD, 1));
il.add(new VarInsnNode(Opcodes.ALOAD, 2));
il.add(new VarInsnNode(Opcodes.ALOAD, 3));
il.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "customskinloader/fake/FakeSkinManager", "loadSkin", "(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation;", false));
il.add(new InsnNode(Opcodes.ARETURN));
il.add(new FrameNode(Opcodes.F_SAME, 0, null, 0, null));
mn.instructions.insert(il);
for (AbstractInsnNode ain : mn.instructions.toArray()) {
if (ain.getOpcode() == Opcodes.INVOKESPECIAL) {
MethodInsnNode min = (MethodInsnNode) ain;
if (TransformerManager.checkClassName(min.owner, "net/minecraft/util/ResourceLocation") && TransformerManager.checkMethodName(min.owner, min.name, min.desc, "<init>") && TransformerManager.checkMethodDesc(min.desc, "(Ljava/lang/String;)V")) {
InsnList il = new InsnList();
il.add(new VarInsnNode(Opcodes.ALOAD, 1));
il.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "setResourceLocation", "(Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Lnet/minecraft/util/ResourceLocation;", false));
mn.instructions.insert(min, il);
}
}
if (ain.getOpcode() == Opcodes.INVOKEINTERFACE) {
MethodInsnNode min = (MethodInsnNode) ain;
if (TransformerManager.checkClassName(min.owner, "net/minecraft/client/resources/SkinManager$SkinAvailableCallback") && TransformerManager.checkMethodName(min.owner, min.name, min.desc, "func_180521_a") && TransformerManager.checkMethodDesc(min.desc, "(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V")) {
InsnList il = new InsnList();
il.add(new VarInsnNode(Opcodes.ALOAD, 0));
il.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;"));
il.add(new VarInsnNode(Opcodes.ALOAD, 4));
il.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "getModelCache", "(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcustomskinloader/fake/FakeSkinManager;Lnet/minecraft/util/ResourceLocation;)Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;", false));
mn.instructions.insertBefore(min, il);
}
}
if (ain.getOpcode() == Opcodes.INVOKESPECIAL) {
MethodInsnNode min = (MethodInsnNode) ain;
if (TransformerManager.checkClassName(min.owner, "net/minecraft/client/renderer/ThreadDownloadImageData") && TransformerManager.checkMethodName(min.owner, min.name, min.desc, "<init>") && TransformerManager.checkMethodDesc(min.desc, "(Ljava/io/File;Ljava/lang/String;Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/IImageBuffer;)V")) {
InsnList il0 = new InsnList();
Type[] args = Type.getType(min.desc).getArgumentTypes();
StringBuilder sb = new StringBuilder("(");
for (int i = 0, len = args.length; i < len; i++) {
sb.append("Ljava/lang/Object;");
}
il0.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "com/google/common/collect/ImmutableList", "of", sb.append(")Lcom/google/common/collect/ImmutableList;").toString(), false));
il0.add(new VarInsnNode(Opcodes.ALOAD, 0));
il0.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;"));
il0.add(new VarInsnNode(Opcodes.ALOAD, 1));
il0.add(new VarInsnNode(Opcodes.ALOAD, 2));
il0.add(new VarInsnNode(Opcodes.ALOAD, 3));
il0.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "createThreadDownloadImageData", "(Lcom/google/common/collect/ImmutableList;Lcustomskinloader/fake/FakeSkinManager;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)[Ljava/lang/Object;", false));
for (int i = 0, len = args.length; i < len; i++) {
il0.add(new InsnNode(Opcodes.DUP));
il0.add(new IntInsnNode(Opcodes.BIPUSH, i));
il0.add(new InsnNode(Opcodes.AALOAD));
il0.add(new TypeInsnNode(Opcodes.CHECKCAST, args[i].getInternalName()));
il0.add(new InsnNode(Opcodes.SWAP));
}
il0.add(new InsnNode(Opcodes.POP));
mn.instructions.insertBefore(min, il0);
// This is only for 1.12.2-
InsnList il1 = new InsnList();
il1.add(new VarInsnNode(Opcodes.ALOAD, 3));
il1.add(new VarInsnNode(Opcodes.ALOAD, 4));
il1.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeClientPlayer", "putCache", "(Lnet/minecraft/client/renderer/ThreadDownloadImageData;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/ThreadDownloadImageData;", false));
mn.instructions.insert(min, il1);
}
}
}
return mn;
}
}
@@ -76,16 +130,15 @@ public class SkinManagerTransformer {
public static class LoadProfileTexturesTransformer implements TransformerManager.IMethodTransformer {
@Override
public MethodNode transform(ClassNode cn, MethodNode mn) {
InsnList il = new InsnList();
il.add(new VarInsnNode(Opcodes.ALOAD, 0));
il.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;"));
il.add(new VarInsnNode(Opcodes.ALOAD, 1));
il.add(new VarInsnNode(Opcodes.ALOAD, 2));
il.add(new VarInsnNode(Opcodes.ILOAD, 3));
il.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "customskinloader/fake/FakeSkinManager", "loadProfileTextures", "(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V", false));
il.add(new InsnNode(Opcodes.RETURN));
il.add(new FrameNode(Opcodes.F_SAME, 0, null, 0, null));
mn.instructions.insert(il);
for (AbstractInsnNode ain : mn.instructions.toArray()) {
if (ain.getOpcode() == Opcodes.INVOKEINTERFACE) {
MethodInsnNode min = (MethodInsnNode) ain;
if (TransformerManager.checkClassName(min.owner, "java/util/concurrent/ExecutorService") && TransformerManager.checkMethodName(min.owner, min.name, min.desc, "submit") && TransformerManager.checkMethodDesc(min.desc, "(Ljava/lang/Runnable;)Ljava/util/concurrent/Future;")) {
mn.instructions.insertBefore(min, new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.set(min, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadProfileTextures", "(Ljava/lang/Runnable;Lcom/mojang/authlib/GameProfile;)V", false));
}
}
}
return mn;
}
}
@@ -105,9 +158,88 @@ public class SkinManagerTransformer {
il.add(new VarInsnNode(Opcodes.ALOAD, 1));
il.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "customskinloader/fake/FakeSkinManager", "loadSkinFromCache", "(Lcom/mojang/authlib/GameProfile;)Ljava/util/Map;", false));
il.add(new InsnNode(Opcodes.ARETURN));
il.add(new FrameNode(Opcodes.F_SAME, 0, null, 0, null));
mn.instructions.insert(il);
return mn;
}
}
@TransformerManager.TransformTarget(
className = "net.minecraft.client.resources.SkinManager$3",
methodNameSrg = "run",
methodNames = "run",
desc = "()V"
)
public static class Run0Transformer implements TransformerManager.IMethodTransformer {
@Override
public MethodNode transform(ClassNode cn, MethodNode mn) {
for (AbstractInsnNode ain : mn.instructions.toArray()) {
if (ain.getOpcode() == Opcodes.INVOKEINTERFACE) {
MethodInsnNode min = (MethodInsnNode) ain;
if (TransformerManager.checkClassName(min.owner, "com/mojang/authlib/minecraft/MinecraftSessionService") && TransformerManager.checkMethodName(min.owner, min.name, min.desc, "getTextures") && TransformerManager.checkMethodDesc(min.desc, "(Lcom/mojang/authlib/GameProfile;Z)Ljava/util/Map;")) {
mn.instructions.set(min, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "getUserProfile", "(Lcom/mojang/authlib/minecraft/MinecraftSessionService;Lcom/mojang/authlib/GameProfile;Z)Ljava/util/Map;", false));
break;
}
}
}
return mn;
}
}
@TransformerManager.TransformTarget(
className = "net.minecraft.client.resources.SkinManager$3$1",
methodNameSrg = "run",
methodNames = "run",
desc = "()V"
)
public static class Run1Transformer implements TransformerManager.IMethodTransformer {
@Override
public MethodNode transform(ClassNode cn, MethodNode mn) {
String val$skinAvailableCallback = null;
String this$0 = null;
String val$map = null;
String this$1 = null;
for (FieldNode fn : cn.fields) {
if (val$map == null && TransformerManager.checkFieldDesc(fn.desc, "Ljava/util/Map;")) {
val$map = TransformerManager.mapFieldName(cn.name, fn.name, fn.desc);
} else if (this$1 == null && TransformerManager.checkFieldDesc(fn.desc, "Lnet/minecraft/client/resources/SkinManager$3;")) {
this$1 = TransformerManager.mapFieldName(cn.name, fn.name, fn.desc);
}
}
for (AbstractInsnNode ain : mn.instructions.toArray()) {
if (ain.getOpcode() == Opcodes.GETFIELD) {
FieldInsnNode fin = (FieldInsnNode) ain;
if (TransformerManager.checkClassName(fin.owner, "net/minecraft/client/resources/SkinManager$3")) {
if (TransformerManager.checkFieldDesc(fin.desc, "Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;")) {
val$skinAvailableCallback = TransformerManager.mapFieldName(fin.owner, fin.name, fin.desc);
} else if (TransformerManager.checkFieldDesc(fin.desc, "Lnet/minecraft/client/resources/SkinManager;")) {
this$0 = TransformerManager.mapFieldName(fin.owner, fin.name, fin.desc);
}
}
}
}
if (val$skinAvailableCallback != null && this$0 != null && val$map != null && this$1 != null) {
for (AbstractInsnNode ain : mn.instructions.toArray()) {
if (ain.getOpcode() == Opcodes.RETURN) {
InsnList il = new InsnList();
il.add(new VarInsnNode(Opcodes.ALOAD, 0));
il.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager$3$1", this$1, "Lnet/minecraft/client/resources/SkinManager$3;"));
il.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager$3", this$0, "Lnet/minecraft/client/resources/SkinManager;"));
il.add(new VarInsnNode(Opcodes.ALOAD, 0));
il.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager$3$1", val$map, "Ljava/util/Map;"));
il.add(new VarInsnNode(Opcodes.ALOAD, 0));
il.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager$3$1", this$1, "Lnet/minecraft/client/resources/SkinManager$3;"));
il.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager$3", val$skinAvailableCallback, "Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;"));
il.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadElytraTexture", "(Lnet/minecraft/client/resources/SkinManager;Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V", false));
mn.instructions.insertBefore(ain, il);
}
}
}
return mn;
}
}
}
+3 -12
View File
@@ -7,19 +7,11 @@ customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeI
getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; getResource
customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft
func_195551_G ()Lnet/minecraft/resources/IResourceManager; O
customskinloader/fake/itf/IFakeTextureManager$V1 customskinloader/fake/itf/IFakeTextureManager$V1
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Z func_229263_a_
func_229267_b_ (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/Texture; func_229267_b_
getTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Lnet/minecraft/client/renderer/texture/Texture; getTexture
customskinloader/fake/itf/IFakeTextureManager$V2 customskinloader/fake/itf/IFakeTextureManager$V2
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)V func_229263_a_
net/minecraft/client/Minecraft bib
gameDir w
addScheduledTask (Ljava/lang/Runnable;)Lcom/google/common/util/concurrent/ListenableFuture; a
getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; C
getMinecraft ()Lnet/minecraft/client/Minecraft; z
getResourceManager ()Lnet/minecraft/client/resources/IResourceManager; O
getSessionService ()Lcom/mojang/authlib/minecraft/MinecraftSessionService; X
getSkinManager ()Lnet/minecraft/client/resources/SkinManager; Y
getTextureManager ()Lnet/minecraft/client/renderer/texture/TextureManager; N
net/minecraft/client/gui/GuiPlayerTabOverlay bjq
@@ -35,7 +27,6 @@ net/minecraft/client/renderer/IImageBuffer but
net/minecraft/client/renderer/ThreadDownloadImageData cdh
net/minecraft/client/renderer/entity/RenderPlayer cct
net/minecraft/client/renderer/entity/layers/LayerCape cbr
net/minecraft/client/renderer/texture/DownloadingTexture cdh
net/minecraft/client/renderer/texture/ITextureObject cds
net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/NativeImage
func_195699_a (IIIIIIZZ)V func_195699_a
@@ -47,20 +38,20 @@ net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/Na
func_195714_b ()I func_195714_b
func_195715_a (IIIII)V func_195715_a
net/minecraft/client/renderer/texture/SimpleTexture cdm
net/minecraft/client/renderer/texture/Texture cdf
net/minecraft/client/renderer/texture/TextureManager cdr
getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; b
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z a
net/minecraft/client/renderer/texture/ThreadDownloadImageData cdh
net/minecraft/client/resources/DefaultPlayerSkin cef
getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; a
getDefaultSkinLegacy ()Lnet/minecraft/util/ResourceLocation; a
net/minecraft/client/resources/IResource ceo
getInputStream ()Ljava/io/InputStream; b
net/minecraft/client/resources/IResourceManager cep
getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; a
net/minecraft/client/resources/SkinManager cex
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a
net/minecraft/client/resources/SkinManager$3 cex$3
field_152801_c c
field_152802_d d
net/minecraft/client/resources/SkinManager$SkinAvailableCallback cex$a
skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V a
net/minecraft/resources/IResource ceo
+11
View File
@@ -9,6 +9,8 @@ net/minecraft/client/gui/GuiPlayerTabOverlay bjq
renderPlayerlist (Lcom/mojang/blaze3d/matrix/MatrixStack;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V func_238523_a_
net/minecraft/client/gui/spectator/PlayerMenuObject boo
net/minecraft/client/model/ModelRenderer brs
net/minecraft/client/renderer/IImageBuffer but
net/minecraft/client/renderer/IRenderTypeBuffer net/minecraft/client/renderer/IRenderTypeBuffer
net/minecraft/client/renderer/RenderType net/minecraft/client/renderer/RenderType
getEntitySolid (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType; func_228634_a_
net/minecraft/client/renderer/ThreadDownloadImageData cdh
@@ -26,10 +28,19 @@ net/minecraft/client/renderer/entity/layers/LayerCape cbr
net/minecraft/client/renderer/texture/NativeImage net/minecraft/client/renderer/texture/NativeImage
net/minecraft/client/renderer/texture/TextureManager cdr
net/minecraft/client/resources/SkinManager cex
func_210275_a (Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V func_210275_a
func_229297_b_ (Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V func_229297_b_
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a
loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation; a
loadSkinFromCache (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map; a
net/minecraft/client/resources/SkinManager$3 cex$3
run ()V run
net/minecraft/client/resources/SkinManager$3$1 cex$3$1
field_152803_a a
field_152804_b b
run ()V run
net/minecraft/client/resources/SkinManager$SkinAvailableCallback cex$a
skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V a
net/minecraft/scoreboard/ScoreObjective bhg
net/minecraft/scoreboard/Scoreboard bhk
net/minecraft/util/ResourceLocation nf
@@ -9,7 +9,8 @@
"MixinMinecraft",
"MixinPlayerMenuObject",
"MixinSkinManager",
"MixinTextureManager",
"MixinSkinManager$3",
"MixinSkinManager$3$1",
"MixinThreadDownloadImageDataV1"
],
"refmap": "mixins.customskinloader.refmap.json",
+3 -12
View File
@@ -7,19 +7,11 @@ customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeI
getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; getResource
customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft
func_195551_G ()Lnet/minecraft/resources/IResourceManager; N
customskinloader/fake/itf/IFakeTextureManager$V1 customskinloader/fake/itf/IFakeTextureManager$V1
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Z func_229263_a_
func_229267_b_ (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/Texture; b
getTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Lnet/minecraft/client/renderer/texture/Texture; getTexture
customskinloader/fake/itf/IFakeTextureManager$V2 customskinloader/fake/itf/IFakeTextureManager$V2
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)V a
net/minecraft/client/Minecraft djz
gameDir n
addScheduledTask (Ljava/lang/Runnable;)Lcom/google/common/util/concurrent/ListenableFuture; func_152344_a
getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; E
getMinecraft ()Lnet/minecraft/client/Minecraft; C
getResourceManager ()Lnet/minecraft/client/resources/IResourceManager; N
getSessionService ()Lcom/mojang/authlib/minecraft/MinecraftSessionService; Y
getSkinManager ()Lnet/minecraft/client/resources/SkinManager; Z
getTextureManager ()Lnet/minecraft/client/renderer/texture/TextureManager; M
net/minecraft/client/gui/GuiPlayerTabOverlay dly
@@ -35,7 +27,6 @@ net/minecraft/client/renderer/IImageBuffer net/minecraft/client/renderer/IImageB
net/minecraft/client/renderer/ThreadDownloadImageData ejt
net/minecraft/client/renderer/entity/RenderPlayer ejk
net/minecraft/client/renderer/entity/layers/LayerCape ehu
net/minecraft/client/renderer/texture/DownloadingTexture ejt
net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject
net/minecraft/client/renderer/texture/NativeImage det
func_195699_a (IIIIIIZZ)V a
@@ -47,20 +38,20 @@ net/minecraft/client/renderer/texture/NativeImage det
func_195714_b ()I b
func_195715_a (IIIII)V a
net/minecraft/client/renderer/texture/SimpleTexture ejy
net/minecraft/client/renderer/texture/Texture ejq
net/minecraft/client/renderer/texture/TextureManager ekd
getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; func_110581_b
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z func_110579_a
net/minecraft/client/renderer/texture/ThreadDownloadImageData ejt
net/minecraft/client/resources/DefaultPlayerSkin ekj
getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; a
getDefaultSkinLegacy ()Lnet/minecraft/util/ResourceLocation; a
net/minecraft/client/resources/IResource acg
getInputStream ()Ljava/io/InputStream; b
net/minecraft/client/resources/IResourceManager ach
getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; a
net/minecraft/client/resources/SkinManager eks
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a
net/minecraft/client/resources/SkinManager$3 eks$3
field_152801_c field_152801_c
field_152802_d field_152802_d
net/minecraft/client/resources/SkinManager$SkinAvailableCallback eks$a
skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V onSkinTextureAvailable
net/minecraft/resources/IResource acg
+11
View File
@@ -7,7 +7,9 @@ net/minecraft/client/entity/AbstractClientPlayer dzj
net/minecraft/client/gui/GuiPlayerTabOverlay dly
renderPlayerlist (ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V func_175249_a
renderPlayerlist (Lcom/mojang/blaze3d/matrix/MatrixStack;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V a
net/minecraft/client/gui/spectator/PlayerMenuObject ehx
net/minecraft/client/model/ModelRenderer dwn
net/minecraft/client/renderer/IImageBuffer net/minecraft/client/renderer/IImageBuffer
net/minecraft/client/renderer/IRenderTypeBuffer eag
net/minecraft/client/renderer/RenderType eao
getEntitySolid (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType; b
@@ -26,10 +28,19 @@ net/minecraft/client/renderer/entity/layers/LayerCape ehu
net/minecraft/client/renderer/texture/NativeImage det
net/minecraft/client/renderer/texture/TextureManager ekd
net/minecraft/client/resources/SkinManager eks
func_210275_a (Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V a
func_229297_b_ (Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V b
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a
loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation; a
loadSkinFromCache (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map; a
net/minecraft/client/resources/SkinManager$3 eks$3
run ()V run
net/minecraft/client/resources/SkinManager$3$1 eks$3$1
field_152803_a field_152803_a
field_152804_b field_152804_b
run ()V run
net/minecraft/client/resources/SkinManager$SkinAvailableCallback eks$a
skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V onSkinTextureAvailable
net/minecraft/scoreboard/ScoreObjective ddk
net/minecraft/scoreboard/Scoreboard ddn
net/minecraft/util/ResourceLocation vk
@@ -10,7 +10,8 @@
"MixinMinecraft",
"MixinRenderPlayer",
"MixinSkinManager",
"MixinTextureManager",
"MixinSkinManager$V1",
"MixinSkinManager$V2",
"MixinThreadDownloadImageDataV2"
],
"refmap": "mixins.customskinloader.refmap.json",
+3 -12
View File
@@ -7,19 +7,11 @@ customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeI
getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; getResource
customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft
func_195551_G ()Lnet/minecraft/resources/IResourceManager; N
customskinloader/fake/itf/IFakeTextureManager$V1 customskinloader/fake/itf/IFakeTextureManager$V1
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Z func_229263_a_
func_229267_b_ (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/Texture; b
getTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Lnet/minecraft/client/renderer/texture/Texture; b
customskinloader/fake/itf/IFakeTextureManager$V2 customskinloader/fake/itf/IFakeTextureManager$V2
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)V a
net/minecraft/client/Minecraft dyr
gameDir o
addScheduledTask (Ljava/lang/Runnable;)Lcom/google/common/util/concurrent/ListenableFuture; func_152344_a
getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; F
getMinecraft ()Lnet/minecraft/client/Minecraft; D
getResourceManager ()Lnet/minecraft/client/resources/IResourceManager; N
getSessionService ()Lcom/mojang/authlib/minecraft/MinecraftSessionService; X
getSkinManager ()Lnet/minecraft/client/resources/SkinManager; Y
getTextureManager ()Lnet/minecraft/client/renderer/texture/TextureManager; M
net/minecraft/client/gui/GuiPlayerTabOverlay eau
@@ -35,7 +27,6 @@ net/minecraft/client/renderer/IImageBuffer net/minecraft/client/renderer/IImageB
net/minecraft/client/renderer/ThreadDownloadImageData fap
net/minecraft/client/renderer/entity/RenderPlayer faf
net/minecraft/client/renderer/entity/layers/LayerCape eyo
net/minecraft/client/renderer/texture/DownloadingTexture fap
net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject
net/minecraft/client/renderer/texture/NativeImage dsn
func_195699_a (IIIIIIZZ)V a
@@ -47,20 +38,20 @@ net/minecraft/client/renderer/texture/NativeImage dsn
func_195714_b ()I b
func_195715_a (IIIII)V a
net/minecraft/client/renderer/texture/SimpleTexture fau
net/minecraft/client/renderer/texture/Texture fam
net/minecraft/client/renderer/texture/TextureManager faz
getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; func_110581_b
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z func_110579_a
net/minecraft/client/renderer/texture/ThreadDownloadImageData fap
net/minecraft/client/resources/DefaultPlayerSkin fbf
getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; a
getDefaultSkinLegacy ()Lnet/minecraft/util/ResourceLocation; a
net/minecraft/client/resources/IResource afz
getInputStream ()Ljava/io/InputStream; b
net/minecraft/client/resources/IResourceManager aga
getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; getResource
net/minecraft/client/resources/SkinManager fbo
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a
net/minecraft/client/resources/SkinManager$3 fbo$3
field_152801_c field_152801_c
field_152802_d field_152802_d
net/minecraft/client/resources/SkinManager$SkinAvailableCallback fbo$a
skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V onSkinTextureAvailable
net/minecraft/resources/IResource afz
+11
View File
@@ -7,7 +7,9 @@ net/minecraft/client/entity/AbstractClientPlayer ept
net/minecraft/client/gui/GuiPlayerTabOverlay eau
renderPlayerlist (ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V func_175249_a
renderPlayerlist (Lcom/mojang/blaze3d/matrix/MatrixStack;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V a
net/minecraft/client/gui/spectator/PlayerMenuObject ehx
net/minecraft/client/model/ModelRenderer emb
net/minecraft/client/renderer/IImageBuffer net/minecraft/client/renderer/IImageBuffer
net/minecraft/client/renderer/IRenderTypeBuffer eqs
net/minecraft/client/renderer/RenderType era
getEntitySolid (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType; b
@@ -26,10 +28,19 @@ net/minecraft/client/renderer/entity/layers/LayerCape eyo
net/minecraft/client/renderer/texture/NativeImage dsn
net/minecraft/client/renderer/texture/TextureManager faz
net/minecraft/client/resources/SkinManager fbo
func_210275_a (Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V a
func_229297_b_ (Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V b
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a
loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation; a
loadSkinFromCache (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map; a
net/minecraft/client/resources/SkinManager$3 fbo$3
run ()V run
net/minecraft/client/resources/SkinManager$3$1 fbo$3$1
field_152803_a field_152803_a
field_152804_b field_152804_b
run ()V run
net/minecraft/client/resources/SkinManager$SkinAvailableCallback fbo$a
skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V onSkinTextureAvailable
net/minecraft/scoreboard/ScoreObjective dqj
net/minecraft/scoreboard/Scoreboard dqm
net/minecraft/util/ResourceLocation yt
@@ -10,7 +10,8 @@
"MixinMinecraft",
"MixinRenderPlayer",
"MixinSkinManager",
"MixinTextureManager",
"MixinSkinManager$V1",
"MixinSkinManager$V2",
"MixinThreadDownloadImageDataV3"
],
"refmap": "mixins.customskinloader.refmap.json",
+3 -12
View File
@@ -7,19 +7,11 @@ customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeI
getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; getResource
customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft
func_195551_G ()Lnet/minecraft/resources/IResourceManager; S
customskinloader/fake/itf/IFakeTextureManager$V1 customskinloader/fake/itf/IFakeTextureManager$V1
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Z func_229263_a_
func_229267_b_ (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/Texture; b
getTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Lnet/minecraft/client/renderer/texture/Texture; b
customskinloader/fake/itf/IFakeTextureManager$V2 customskinloader/fake/itf/IFakeTextureManager$V2
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)V a
net/minecraft/client/Minecraft efu
gameDir p
addScheduledTask (Ljava/lang/Runnable;)Lcom/google/common/util/concurrent/ListenableFuture; func_152344_a
getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; K
getMinecraft ()Lnet/minecraft/client/Minecraft; I
getResourceManager ()Lnet/minecraft/client/resources/IResourceManager; S
getSessionService ()Lcom/mojang/authlib/minecraft/MinecraftSessionService; ac
getSkinManager ()Lnet/minecraft/client/resources/SkinManager; ad
getTextureManager ()Lnet/minecraft/client/renderer/texture/TextureManager; R
net/minecraft/client/gui/GuiPlayerTabOverlay eii
@@ -35,7 +27,6 @@ net/minecraft/client/renderer/IImageBuffer net/minecraft/client/renderer/IImageB
net/minecraft/client/renderer/ThreadDownloadImageData fjv
net/minecraft/client/renderer/entity/RenderPlayer fjk
net/minecraft/client/renderer/entity/layers/LayerCape fhs
net/minecraft/client/renderer/texture/DownloadingTexture fjv
net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject
net/minecraft/client/renderer/texture/NativeImage dzq
func_195699_a (IIIIIIZZ)V a
@@ -47,20 +38,20 @@ net/minecraft/client/renderer/texture/NativeImage dzq
func_195714_b ()I b
func_195715_a (IIIII)V a
net/minecraft/client/renderer/texture/SimpleTexture fka
net/minecraft/client/renderer/texture/Texture fjs
net/minecraft/client/renderer/texture/TextureManager fkf
getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; func_110581_b
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z func_110579_a
net/minecraft/client/renderer/texture/ThreadDownloadImageData fjv
net/minecraft/client/resources/DefaultPlayerSkin fkl
getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; a
getDefaultSkinLegacy ()Lnet/minecraft/util/ResourceLocation; a
net/minecraft/client/resources/IResource aik
getInputStream ()Ljava/io/InputStream; b
net/minecraft/client/resources/IResourceManager aim
getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; getResource
net/minecraft/client/resources/SkinManager fku
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a
net/minecraft/client/resources/SkinManager$3 fku$3
field_152801_c field_152801_c
field_152802_d field_152802_d
net/minecraft/client/resources/SkinManager$SkinAvailableCallback fku$a
skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V onSkinTextureAvailable
net/minecraft/resources/IResource aik
+11
View File
@@ -7,7 +7,9 @@ net/minecraft/client/entity/AbstractClientPlayer eyt
net/minecraft/client/gui/GuiPlayerTabOverlay eii
renderPlayerlist (ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V func_175249_a
renderPlayerlist (Lcom/mojang/blaze3d/matrix/MatrixStack;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V a
net/minecraft/client/gui/spectator/PlayerMenuObject epw
net/minecraft/client/model/ModelRenderer eue
net/minecraft/client/renderer/IImageBuffer net/minecraft/client/renderer/IImageBuffer
net/minecraft/client/renderer/IRenderTypeBuffer ezs
net/minecraft/client/renderer/RenderType faa
getEntitySolid (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType; b
@@ -26,10 +28,19 @@ net/minecraft/client/renderer/entity/layers/LayerCape fhs
net/minecraft/client/renderer/texture/NativeImage dzq
net/minecraft/client/renderer/texture/TextureManager fkf
net/minecraft/client/resources/SkinManager fku
func_210275_a (Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V a
func_229297_b_ (Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V b
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a
loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation; a
loadSkinFromCache (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map; a
net/minecraft/client/resources/SkinManager$3 fku$3
run ()V run
net/minecraft/client/resources/SkinManager$3$1 fku$3$1
field_152803_a field_152803_a
field_152804_b field_152804_b
run ()V run
net/minecraft/client/resources/SkinManager$SkinAvailableCallback fku$a
skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V onSkinTextureAvailable
net/minecraft/scoreboard/ScoreObjective dxl
net/minecraft/scoreboard/Scoreboard dxo
net/minecraft/util/ResourceLocation abb
@@ -10,7 +10,8 @@
"MixinMinecraft",
"MixinRenderPlayer",
"MixinSkinManager",
"MixinTextureManager",
"MixinSkinManager$V1",
"MixinSkinManager$V2",
"MixinThreadDownloadImageDataV3"
],
"refmap": "mixins.customskinloader.refmap.json",
+3 -12
View File
@@ -7,19 +7,11 @@ customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeI
getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; getResource
customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft
func_195551_G ()Lnet/minecraft/resources/IResourceManager; Q
customskinloader/fake/itf/IFakeTextureManager$V1 customskinloader/fake/itf/IFakeTextureManager$V1
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Z func_229263_a_
func_229267_b_ (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/Texture; func_229267_b_
getTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Lnet/minecraft/client/renderer/texture/Texture; getTexture
customskinloader/fake/itf/IFakeTextureManager$V2 customskinloader/fake/itf/IFakeTextureManager$V2
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)V func_229263_a_
net/minecraft/client/Minecraft ave
gameDir v
addScheduledTask (Ljava/lang/Runnable;)Lcom/google/common/util/concurrent/ListenableFuture; a
getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; D
getMinecraft ()Lnet/minecraft/client/Minecraft; A
getResourceManager ()Lnet/minecraft/client/resources/IResourceManager; Q
getSessionService ()Lcom/mojang/authlib/minecraft/MinecraftSessionService; aa
getSkinManager ()Lnet/minecraft/client/resources/SkinManager; ab
getTextureManager ()Lnet/minecraft/client/renderer/texture/TextureManager; P
net/minecraft/client/gui/GuiPlayerTabOverlay awh
@@ -35,7 +27,6 @@ net/minecraft/client/renderer/IImageBuffer bfm
net/minecraft/client/renderer/ThreadDownloadImageData bma
net/minecraft/client/renderer/entity/RenderPlayer bln
net/minecraft/client/renderer/entity/layers/LayerCape bkp
net/minecraft/client/renderer/texture/DownloadingTexture bma
net/minecraft/client/renderer/texture/ITextureObject bmk
net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/NativeImage
func_195699_a (IIIIIIZZ)V func_195699_a
@@ -47,20 +38,20 @@ net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/Na
func_195714_b ()I func_195714_b
func_195715_a (IIIII)V func_195715_a
net/minecraft/client/renderer/texture/SimpleTexture bme
net/minecraft/client/renderer/texture/Texture bly
net/minecraft/client/renderer/texture/TextureManager bmj
getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; b
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z a
net/minecraft/client/renderer/texture/ThreadDownloadImageData bma
net/minecraft/client/resources/DefaultPlayerSkin bmz
getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; a
getDefaultSkinLegacy ()Lnet/minecraft/util/ResourceLocation; a
net/minecraft/client/resources/IResource bnh
getInputStream ()Ljava/io/InputStream; b
net/minecraft/client/resources/IResourceManager bni
getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; a
net/minecraft/client/resources/SkinManager bnp
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a
net/minecraft/client/resources/SkinManager$3 bnp$3
field_152801_c c
field_152802_d d
net/minecraft/client/resources/SkinManager$SkinAvailableCallback bnp$a
skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V a
net/minecraft/resources/IResource bnh
+11
View File
@@ -9,6 +9,8 @@ net/minecraft/client/gui/GuiPlayerTabOverlay awh
renderPlayerlist (Lcom/mojang/blaze3d/matrix/MatrixStack;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V func_238523_a_
net/minecraft/client/gui/spectator/PlayerMenuObject bad
net/minecraft/client/model/ModelRenderer bct
net/minecraft/client/renderer/IImageBuffer bfm
net/minecraft/client/renderer/IRenderTypeBuffer net/minecraft/client/renderer/IRenderTypeBuffer
net/minecraft/client/renderer/RenderType net/minecraft/client/renderer/RenderType
getEntitySolid (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType; func_228634_a_
net/minecraft/client/renderer/ThreadDownloadImageData bma
@@ -26,10 +28,19 @@ net/minecraft/client/renderer/entity/layers/LayerCape bkp
net/minecraft/client/renderer/texture/NativeImage net/minecraft/client/renderer/texture/NativeImage
net/minecraft/client/renderer/texture/TextureManager bmj
net/minecraft/client/resources/SkinManager bnp
func_210275_a (Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V func_210275_a
func_229297_b_ (Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V func_229297_b_
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a
loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation; a
loadSkinFromCache (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map; a
net/minecraft/client/resources/SkinManager$3 bnp$3
run ()V run
net/minecraft/client/resources/SkinManager$3$1 bnp$3$1
field_152803_a a
field_152804_b b
run ()V run
net/minecraft/client/resources/SkinManager$SkinAvailableCallback bnp$a
skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V a
net/minecraft/scoreboard/ScoreObjective auk
net/minecraft/scoreboard/Scoreboard auo
net/minecraft/util/ResourceLocation jy
@@ -9,7 +9,8 @@
"MixinMinecraft",
"MixinPlayerMenuObject",
"MixinSkinManager",
"MixinTextureManager",
"MixinSkinManager$3",
"MixinSkinManager$3$1",
"MixinThreadDownloadImageDataV1"
],
"refmap": "mixins.customskinloader.refmap.json",
+25 -25
View File
@@ -35,57 +35,57 @@
{
"downloads": {
"artifact": {
"path": "org/ow2/asm/asm/9.3/asm-9.3.jar",
"sha1": "8e6300ef51c1d801a7ed62d07cd221aca3a90640",
"size": 122176,
"url": "https://repo1.maven.org/maven2/org/ow2/asm/asm/9.3/asm-9.3.jar"
"path": "org/ow2/asm/asm/9.4/asm-9.4.jar",
"sha1": "b4e0e2d2e023aa317b7cfcfc916377ea348e07d1",
"size": 122445,
"url": "https://repo1.maven.org/maven2/org/ow2/asm/asm/9.4/asm-9.4.jar"
}
},
"name": "org.ow2.asm:asm:9.3"
"name": "org.ow2.asm:asm:9.4"
},
{
"downloads": {
"artifact": {
"path": "org/ow2/asm/asm-analysis/9.3/asm-analysis-9.3.jar",
"sha1": "4b071f211b37c38e0e9f5998550197c8593f6ad8",
"size": 34276,
"url": "https://repo1.maven.org/maven2/org/ow2/asm/asm-analysis/9.3/asm-analysis-9.3.jar"
"path": "org/ow2/asm/asm-analysis/9.4/asm-analysis-9.4.jar",
"sha1": "0a5fec9dfc039448d4fd098fbaffcaf55373b223",
"size": 34331,
"url": "https://repo1.maven.org/maven2/org/ow2/asm/asm-analysis/9.4/asm-analysis-9.4.jar"
}
},
"name": "org.ow2.asm:asm-analysis:9.3"
"name": "org.ow2.asm:asm-analysis:9.4"
},
{
"downloads": {
"artifact": {
"path": "org/ow2/asm/asm-commons/9.3/asm-commons-9.3.jar",
"sha1": "1f2a432d1212f5c352ae607d7b61dcae20c20af5",
"size": 72716,
"url": "https://repo1.maven.org/maven2/org/ow2/asm/asm-commons/9.3/asm-commons-9.3.jar"
"path": "org/ow2/asm/asm-commons/9.4/asm-commons-9.4.jar",
"sha1": "8fc2810ddbcbbec0a8bbccb3f8eda58321839912",
"size": 72781,
"url": "https://repo1.maven.org/maven2/org/ow2/asm/asm-commons/9.4/asm-commons-9.4.jar"
}
},
"name": "org.ow2.asm:asm-commons:9.3"
"name": "org.ow2.asm:asm-commons:9.4"
},
{
"downloads": {
"artifact": {
"path": "org/ow2/asm/asm-tree/9.3/asm-tree-9.3.jar",
"sha1": "78d2ecd61318b5a58cd04fb237636c0e86b77d97",
"size": 52669,
"url": "https://repo1.maven.org/maven2/org/ow2/asm/asm-tree/9.3/asm-tree-9.3.jar"
"path": "org/ow2/asm/asm-tree/9.4/asm-tree-9.4.jar",
"sha1": "a99175a17d7fdc18cbcbd0e8ea6a5d276844190a",
"size": 52665,
"url": "https://repo1.maven.org/maven2/org/ow2/asm/asm-tree/9.4/asm-tree-9.4.jar"
}
},
"name": "org.ow2.asm:asm-tree:9.3"
"name": "org.ow2.asm:asm-tree:9.4"
},
{
"downloads": {
"artifact": {
"path": "org/ow2/asm/asm-util/9.3/asm-util-9.3.jar",
"sha1": "9595bc05510d0bd4b610188b77333fe4851a1975",
"size": 85682,
"url": "https://repo1.maven.org/maven2/org/ow2/asm/asm-util/9.3/asm-util-9.3.jar"
"path": "org/ow2/asm/asm-util/9.4/asm-util-9.4.jar",
"sha1": "ab1e0a84b72561dbaf1ee260321e72148ebf4b19",
"size": 91549,
"url": "https://repo1.maven.org/maven2/org/ow2/asm/asm-util/9.4/asm-util-9.4.jar"
}
},
"name": "org.ow2.asm:asm-util:9.3"
"name": "org.ow2.asm:asm-util:9.4"
},
{
"downloads": {
@@ -0,0 +1,34 @@
package customskinloader.mixin;
import java.util.Map;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import customskinloader.fake.FakeSkinManager;
import net.minecraft.client.resources.SkinManager$3;
import net.minecraft.client.resources.SkinManager$3$1;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
// For 1.12.2-
@Mixin(SkinManager$3$1.class)
public abstract class MixinSkinManager$3$1 {
@Final
@Shadow
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> field_152803_a;
@Final
@Shadow
SkinManager$3 field_152804_b;
@Inject(
method = "Lnet/minecraft/client/resources/SkinManager$3$1;run()V",
at = @At("RETURN")
)
private void inject_run(CallbackInfo callbackInfo) {
FakeSkinManager.loadElytraTexture(this.field_152804_b.field_152802_d, this.field_152803_a, this.field_152804_b.field_152801_c);
}
}
@@ -0,0 +1,29 @@
package customskinloader.mixin;
import java.util.Map;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import customskinloader.fake.FakeSkinManager;
import net.minecraft.client.resources.SkinManager$3;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
// For 1.12.2-
@Mixin(SkinManager$3.class)
public abstract class MixinSkinManager$3 {
@Redirect(
method = "Lnet/minecraft/client/resources/SkinManager$3;run()V",
at = @At(
value = "INVOKE",
target = "Lcom/mojang/authlib/minecraft/MinecraftSessionService;getTextures(Lcom/mojang/authlib/GameProfile;Z)Ljava/util/Map;",
ordinal = 0,
remap = false
)
)
private Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> redirect_run(MinecraftSessionService sessionService, GameProfile profile, boolean requireSecure) {
return FakeSkinManager.getUserProfile(sessionService, profile, requireSecure);
}
}
@@ -2,19 +2,31 @@ package customskinloader.mixin;
import java.io.File;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import com.google.common.collect.ImmutableList;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import customskinloader.fake.FakeSkinManager;
import net.minecraft.client.renderer.IImageBuffer;
import net.minecraft.client.renderer.ThreadDownloadImageData;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.SkinManager;
import net.minecraft.util.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Group;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.ModifyArgs;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
@Mixin(SkinManager.class)
public abstract class MixinSkinManager {
@@ -28,23 +40,116 @@ public abstract class MixinSkinManager {
this.fakeManager = new FakeSkinManager(textureManagerInstance, skinCacheDirectory, sessionService);
}
@Inject(
@ModifyVariable(
method = "Lnet/minecraft/client/resources/SkinManager;loadSkin(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation;",
at = @At("HEAD"),
cancellable = true
at = @At(
value = "STORE",
ordinal = 0
),
ordinal = 0
)
private void inject_loadSkin(MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType, SkinManager.SkinAvailableCallback skinAvailableCallback, CallbackInfoReturnable<ResourceLocation> callbackInfoReturnable) {
callbackInfoReturnable.setReturnValue(this.fakeManager.loadSkin(profileTexture, textureType, skinAvailableCallback));
private ResourceLocation modifyVariable_loadSkin(ResourceLocation resourceLocation, MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType, SkinManager.SkinAvailableCallback skinAvailableCallback) {
return FakeSkinManager.setResourceLocation(resourceLocation, profileTexture);
}
@Inject(
method = "Lnet/minecraft/client/resources/SkinManager;loadProfileTextures(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V",
at = @At("HEAD"),
cancellable = true
@ModifyArg(
method = "Lnet/minecraft/client/resources/SkinManager;loadSkin(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation;",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;skinAvailable(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V"
)
)
private void inject_loadProfileTextures(GameProfile profile, SkinManager.SkinAvailableCallback skinAvailableCallback, boolean requireSecure, CallbackInfo callbackInfo) {
this.fakeManager.loadProfileTextures(profile, skinAvailableCallback, requireSecure);
callbackInfo.cancel();
private MinecraftProfileTexture modifyArg_loadSkin(MinecraftProfileTexture.Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture) {
return FakeSkinManager.getModelCache(profileTexture, this.fakeManager, location);
}
// 19w37a-
@Group(
name = "modifyArgs_loadSkin",
min = 1
)
@ModifyArgs(
method = "Lnet/minecraft/client/resources/SkinManager;loadSkin(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation;",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/ThreadDownloadImageData;<init>(Ljava/io/File;Ljava/lang/String;Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/IImageBuffer;)V"
)
)
private void modifyArgs_loadSkin_0(Args args, MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType, SkinManager.SkinAvailableCallback skinAvailableCallback) {
Object[] argsArr = new Object[args.size()];
for (int i = 0; i < argsArr.length; i++) {
argsArr[i] = args.get(i);
}
argsArr = FakeSkinManager.createThreadDownloadImageData(ImmutableList.copyOf(argsArr), this.fakeManager, profileTexture, textureType, skinAvailableCallback);
args.setAll(argsArr);
}
// 19w38a+
@Group(
name = "modifyArgs_loadSkin",
min = 1
)
@ModifyArgs(
method = "Lnet/minecraft/client/resources/SkinManager;loadSkin(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation;",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/ThreadDownloadImageData;<init>(Ljava/io/File;Ljava/lang/String;Lnet/minecraft/util/ResourceLocation;ZLjava/lang/Runnable;)V"
)
)
private void modifyArgs_loadSkin_1(Args args, MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType, SkinManager.SkinAvailableCallback skinAvailableCallback) {
this.modifyArgs_loadSkin_0(args, profileTexture, textureType, skinAvailableCallback);
}
// 19w37a-
@Group(
name = "redirect_loadProfileTextures",
min = 1
)
@Redirect(
method = "Lnet/minecraft/client/resources/SkinManager;loadProfileTextures(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V",
at = @At(
value = "INVOKE",
target = "Ljava/util/concurrent/ExecutorService;submit(Ljava/lang/Runnable;)Ljava/util/concurrent/Future;",
remap = false
)
)
private Future<?> redirect_loadProfileTextures_0(ExecutorService executor, Runnable task, GameProfile profile, SkinManager.SkinAvailableCallback skinAvailableCallback, boolean requireSecure) {
FakeSkinManager.loadProfileTextures(task, profile);
return null;
}
// 19w38a ~ 1.18-exp7
@Group(
name = "redirect_loadProfileTextures",
min = 1
)
@Redirect(
method = "Lnet/minecraft/client/resources/SkinManager;loadProfileTextures(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V",
at = @At(
value = "INVOKE",
target = "Ljava/util/concurrent/Executor;execute(Ljava/lang/Runnable;)V",
remap = false
)
)
private void redirect_loadProfileTextures_1(Executor executor, Runnable task, GameProfile profile, SkinManager.SkinAvailableCallback skinAvailableCallback, boolean requireSecure) {
FakeSkinManager.loadProfileTextures(task, profile);
}
// 21w37a+
@Group(
name = "redirect_loadProfileTextures",
min = 1
)
@Redirect(
method = "Lnet/minecraft/client/resources/SkinManager;loadProfileTextures(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V",
at = @At(
value = "INVOKE",
target = "Ljava/util/concurrent/ExecutorService;execute(Ljava/lang/Runnable;)V",
remap = false
)
)
private void redirect_loadProfileTextures_2(ExecutorService executor, Runnable task, GameProfile profile, SkinManager.SkinAvailableCallback skinAvailableCallback, boolean requireSecure) {
FakeSkinManager.loadProfileTextures(task, profile);
}
@Inject(
@@ -55,4 +160,36 @@ public abstract class MixinSkinManager {
private void inject_loadSkinFromCache(GameProfile profile, CallbackInfoReturnable<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>> callbackInfoReturnable) {
callbackInfoReturnable.setReturnValue(this.fakeManager.loadSkinFromCache(profile));
}
// 1.13+
@Mixin(SkinManager.class)
public abstract static class V1 {
@Redirect(
method = "Lnet/minecraft/client/resources/SkinManager;func_210275_a(Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V",
at = @At(
value = "INVOKE",
target = "Lcom/mojang/authlib/minecraft/MinecraftSessionService;getTextures(Lcom/mojang/authlib/GameProfile;Z)Ljava/util/Map;",
remap = false
)
)
private Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> redirect_func_210275_a(MinecraftSessionService sessionService, GameProfile profile, boolean requireSecure) {
return FakeSkinManager.getUserProfile(sessionService, profile, requireSecure);
}
}
// 19w38a+
@Mixin(SkinManager.class)
public abstract static class V2 {
@Redirect(
method = "Lnet/minecraft/client/resources/SkinManager;func_229297_b_(Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V",
at = @At(
value = "INVOKE",
target = "Lcom/google/common/collect/ImmutableList;of(Ljava/lang/Object;Ljava/lang/Object;)Lcom/google/common/collect/ImmutableList;",
remap = false
)
)
private ImmutableList<MinecraftProfileTexture.Type> redirect_func_229297_b_(Object e1, Object e2) {
return ImmutableList.copyOf(MinecraftProfileTexture.Type.values());
}
}
}
@@ -1,22 +0,0 @@
package customskinloader.mixin;
import customskinloader.fake.itf.IFakeTextureManager;
import net.minecraft.client.renderer.texture.TextureManager;
import org.spongepowered.asm.mixin.Implements;
import org.spongepowered.asm.mixin.Interface;
import org.spongepowered.asm.mixin.Mixin;
@Implements({
@Interface(
iface = IFakeTextureManager.V1.class,
prefix = "fake1$"
),
@Interface(
iface = IFakeTextureManager.V2.class,
prefix = "fake2$"
),
})
@Mixin(TextureManager.class)
public abstract class MixinTextureManager {
}
@@ -0,0 +1,11 @@
package net.minecraft.client.resources;
import java.util.Map;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
public class SkinManager$3$1 {
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> field_152803_a;
SkinManager$3 field_152804_b;
public void run() {}
}
@@ -0,0 +1,7 @@
package net.minecraft.client.resources;
public class SkinManager$3 {
public SkinManager.SkinAvailableCallback field_152801_c;
public SkinManager field_152802_d;
public void run() {}
}
+4 -22
View File
@@ -7,27 +7,10 @@ configFile.withReader {
prop.load(it)
project.ext.config = new ConfigSlurper().parse prop
}
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "https://maven.minecraftforge.net/"
}
maven {
name = "sponge"
url = "https://repo.spongepowered.org/repository/maven-public/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3.+'
classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
}
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
gradleVersion = "4.10.3"
gradleVersion = "4.9"
}
import customskinloader.gradle.util.CurseForgeUtil
@@ -101,7 +84,7 @@ subprojects {
archivesBaseName = "CustomSkinLoader_${-> VersionUtil.getEdition(project)}"
processResources {
filesNotMatching("**/*.js") {
filesNotMatching(["**/*.js", "mixins.*.json"]) {
expand([
modVersion : rootProject.ext.config.version,
modFullVersion : project.version,
@@ -120,9 +103,8 @@ subprojects {
if (!project.name.toLowerCase().contains("forge/legacy")) {
apply plugin: 'org.spongepowered.mixin'
dependencies {
implementation 'org.spongepowered:mixin:0.8.5'
}
apply from: rootProject.file("buildSrc/patch.gradle")
patchMixin()
task genSrgMap {
doLast {
+7 -1
View File
@@ -13,6 +13,9 @@ repositories {
maven {
url = "https://maven.minecraftforge.net/"
}
maven {
url = "https://repo.spongepowered.org/repository/maven-public/"
}
}
dependencies {
@@ -21,7 +24,10 @@ dependencies {
implementation("com.google.code.gson:gson:2.9.0")
implementation("commons-io:commons-io:2.11.0")
implementation("net.minecraftforge.gradle:ForgeGradle:2.3.+")
implementation("org.cadixdev:mercury:0.1.0")
implementation("gradle.plugin.com.matthewprenger:CurseGradle:1.4.0")
implementation("gradle.plugin.com.modrinth.minotaur:Minotaur:1.2.1")
implementation("org.spongepowered:mixingradle:0.6-SNAPSHOT")
}
apply from: file("patch.gradle")
patchMercury()
+116
View File
@@ -0,0 +1,116 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.ow2.asm:asm-debug-all:5.2"
}
}
import org.objectweb.asm.ClassReader
import org.objectweb.asm.ClassWriter
import org.objectweb.asm.Opcodes
import org.objectweb.asm.tree.AbstractInsnNode
import org.objectweb.asm.tree.ClassNode
import org.objectweb.asm.tree.InsnList
import org.objectweb.asm.tree.MethodInsnNode
import org.objectweb.asm.tree.MethodNode
import java.util.zip.ZipEntry
import java.util.zip.ZipFile
import java.util.zip.ZipOutputStream
configurations {
patchClass
}
void patch(Object dependency, Closure<Boolean> fileFilter, Closure<Boolean> classFilter, Closure<Boolean> methodFilter, Closure<Boolean> nodeFilter, Closure methodPathcer) {
project.dependencies {
patchClass dependency
}
project.afterEvaluate {
project.configurations.patchClass.findAll({ File f -> fileFilter.call(f) }).each { File f ->
def name = "${project.buildDir}/libs/${f.name}"
file(name).parentFile.mkdirs()
def zos = new ZipOutputStream(new FileOutputStream(name))
try {
def zf = new ZipFile(f)
zf.stream().filter({ ZipEntry ze -> classFilter.call(ze.name) }).forEach({ ZipEntry ze ->
def cn = new ClassNode()
new ClassReader(zf.getInputStream(ze).bytes).accept(cn, 0)
cn.methods.findAll({ MethodNode mn -> methodFilter.call(mn) }).each { MethodNode mn ->
mn.instructions.toArray().each { AbstractInsnNode ain ->
if (nodeFilter.call(ain)) {
methodPathcer.call(mn.instructions, ain)
}
}
}
def cw = new ClassWriter(ClassWriter.COMPUTE_MAXS)
cn.accept(cw)
zos.putNextEntry(new ZipEntry(ze.name))
zos.write(cw.toByteArray())
zos.closeEntry()
})
} finally {
zos.close()
}
project.dependencies {
compile files(name)
compile dependency
}
}
}
}
// Mercury assumes that all classes containing '$' are inner classes and ignores classes that contain '$' natively.
void patchMercury() {
this.patch(
"org.cadixdev:mercury:0.1.0",
{ File f ->
f.name == "mercury-0.1.0.jar"
},
{ String name ->
name == "org/cadixdev/mercury/remapper/RemapperVisitor.class"
},
{ MethodNode mn ->
mn.name == "remapType" && mn.desc == "(Lorg/eclipse/jdt/core/dom/SimpleName;Lorg/eclipse/jdt/core/dom/ITypeBinding;)V"
},
{ AbstractInsnNode node ->
node.opcode == Opcodes.ASTORE && node.var == 4
},
{ InsnList list, AbstractInsnNode node ->
list.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/gradle/util/RemapUtil", "fixClassName", "(Ljava/lang/String;)Ljava/lang/String;", false))
}
)
}
// Mixin uses incorrect method for field descriptors to get the signature.
void patchMixin() {
this.patch(
"org.spongepowered:mixin:0.8.5",
{ File f ->
f.name == "mixin-0.8.5.jar"
},
{ String name ->
name == "org/spongepowered/tools/obfuscation/mirror/TypeHandleASM.class"
},
{ MethodNode mn ->
mn.name == "findField" && mn.desc == "(Ljava/lang/String;Ljava/lang/String;Z)Lorg/spongepowered/tools/obfuscation/mirror/FieldHandle;"
},
{ AbstractInsnNode node ->
node.opcode == Opcodes.INVOKESTATIC && node.owner == "org/spongepowered/tools/obfuscation/mirror/TypeUtils" && node.name == "getJavaSignature" && node.desc == "(Ljava/lang/String;)Ljava/lang/String;"
},
{ InsnList list, AbstractInsnNode node ->
list.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "org/objectweb/asm/Type", "getType", "(Ljava/lang/String;)Lorg/objectweb/asm/Type;", false))
list.set(node, new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "org/objectweb/asm/Type", "getClassName", "()Ljava/lang/String;", false))
}
)
}
ext {
patchMixin = this.&patchMixin
patchMercury = this.&patchMercury
}
@@ -21,6 +21,7 @@ import org.cadixdev.lorenz.MappingSet;
import org.cadixdev.lorenz.io.srg.SrgReader;
import org.cadixdev.lorenz.io.srg.SrgWriter;
import org.cadixdev.lorenz.io.srg.tsrg.TSrgReader;
import org.cadixdev.lorenz.model.ClassMapping;
import org.cadixdev.mercury.Mercury;
import org.cadixdev.mercury.remapper.MercuryRemapper;
import org.gradle.api.Project;
@@ -42,7 +43,7 @@ public class RemapUtil {
Writer writer = Files.newBufferedWriter(srg.toPath(), StandardCharsets.UTF_8)
) {
new TSrgReader(reader).read(set);
new SrgWriter(writer).write(set);
new SrgWriterWithoutFilter(writer).write(set);
}
srg.deleteOnExit();
}
@@ -89,4 +90,59 @@ public class RemapUtil {
}
}));
}
/**
* Invoked from {@link org.cadixdev.mercury.remapper.RemapperVisitor#remapType(org.eclipse.jdt.core.dom.SimpleName, org.eclipse.jdt.core.dom.ITypeBinding)}
*/
public static String fixClassName(String name) {
char[] chars = name.toCharArray();
for (int i = 0; i < chars.length - 1; i++) {
if (chars[i] == '.' && chars[i + 1] >= '0' && chars[i + 1] <= '9') {
chars[i] = '$';
}
}
return new String(chars);
}
public static class SrgWriterWithoutFilter extends SrgWriter {
private final static Field classesField;
static {
try {
classesField = SrgWriter.class.getDeclaredField("classes");
classesField.setAccessible(true);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public SrgWriterWithoutFilter(Writer writer) {
super(writer);
}
@Override
protected void writeClassMapping(ClassMapping<?, ?> mapping) {
// Write class mappings without checking
try {
((List<String>) classesField.get(this)).add(String.format("CL: %s %s", mapping.getFullObfuscatedName(), mapping.getFullDeobfuscatedName()));
} catch (Exception e) {
throw new RuntimeException(e);
}
// Write inner class mappings
mapping.getInnerClassMappings().stream()
.sorted(this.getConfig().getClassMappingComparator())
.forEach(this::writeClassMapping);
// Write field mappings
mapping.getFieldsByName().values().stream()
.sorted(this.getConfig().getFieldMappingComparator())
.forEach(this::writeFieldMapping);
// Write method mappings
mapping.getMethodMappings().stream()
.sorted(this.getConfig().getMethodMappingComparator())
.forEach(this::writeMethodMapping);
}
}
}
Binary file not shown.
+1 -1
View File
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists