mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-22 05:02:34 +00:00
Support Forge for Minecraft 1.15.x (#77)
This commit is contained in:
1 parent
e19b9d860f
commit
6fab945eb1
8 files changed
+69
-164
No files matched your search
@@ -6,22 +6,18 @@ 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.renderer.texture.TextureManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.versions.mcp.MCPVersion;
|
||||
|
||||
public class SkinManager {
|
||||
static {
|
||||
if (!MCPVersion.getMCVersion().startsWith("1.13")) {
|
||||
try {
|
||||
// Make sure that DownloadingTexture is initialized earlier than FakeSkinManager.
|
||||
Class.forName("net.minecraft.client.renderer.texture.DownloadingTexture");
|
||||
} catch (ClassNotFoundException e) {}
|
||||
}
|
||||
}
|
||||
private FakeSkinManager fakeManager;
|
||||
|
||||
public SkinManager(TextureManager textureManagerInstance, File skinCacheDirectory, MinecraftSessionService sessionService) {
|
||||
throw new RuntimeException("This method must be transformed!");
|
||||
try {
|
||||
Class.forName("net.minecraft.client.renderer.texture.ITextureObject", false, SkinManager.class.getClassLoader());
|
||||
} catch (ClassNotFoundException ignore) {}
|
||||
this.fakeManager = new FakeSkinManager(textureManagerInstance, skinCacheDirectory, sessionService);
|
||||
}
|
||||
|
||||
public ResourceLocation loadSkin(MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType) {
|
||||
@@ -29,7 +25,7 @@ public class SkinManager {
|
||||
}
|
||||
|
||||
public ResourceLocation loadSkin(MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType, SkinManager.SkinAvailableCallback skinAvailableCallback) {
|
||||
throw new RuntimeException("This method must be transformed!");
|
||||
return this.fakeManager.loadSkin(profileTexture, textureType, skinAvailableCallback);
|
||||
}
|
||||
|
||||
// For 1.14+
|
||||
@@ -38,7 +34,7 @@ public class SkinManager {
|
||||
}
|
||||
|
||||
public void loadProfileTextures(GameProfile profile, SkinManager.SkinAvailableCallback skinAvailableCallback, boolean requireSecure) {
|
||||
throw new RuntimeException("This method must be transformed!");
|
||||
this.fakeManager.loadProfileTextures(profile, skinAvailableCallback, requireSecure);
|
||||
}
|
||||
|
||||
// For 1.14+
|
||||
@@ -47,14 +43,16 @@ public class SkinManager {
|
||||
}
|
||||
|
||||
public Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> loadSkinFromCache(GameProfile profile) {
|
||||
throw new RuntimeException("This method must be transformed!");
|
||||
return this.fakeManager.loadSkinFromCache(profile);
|
||||
}
|
||||
|
||||
public interface SkinAvailableCallback {
|
||||
void skinAvailable(MinecraftProfileTexture.Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture);
|
||||
|
||||
void onSkinTextureAvailable(MinecraftProfileTexture.Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture);
|
||||
}
|
||||
|
||||
public interface ISkinAvailableCallback extends SkinAvailableCallback {
|
||||
void onSkinTextureAvailable(MinecraftProfileTexture.Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user