Compare commits

...
4 Commits
Author SHA1 Message Date
ZekerZhayard faebfc9bb1 Support 26.1 (#368) 2026-03-25 23:10:09 +08:00
ZekerZhayard 08033b0502 Fix an issue where incorrect skins were loaded in multiplayer mode. (#364)
* Fix an issue where incorrect skins were loaded in multiplayer mode.

* Restore the mistakenly deleted GAME_PROFILE_ID.
2026-03-09 13:31:52 +08:00
ZekerZhayard 4cffdc3eb6 Fix crash on forge 1.20.4. (#360) 2025-12-23 00:18:17 +08:00
ZekerZhayard 73beb4c29e Support 1.21.11 (#359)
* Support 1.21.11

* Update supported versions
2025-12-14 23:23:34 +08:00
59 changed files with 629 additions and 273 deletions

No files matched your search

@@ -2,6 +2,7 @@ package customskinloader.fake;
import java.io.IOException;
import java.io.InputStream;
import java.util.concurrent.CompletableFuture;
import java.util.function.BiPredicate;
import java.util.function.Predicate;
@@ -9,11 +10,14 @@ import customskinloader.CustomSkinLoader;
import customskinloader.fake.itf.FakeInterfaceManager;
import customskinloader.fake.texture.FakeImage;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.Identifier;
import net.minecraft.util.ResourceLocation;
public class FakeCapeBuffer extends FakeSkinBuffer {
private static final ResourceLocation TEXTURE_ELYTRA_V1 = new ResourceLocation("minecraft", "textures/entity/elytra.png");
private static final ResourceLocation TEXTURE_ELYTRA_V2 = new ResourceLocation("minecraft", "textures/entity/equipment/wings/elytra.png");
private static final CompletableFuture<Object> TEXTURE_ELYTRA_V2 = CompletableFuture.supplyAsync(() -> (Object) new ResourceLocation("minecraft", "textures/entity/equipment/wings/elytra.png"));
private static final CompletableFuture<Object> TEXTURE_ELYTRA_V3 = CompletableFuture.supplyAsync(() -> (Object) Identifier.fromNamespaceAndPath("minecraft", "textures/entity/equipment/wings/elytra.png")).exceptionally(t -> TEXTURE_ELYTRA_V2.join());
private static final CompletableFuture<Object> TEXTURE_ELYTRA_V1 = CompletableFuture.supplyAsync(() -> (Object) new ResourceLocation("minecraft", "textures/entity/elytra.png")).exceptionally(t -> TEXTURE_ELYTRA_V3.join());
private static int loadedGlobal = 0;
private static FakeImage elytraImage;
@@ -21,8 +25,8 @@ public class FakeCapeBuffer extends FakeSkinBuffer {
loadedGlobal++;
try {
Object resourceManager = FakeInterfaceManager.Minecraft_getResourceManager(Minecraft.getMinecraft());
InputStream is = FakeInterfaceManager.IResource_getInputStream(FakeInterfaceManager.IResourceManager_getResource(resourceManager, TEXTURE_ELYTRA_V1)
.orElseGet(() -> FakeInterfaceManager.IResourceManager_getResource(resourceManager, TEXTURE_ELYTRA_V2).orElse(null)));
InputStream is = FakeInterfaceManager.IResource_getInputStream(FakeInterfaceManager.IResourceManager_getResource(resourceManager, TEXTURE_ELYTRA_V1.join())
.orElseGet(() -> FakeInterfaceManager.IResourceManager_getResource(resourceManager, TEXTURE_ELYTRA_V2.join()).orElse(null)));
if (is != null) {
FakeImage image = originalImage.createImage(is);
if (image.getWidth() % 64 != 0 || image.getHeight() % 32 != 0) { // wtf?
@@ -7,6 +7,7 @@ import java.util.function.Function;
import java.util.function.Predicate;
import customskinloader.CustomSkinLoader;
import customskinloader.fake.itf.FakeInterfaceManager;
import customskinloader.fake.texture.FakeBufferedImage;
import customskinloader.fake.texture.FakeImage;
import customskinloader.fake.texture.FakeNativeImage;
@@ -28,7 +29,9 @@ public class FakeSkinBuffer implements IImageBuffer {
FakeImage img = parseUserSkin0(new FakeNativeImage(image));
if (img instanceof FakeNativeImage) {
return FakeNativeImage.Extended.create((FakeNativeImage) img);
image = ((FakeNativeImage) img).getImage();
FakeInterfaceManager.NativeImage_setFakeImage(image, img);
return image;
}
CustomSkinLoader.logger.warning("Failed to parseUserSkin(downloadAndRegisterSkin).");
@@ -16,7 +16,7 @@ import com.mojang.authlib.minecraft.MinecraftProfileTextures;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import com.mojang.authlib.properties.Property;
import customskinloader.CustomSkinLoader;
import customskinloader.fake.texture.FakeResourceLocation;
import customskinloader.fake.itf.FakeInterfaceManager;
import customskinloader.profile.ModelManager0;
import customskinloader.utils.HttpTextureUtil;
import net.minecraft.client.renderer.IImageBuffer;
@@ -28,7 +28,6 @@ import net.minecraft.client.resources.SkinManager$CacheKey;
import net.minecraft.client.resources.SkinManager$SkinAvailableCallback;
import net.minecraft.client.resources.SkinManager$TextureCache;
import net.minecraft.server.Services;
import net.minecraft.util.ResourceLocation;
public class FakeSkinManager {
/**
@@ -53,17 +52,6 @@ public class FakeSkinManager {
HttpTextureUtil.defaultCacheDir = skinCacheDirectory.toFile();
}
/**
* 23w42a ~ 25w33a
* Invoked from {@link SkinManager#getOrLoad(GameProfile)}
*
* 25w34a+
* Invoked from {@link SkinManager#get(GameProfile)}
*/
public static Property createProperty(Property property) {
return property == null ? new Property(null, null) : property;
}
/**
* 1.20.1-
* Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinManager$SkinAvailableCallback)}
@@ -79,7 +67,7 @@ public class FakeSkinManager {
if (params.length == 4) {
if (params[3] instanceof Boolean) { // 24w46a+
if ((Boolean) params[3]) {
params[0] = FakeResourceLocation.create((ResourceLocation) params[0], fakeProfileTexture);
FakeInterfaceManager.ResourceLocation_setTexture(params[0], fakeProfileTexture);
}
params[1] = cacheFile.toPath();
} else { // 19w37a-
@@ -235,7 +223,7 @@ public class FakeSkinManager {
* Invoked from {@link SkinManager#get(GameProfile)}
*/
public static SkinManager$CacheKey createFakeCacheKey(UUID uuid, Property property, GameProfile profile) {
return new FakeCacheKey(uuid, property, profile);
return new FakeCacheKey(uuid, property == null ? new Property(null, null) : property, profile);
}
public static Object createMinecraftProfileTextures(Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> textures) {
@@ -3,6 +3,8 @@ package customskinloader.fake.itf;
import java.io.InputStream;
import java.util.Optional;
import customskinloader.fake.FakeMinecraftProfileTexture;
import customskinloader.fake.texture.FakeNativeImage;
import net.minecraft.client.resources.IResource;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
@@ -12,8 +14,11 @@ public class FakeInterfaceManager {
return ((IFakeIResource.V2) resource).open();
}
public static Optional<IResource> IResourceManager_getResource(Object resourceManager, ResourceLocation location) {
return ((IFakeIResourceManager) resourceManager).getResource(location);
public static Optional<IResource> IResourceManager_getResource(Object resourceManager, Object location) {
if (resourceManager instanceof IFakeIResourceManager.V2) {
return ((IFakeIResourceManager.V2) resourceManager).getResource((IFakeResourceLocation) location);
}
return ((IFakeIResourceManager.V1) resourceManager).getResource((ResourceLocation) location);
}
public static IResourceManager Minecraft_getResourceManager(Object minecraft) {
@@ -27,4 +32,20 @@ public class FakeInterfaceManager {
public static void NativeImage_setPixel(Object nativeImage, int x, int y, int color) {
((IFakeNativeImage) nativeImage).setPixel(x, y, color);
}
public static FakeNativeImage NativeImage_getFakeImage(Object nativeImage) {
return ((IFakeNativeImage) nativeImage).getFakeImage();
}
public static void NativeImage_setFakeImage(Object nativeImage, Object fakeImage) {
((IFakeNativeImage) nativeImage).setFakeImage((FakeNativeImage) fakeImage);
}
public static FakeMinecraftProfileTexture ResourceLocation_getTexture(Object location) {
return ((IFakeResourceLocation) location).getTexture();
}
public static void ResourceLocation_setTexture(Object location, FakeMinecraftProfileTexture texture) {
((IFakeResourceLocation) location).setTexture(texture);
}
}
@@ -7,13 +7,20 @@ import net.minecraft.resources.IResource;
import net.minecraft.util.ResourceLocation;
public interface IFakeIResourceManager {
// 1.13.2 ~ 22w13a
default IResource func_199002_a(ResourceLocation location) {
return (IResource) ((IResourceManager) this).getResource(location);
interface V1 {
// 1.13.2 ~ 22w13a
default IResource func_199002_a(ResourceLocation location) {
return (IResource) ((IResourceManager) this).getResource(location);
}
// 22w14a ~ 25w44a
default Optional getResource(ResourceLocation location) {
return Optional.ofNullable(this.func_199002_a(location));
}
}
// 22w14a+
default Optional getResource(ResourceLocation location) {
return Optional.ofNullable(this.func_199002_a(location));
interface V2 {
// 25w45a+
Optional getResource(IFakeResourceLocation location);
}
}
@@ -1,5 +1,6 @@
package customskinloader.fake.itf;
import customskinloader.fake.texture.FakeNativeImage;
import net.minecraft.client.renderer.texture.NativeImage;
public interface IFakeNativeImage {
@@ -10,4 +11,8 @@ public interface IFakeNativeImage {
default void setPixel(int x, int y, int color) {
((NativeImage) this).func_195700_a(x, y, color);
}
FakeNativeImage getFakeImage();
void setFakeImage(FakeNativeImage fakeImage);
}
@@ -0,0 +1,9 @@
package customskinloader.fake.itf;
import customskinloader.fake.FakeMinecraftProfileTexture;
public interface IFakeResourceLocation {
FakeMinecraftProfileTexture getTexture();
void setTexture(FakeMinecraftProfileTexture texture);
}
@@ -71,22 +71,4 @@ public class FakeNativeImage implements FakeImage {
public void close() {
image.close();
}
public static class Extended extends NativeImage {
public static NativeImage create(FakeNativeImage fakeImage) {
return new FakeNativeImage.Extended(fakeImage);
}
private final FakeNativeImage fakeImage;
public Extended(FakeNativeImage fakeImage) {
super(fakeImage.getWidth(), fakeImage.getHeight(), true);
this.func_195703_a(fakeImage.getImage());
this.fakeImage = fakeImage;
}
public FakeNativeImage getFakeImage() {
return this.fakeImage;
}
}
}
@@ -1,22 +0,0 @@
package customskinloader.fake.texture;
import customskinloader.fake.FakeMinecraftProfileTexture;
import net.minecraft.util.ResourceLocation;
public class FakeResourceLocation extends ResourceLocation {
public static FakeResourceLocation create(ResourceLocation location, FakeMinecraftProfileTexture texture) {
String[] s = location.toString().split(":", 2);
return new FakeResourceLocation(s[0], s[1], texture);
}
private final FakeMinecraftProfileTexture texture;
public FakeResourceLocation(String domain, String path, FakeMinecraftProfileTexture texture) {
super(domain, path);
this.texture = texture;
}
public FakeMinecraftProfileTexture getTexture() {
return this.texture;
}
}
@@ -4,13 +4,16 @@ import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
import customskinloader.fake.FakeCapeBuffer;
import customskinloader.fake.FakeMinecraftProfileTexture;
import customskinloader.fake.FakeSkinBuffer;
import customskinloader.fake.FakeSkinManager;
import customskinloader.fake.itf.FakeInterfaceManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.NativeImage;
import net.minecraft.client.renderer.texture.SimpleTexture;
import net.minecraft.client.renderer.texture.TextureContents;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.resources.Identifier;
import net.minecraft.util.ResourceLocation;
// 24w46a+
@@ -18,16 +21,29 @@ public class FakeThreadDownloadImageData extends SimpleTexture {
private FakeCapeBuffer buffer;
private FakeNativeImage image;
public static Function<NativeImage, CompletableFuture<?>> createTexture(Function<NativeImage, CompletableFuture<?>> function, ResourceLocation location, boolean bl) {
return bl ? _image -> {
if (location instanceof FakeResourceLocation && _image instanceof FakeNativeImage.Extended) {
FakeSkinManager.BaseBuffer.judgeType(((FakeResourceLocation) location).getTexture(), () -> FakeSkinBuffer.judgeType0(((FakeNativeImage.Extended) _image).getFakeImage()));
}
return function.apply(_image);
} : _image -> function.apply(_image).thenApply(_location -> {
public static Function<NativeImage, CompletableFuture<?>> createTextureV1(Function<NativeImage, CompletableFuture<?>> function, ResourceLocation location, boolean bl) {
return createTexture(function, _image -> _location -> {
Minecraft.getMinecraft().getTextureManager().registerAndLoad(location, new FakeThreadDownloadImageData(location, copyImage(new FakeNativeImage(_image))));
return _location;
});
}, location, bl);
}
public static Function<NativeImage, CompletableFuture<?>> createTextureV2(Function<NativeImage, CompletableFuture<?>> function, Identifier identifier, boolean bl) {
return createTexture(function, _image -> _location -> {
Minecraft.getMinecraft().getTextureManager().registerAndLoad(identifier, new FakeThreadDownloadImageData(identifier, copyImage(new FakeNativeImage(_image)), null));
return _location;
}, identifier, bl);
}
public static Function<NativeImage, CompletableFuture<?>> createTexture(Function<NativeImage, CompletableFuture<?>> function, Function<NativeImage, Function<Object, Object>> cape, Object location, boolean bl) {
return bl ? _image -> {
FakeMinecraftProfileTexture texture = FakeInterfaceManager.ResourceLocation_getTexture(location);
FakeNativeImage image = FakeInterfaceManager.NativeImage_getFakeImage(_image);
if (texture != null && image != null) {
FakeSkinManager.BaseBuffer.judgeType(texture, () -> FakeSkinBuffer.judgeType0(image));
}
return function.apply(_image);
} : _image -> function.apply(_image).thenApply(cape.apply(_image));
}
public FakeThreadDownloadImageData(ResourceLocation location, FakeNativeImage image) {
@@ -36,6 +52,12 @@ public class FakeThreadDownloadImageData extends SimpleTexture {
this.image = image;
}
public FakeThreadDownloadImageData(Identifier identifier, FakeNativeImage image, Object o) {
super(identifier);
this.buffer = new FakeCapeBuffer();
this.image = image;
}
@Override
public TextureContents loadContents(IResourceManager resourceManager) {
this.image = (FakeNativeImage) this.buffer.parseUserSkin(this.image);
@@ -61,11 +61,12 @@ public class GameProfileLoader implements ICustomSkinLoaderPlugin, ProfileLoader
@Override
public UserProfile loadProfile(SkinSiteProfile ssp, GameProfile gameProfile) throws Exception {
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = getTextures(gameProfile);
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = getTextures(Iterables.getFirst(TextureUtil.AuthlibField.GAME_PROFILE_PROPERTIES.<PropertyMap>get(gameProfile).get("textures"), null));
if (!map.isEmpty()) {
CustomSkinLoader.logger.info("Default profile will be used.");
return ModelManager0.toUserProfile(map);
}
CustomSkinLoader.logger.info("Profile not found.");
return null;
}
@@ -85,11 +86,7 @@ public class GameProfileLoader implements ICustomSkinLoaderPlugin, ProfileLoader
}
public static final Gson GSON = new GsonBuilder().registerTypeAdapter(UUID.class, new UUIDTypeAdapter()).registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer()).create();
public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> getTextures(GameProfile gameProfile) {
if (gameProfile == null) {
return Maps.newHashMap();
}
Property textureProperty = Iterables.getFirst(TextureUtil.AuthlibField.GAME_PROFILE_PROPERTIES.<PropertyMap>get(gameProfile).get("textures"), null);
public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> getTextures(Property textureProperty) {
if (textureProperty == null) {
return Maps.newHashMap();
}
@@ -6,6 +6,7 @@ import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
@@ -80,28 +81,30 @@ public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.I
@Override
public UserProfile loadProfile(SkinSiteProfile ssp, GameProfile gameProfile) {
String username = TextureUtil.AuthlibField.GAME_PROFILE_NAME.get(gameProfile);
GameProfile newGameProfile = loadGameProfileCached(ssp.apiRoot, username);
if (newGameProfile == null) {
MinecraftProfilePropertiesResponse newProfile = loadGameProfileCached(ssp.apiRoot, username);
if (newProfile == null) {
CustomSkinLoader.logger.info("Profile not found.(" + username + "'s profile not found.)");
return null;
}
newGameProfile = fillGameProfile(ssp.sessionRoot, newGameProfile);
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = GameProfileLoader.getTextures(newGameProfile);
if (!map.isEmpty()) {
return ModelManager0.toUserProfile(map);
PropertyMap propertyMap = TextureUtil.AuthlibField.MINECRAFT_PROFILE_PROPERTIES_RESPONSE_PROPERTIES.get(fillProfile(ssp.sessionRoot, newProfile));
if (propertyMap != null) {
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = GameProfileLoader.getTextures(Iterables.getFirst(propertyMap.get("textures"), null));
if (!map.isEmpty()) {
return ModelManager0.toUserProfile(map);
}
}
CustomSkinLoader.logger.info("Profile not found.(" + username + " doesn't have skin/cape.)");
return null;
}
private static final Map<String, GameProfile> gameProfileCache = new ConcurrentHashMap<>();
private static final Map<String, MinecraftProfilePropertiesResponse> gameProfileCache = new ConcurrentHashMap<>();
public static GameProfile loadGameProfileCached(String apiRoot, String username) {
public static MinecraftProfilePropertiesResponse loadGameProfileCached(String apiRoot, String username) {
return gameProfileCache.computeIfAbsent(apiRoot + " " + username, ignored -> loadGameProfile(apiRoot, username));
}
//Username -> UUID
public static GameProfile loadGameProfile(String apiRoot, String username) {
public static MinecraftProfilePropertiesResponse loadGameProfile(String apiRoot, String username) {
//Doc (https://minecraft.wiki/w/Mojang_API#Query_player_UUIDs_in_batch)
HttpRequestUtil.HttpResponce responce = HttpRequestUtil.makeHttpRequest(new HttpRequestUtil.HttpRequest(apiRoot + "profiles/minecraft").setCacheTime(600).setPayload(GameProfileLoader.GSON.toJson(Collections.singletonList(username))));
if (StringUtils.isEmpty(responce.content)) {
@@ -112,13 +115,12 @@ public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.I
if (profiles.length == 0) {
return null;
}
GameProfile gameProfile = createGameProfile(profiles[0]);
UUID id = TextureUtil.AuthlibField.GAME_PROFILE_ID.get(gameProfile);
UUID id = TextureUtil.AuthlibField.MINECRAFT_PROFILE_PROPERTIES_RESPONSE_ID.get(profiles[0]);
if (id == null) {
return null;
}
return new GameProfile(id, TextureUtil.AuthlibField.GAME_PROFILE_NAME.get(gameProfile));
return profiles[0];
}
/**
@@ -129,31 +131,22 @@ public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.I
* @return UUID in Mojang API style string. Returns {@code null} if username not found in Mojang API.
*/
public static String getMojangUuidByUsername(String username, boolean standard) {
GameProfile profile = loadGameProfileCached(getMojangApiRoot(), username);
MinecraftProfilePropertiesResponse profile = loadGameProfileCached(getMojangApiRoot(), username);
if (profile == null) {
return null;
}
UUID id = TextureUtil.AuthlibField.GAME_PROFILE_ID.get(profile);
UUID id = TextureUtil.AuthlibField.MINECRAFT_PROFILE_PROPERTIES_RESPONSE_ID.get(profile);
return standard ? id.toString() : TextureUtil.fromUUID(id);
}
//UUID -> Profile
public static GameProfile fillGameProfile(String sessionRoot, GameProfile profile) {
public static MinecraftProfilePropertiesResponse fillProfile(String sessionRoot, MinecraftProfilePropertiesResponse profile) {
//Doc (https://minecraft.wiki/w/Mojang_API#Query_player's_skin_and_cape)
HttpRequestUtil.HttpResponce responce = HttpRequestUtil.makeHttpRequest(new HttpRequestUtil.HttpRequest(sessionRoot + "session/minecraft/profile/" + TextureUtil.fromUUID(TextureUtil.AuthlibField.GAME_PROFILE_ID.get(profile))).setCacheTime(90));
HttpRequestUtil.HttpResponce responce = HttpRequestUtil.makeHttpRequest(new HttpRequestUtil.HttpRequest(sessionRoot + "session/minecraft/profile/" + TextureUtil.fromUUID(TextureUtil.AuthlibField.MINECRAFT_PROFILE_PROPERTIES_RESPONSE_ID.get(profile))).setCacheTime(90));
if (StringUtils.isEmpty(responce.content)) {
return profile;
}
return createGameProfile(GameProfileLoader.GSON.fromJson(responce.content, MinecraftProfilePropertiesResponse.class));
}
public static GameProfile createGameProfile(MinecraftProfilePropertiesResponse response) {
GameProfile profile = new GameProfile(TextureUtil.AuthlibField.MINECRAFT_PROFILE_PROPERTIES_RESPONSE_ID.get(response), TextureUtil.AuthlibField.MINECRAFT_PROFILE_PROPERTIES_RESPONSE_NAME.get(response));
PropertyMap map = TextureUtil.AuthlibField.MINECRAFT_PROFILE_PROPERTIES_RESPONSE_PROPERTIES.get(response);
if (map != null) {
TextureUtil.AuthlibField.PROPERTY_MAP_PROPERTIES.set(TextureUtil.AuthlibField.GAME_PROFILE_PROPERTIES.get(profile), TextureUtil.AuthlibField.PROPERTY_MAP_PROPERTIES.get(map));
}
return profile;
return GameProfileLoader.GSON.fromJson(responce.content, MinecraftProfilePropertiesResponse.class);
}
@Override
@@ -3,6 +3,7 @@ package customskinloader.loader.jsonapi;
import com.google.common.collect.Lists;
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
import customskinloader.loader.JsonAPILoader;
import customskinloader.loader.MojangAPILoader;
import customskinloader.plugin.ICustomSkinLoaderPlugin;
@@ -53,12 +54,12 @@ public class MinecraftCapesAPI implements JsonAPILoader.IJsonAPI {
@Override
public UserProfile toUserProfile(String root, String json, boolean local) {
MinecraftCapesApiResponse result = new Gson().fromJson(json, MinecraftCapesApiResponse.class);
if (result.textures == null || result.textures.cape == null) {
if (result.capeUrl == null) {
return null;
}
UserProfile profile = new UserProfile();
profile.capeUrl = TextureUtil.parseBase64Texture(result.textures.cape);
profile.capeUrl = result.capeUrl;
return profile;
}
@@ -69,14 +70,7 @@ public class MinecraftCapesAPI implements JsonAPILoader.IJsonAPI {
}
public static class MinecraftCapesApiResponse {
public boolean animatedCape;
public boolean capeGlint;
public boolean upsideDown;
public MinecraftCapesApiTexture textures;
public static class MinecraftCapesApiTexture {
public String cape;
public String ears;
}
@SerializedName("cape_url")
public String capeUrl;
}
}
@@ -47,4 +47,4 @@ public class LIFOBlockingQueue<E> extends ForwardingBlockingQueue<E> {
public E peek() {
return deque.peekFirst();
}
}
}
@@ -6,7 +6,6 @@ import java.util.UUID;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import com.mojang.authlib.properties.PropertyMap;
import com.mojang.authlib.yggdrasil.response.MinecraftProfilePropertiesResponse;
import com.mojang.authlib.yggdrasil.response.MinecraftTexturesPayload;
import customskinloader.CustomSkinLoader;
@@ -45,9 +44,7 @@ public class TextureUtil {
GAME_PROFILE_NAME(GameProfile.class, "name"),
GAME_PROFILE_PROPERTIES(GameProfile.class, "properties"),
PROPERTY_VALUE(Property.class, "value"),
PROPERTY_MAP_PROPERTIES(PropertyMap.class, "properties"),
MINECRAFT_PROFILE_PROPERTIES_RESPONSE_ID(MinecraftProfilePropertiesResponse.class, "id"),
MINECRAFT_PROFILE_PROPERTIES_RESPONSE_NAME(MinecraftProfilePropertiesResponse.class, "name"),
MINECRAFT_PROFILE_PROPERTIES_RESPONSE_PROPERTIES(MinecraftProfilePropertiesResponse.class, "properties"),
MINECRAFT_TEXTURES_PAYLOAD_TEXTURES(MinecraftTexturesPayload.class, "textures");
@@ -0,0 +1,89 @@
package customskinloader.dummy;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import com.google.common.collect.BiMap;
import com.google.common.collect.Sets;
public class FakeBiMap<K, V> implements BiMap<K, V> {
private final Map<K, V> map = new HashMap<K, V>();
public static <K, V> BiMap<K, V> create(BiMap<K, V> map) {
return new FakeBiMap<>();
}
private FakeBiMap() {
}
@Override
public int size() {
return this.map.size();
}
@Override
public boolean isEmpty() {
return this.map.isEmpty();
}
@Override
public boolean containsKey(Object key) {
return this.map.containsKey(key);
}
@Override
public boolean containsValue(Object value) {
return this.map.containsValue(value);
}
@Override
public V get(Object key) {
return this.map.get(key);
}
@Override
public V put(K k, V v) {
return this.map.put(k, v);
}
@Override
public V remove(Object key) {
return this.map.remove(key);
}
@Override
public V forcePut(K k, V v) {
return this.map.put(k, v);
}
@Override
public void putAll(Map<? extends K, ? extends V> map) {
this.map.putAll(map);
}
@Override
public void clear() {
this.map.clear();
}
@Override
public Set<K> keySet() {
return this.map.keySet();
}
@Override
public Set<V> values() {
return Sets.newHashSet(this.map.values());
}
@Override
public Set<Entry<K, V>> entrySet() {
return this.map.entrySet();
}
@Override
public BiMap<V, K> inverse() {
throw new UnsupportedOperationException();
}
}
@@ -0,0 +1,4 @@
package net.minecraft.client.renderer.rendertype;
public class RenderType {
}
@@ -0,0 +1,9 @@
package net.minecraft.client.renderer.rendertype;
import net.minecraft.resources.Identifier;
public class RenderTypes {
public static RenderType entityTranslucent(Identifier identifier) {
return null;
}
}
@@ -1,9 +1,11 @@
package net.minecraft.client.renderer.texture;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.resources.Identifier;
import net.minecraft.util.ResourceLocation;
public class SimpleTexture extends ReloadableTexture implements ITextureObject {
public SimpleTexture(ResourceLocation location) {}
public SimpleTexture(Identifier identifier) {}
public TextureContents loadContents(IResourceManager resourceManager) { return null; }
}
@@ -1,5 +1,6 @@
package net.minecraft.client.renderer.texture;
import net.minecraft.resources.Identifier;
import net.minecraft.util.ResourceLocation;
public class TextureManager {
@@ -7,4 +8,5 @@ public class TextureManager {
public void loadTexture(ResourceLocation location, AbstractTexture texture) {}
public boolean loadTexture(ResourceLocation location, ITextureObject texture) { return false; }
public void registerAndLoad(ResourceLocation resourceLocation, ReloadableTexture reloadableTexture) {}
public void registerAndLoad(Identifier identifier, ReloadableTexture reloadableTexture) {}
}
@@ -1,7 +1,11 @@
package net.minecraft.client.resources;
import java.util.Optional;
import net.minecraft.resources.Identifier;
import net.minecraft.util.ResourceLocation;
public interface IResourceManager {
IResource getResource(ResourceLocation location);
Optional getResource(Identifier Identifier);
}
@@ -0,0 +1,7 @@
package net.minecraft.resources;
public class Identifier {
public static Identifier fromNamespaceAndPath(String namespace, String path) {
return null;
}
}
+8 -1
View File
@@ -2,7 +2,7 @@ customskinloader/fake/itf/IFakeIResource$V1 customskinloader/fake/itf/IFakeIReso
func_199027_b ()Ljava/io/InputStream; method_14482
customskinloader/fake/itf/IFakeIResource$V2 customskinloader/fake/itf/IFakeIResource$V2
open ()Ljava/io/InputStream; method_14482
customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeIResourceManager
customskinloader/fake/itf/IFakeIResourceManager$V1 customskinloader/fake/itf/IFakeIResourceManager$V1
func_199002_a (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/resources/IResource; method_14486
getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; method_14486
customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft
@@ -29,6 +29,9 @@ 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/rendertype/RenderType net/minecraft/class_1921
net/minecraft/client/renderer/rendertype/RenderTypes net/minecraft/class_12249
entityTranslucent (Lnet/minecraft/resources/Identifier;)Lnet/minecraft/client/renderer/rendertype/RenderType; method_76000
net/minecraft/client/renderer/texture/AbstractTexture net/minecraft/class_1044
net/minecraft/client/renderer/texture/ITextureObject net/minecraft/class_1062
net/minecraft/client/renderer/texture/NativeImage net/minecraft/class_1011
@@ -49,12 +52,14 @@ 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/AbstractTexture;)V method_4616
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z method_4616
registerAndLoad (Lnet/minecraft/resources/Identifier;Lnet/minecraft/client/renderer/texture/ReloadableTexture;)V method_65876
registerAndLoad (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ReloadableTexture;)V method_65876
net/minecraft/client/resources/DefaultPlayerSkin net/minecraft/class_1068
getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; method_4648
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/resources/Identifier;)Ljava/util/Optional; method_14486
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
@@ -67,6 +72,8 @@ net/minecraft/client/resources/SkinManager$TextureCache net/minecraft/class_1071
net/minecraft/client/resources/data/TextureMetadataSection net/minecraft/class_1084
net/minecraft/resources/IResource net/minecraft/class_3298
net/minecraft/resources/IResourceManager net/minecraft/class_3300
net/minecraft/resources/Identifier net/minecraft/class_2960
fromNamespaceAndPath (Ljava/lang/String;Ljava/lang/String;)Lnet/minecraft/resources/Identifier; method_60655
net/minecraft/server/Services net/minecraft/class_7497
net/minecraft/util/ResourceLocation net/minecraft/class_2960
net/minecraft/util/StringUtils net/minecraft/class_3544
+2 -2
View File
@@ -1,5 +1,5 @@
dependencies=Fabric|1.14,1.14.1,1.14.2,1.14.3,1.14.4,1.15,1.15.1,1.15.2,1.16,1.16.1,1.16.2,1.16.3,1.16.4,1.16.5,1.17,1.17.1,1.18,1.18.1,1.18.2,1.19,1.19.1,1.19.2,1.19.3,1.19.4,1.20,1.20.1,1.20.2,1.20.3,1.20.4,1.20.5,1.20.6,1.21,1.21.1,1.21.2,1.21.3,1.21.4,1.21.5,1.21.6,1.21.7,1.21.8,1.21.9,1.21.10;\
Quilt|1.14,1.14.1,1.14.2,1.14.3,1.14.4,1.15,1.15.1,1.15.2,1.16,1.16.1,1.16.2,1.16.3,1.16.4,1.16.5,1.17,1.17.1,1.18,1.18.1,1.18.2,1.19,1.19.1,1.19.2,1.19.3,1.19.4,1.20,1.20.1,1.20.2,1.20.3,1.20.4,1.20.5,1.20.6,1.21,1.21.1,1.21.2,1.21.3,1.21.4,1.21.5,1.21.6,1.21.7,1.21.8,1.21.9,1.21.10
dependencies=Fabric|1.14,1.14.1,1.14.2,1.14.3,1.14.4,1.15,1.15.1,1.15.2,1.16,1.16.1,1.16.2,1.16.3,1.16.4,1.16.5,1.17,1.17.1,1.18,1.18.1,1.18.2,1.19,1.19.1,1.19.2,1.19.3,1.19.4,1.20,1.20.1,1.20.2,1.20.3,1.20.4,1.20.5,1.20.6,1.21,1.21.1,1.21.2,1.21.3,1.21.4,1.21.5,1.21.6,1.21.7,1.21.8,1.21.9,1.21.10,1.21.11;\
Quilt|1.14,1.14.1,1.14.2,1.14.3,1.14.4,1.15,1.15.1,1.15.2,1.16,1.16.1,1.16.2,1.16.3,1.16.4,1.16.5,1.17,1.17.1,1.18,1.18.1,1.18.2,1.19,1.19.1,1.19.2,1.19.3,1.19.4,1.20,1.20.1,1.20.2,1.20.3,1.20.4,1.20.5,1.20.6,1.21,1.21.1,1.21.2,1.21.3,1.21.4,1.21.5,1.21.6,1.21.7,1.21.8,1.21.9,1.21.10,1.21.11
java_full_versions=8,9,10,11,12,13,14,15,16,17,18,19,20,21,22
#forge gradle needs forge version
forge_mc_version=1.12.2
+7
View File
@@ -3,10 +3,12 @@ net/minecraft/client/Minecraft net/minecraft/class_310
isIntegratedServerRunning ()Z method_1542
net/minecraft/client/entity/AbstractClientPlayer net/minecraft/class_742
net/minecraft/client/gui/Gui net/minecraft/class_332
net/minecraft/client/gui/GuiGraphicsExtractor net/minecraft/client/gui/GuiGraphicsExtractor
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
renderPlayerlist (Lnet/minecraft/client/gui/Gui;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V method_1919
renderPlayerlist (Lnet/minecraft/client/gui/GuiGraphicsExtractor;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V extractRenderState
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
@@ -27,8 +29,12 @@ net/minecraft/client/renderer/entity/layers/LayerCape net/minecraft/class_972
doRenderLayer (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;ILnet/minecraft/client/renderer/entity/state/AvatarRenderState;FF)V method_4177
net/minecraft/client/renderer/entity/state/AvatarRenderState net/minecraft/class_10055
net/minecraft/client/renderer/entity/state/PlayerRenderState net/minecraft/class_10055
net/minecraft/client/renderer/rendertype/RenderType net/minecraft/class_1921
net/minecraft/client/renderer/rendertype/RenderTypes net/minecraft/class_12249
entitySolid (Lnet/minecraft/resources/Identifier;)Lnet/minecraft/client/renderer/rendertype/RenderType; method_75982
net/minecraft/client/renderer/texture/NativeImage net/minecraft/class_1011
net/minecraft/client/renderer/texture/SkinTextureDownloader net/minecraft/class_10538
downloadAndRegisterSkin (Lnet/minecraft/resources/Identifier;Ljava/nio/file/Path;Ljava/lang/String;Z)Ljava/util/concurrent/CompletableFuture; method_65861
downloadAndRegisterSkin (Lnet/minecraft/util/ResourceLocation;Ljava/nio/file/Path;Ljava/lang/String;Z)Ljava/util/concurrent/CompletableFuture; method_65861
lambda$downloadAndRegisterSkin$0 (Ljava/nio/file/Path;Ljava/lang/String;Z)Lnet/minecraft/client/renderer/texture/NativeImage; method_65866
lambda$downloadAndRegisterSkin$0 (Ljava/nio/file/Path;Lnet/minecraft/core/ClientAsset$DownloadedTexture;Z)Lnet/minecraft/client/renderer/texture/NativeImage; method_65866
@@ -54,6 +60,7 @@ net/minecraft/client/resources/SkinManager$TextureCache net/minecraft/class_1071
registerTexture (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Ljava/util/concurrent/CompletableFuture; method_52873
net/minecraft/client/resources/SkinManager$TextureInfo net/minecraft/class_1071$class_8688
net/minecraft/core/ClientAsset$DownloadedTexture net/minecraft/class_12079$class_12080
net/minecraft/resources/Identifier net/minecraft/class_2960
net/minecraft/scoreboard/ScoreObjective net/minecraft/class_266
net/minecraft/scoreboard/Scoreboard net/minecraft/class_269
net/minecraft/server/Services net/minecraft/class_7497
@@ -52,7 +52,7 @@ public class DevEnvRemapper extends SimpleRemapper {
remappedClasses.put(
"net.minecraft.class_3300",
new AbstractMap.SimpleEntry<>(
Lists.newArrayList("customskinloader.fake.itf.IFakeIResourceManager"),
Lists.newArrayList("customskinloader.fake.itf.IFakeIResourceManager$V1", "customskinloader.fake.itf.IFakeIResourceManager$V2"),
Lists.newArrayList("customskinloader.fake.itf.FakeInterfaceManager")
)
);
@@ -1,6 +1,5 @@
accessWidener v2 intermediary
extendable class net/minecraft/class_1011 # 24w46a+
extendable class net/minecraft/class_1071$class_8686 # 23w31a+
extendable class net/minecraft/class_2960 # 24w46a+
accessible method net/minecraft/class_1071$class_8686 <init> (Ljava/util/UUID;Lcom/mojang/authlib/properties/Property;)V # 23w42a+
accessible method net/minecraft/class_2960 <init> (Ljava/lang/String;Ljava/lang/String;)V # 24w18a+
+5 -1
View File
@@ -17,5 +17,9 @@
"mixins": [
"mixins.customskinloader.json"
],
"accessWidener": "customskinloader.accesswidener"
"accessWidener": "customskinloader.accesswidener",
"depends": {
"minecraft": "<=1.21.11"
}
}
@@ -6,17 +6,22 @@
"MixinGuiPlayerTabOverlay",
"MixinIImageBuffer",
"MixinIResource",
"MixinIResourceManager",
"MixinLayerCape",
"MixinIResourceManager$V1",
"MixinLayerCape$V1",
"MixinLayerCape$V2",
"MixinMinecraft",
"MixinNativeImage",
"MixinRenderPlayer",
"MixinResourceLocation$V1",
"MixinResourceLocation$V2",
"MixinSkinManager$1",
"MixinSkinManager$TextureCache",
"MixinSkinManager$V1",
"MixinSkinManager$V2",
"MixinSkinManager$V3",
"MixinSkinTextureDownloader",
"MixinSkinTextureDownloader$V1",
"MixinSkinTextureDownloader$V2",
"MixinSkinTextureDownloader$V3",
"MixinThreadDownloadImageData$V1",
"MixinThreadDownloadImageData$V2"
],
@@ -56,7 +56,7 @@ public class FakeInterfacesTransformer {
public static class ClientIResourceManagerTransformer implements TransformerManager.IClassTransformer {
@Override
public ClassNode transform(ClassNode cn) {
cn.interfaces.add("customskinloader/fake/itf/IFakeIResourceManager");
cn.interfaces.add("customskinloader/fake/itf/IFakeIResourceManager$V1");
cn.interfaces.add("net/minecraft/resources/IResourceManager");
return cn;
}
+1 -1
View File
@@ -225,7 +225,7 @@ function initializeCoreMod() {
'name': 'net/minecraft/resources/IResourceManager'
},
'transformer': function (cn) {
cn.interfaces.add("customskinloader/fake/itf/IFakeIResourceManager");
cn.interfaces.add("customskinloader/fake/itf/IFakeIResourceManager$V1");
cn.interfaces.add("net/minecraft/client/resources/IResourceManager");
return cn;
}
+8 -1
View File
@@ -2,7 +2,7 @@ customskinloader/fake/itf/IFakeIResource$V1 customskinloader/fake/itf/IFakeIReso
func_199027_b ()Ljava/io/InputStream; m_6679_
customskinloader/fake/itf/IFakeIResource$V2 customskinloader/fake/itf/IFakeIResource$V2
open ()Ljava/io/InputStream; m_215507_
customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeIResourceManager
customskinloader/fake/itf/IFakeIResourceManager$V1 customskinloader/fake/itf/IFakeIResourceManager$V1
func_199002_a (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/resources/IResource; m_142591_
getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; m_213713_
customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft
@@ -29,6 +29,9 @@ 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/rendertype/RenderType net/minecraft/client/renderer/rendertype/RenderType
net/minecraft/client/renderer/rendertype/RenderTypes net/minecraft/client/renderer/rendertype/RenderTypes
entityTranslucent (Lnet/minecraft/resources/Identifier;)Lnet/minecraft/client/renderer/rendertype/RenderType; entityTranslucent
net/minecraft/client/renderer/texture/AbstractTexture net/minecraft/client/renderer/texture/AbstractTexture
net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject
net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/NativeImage
@@ -49,12 +52,14 @@ net/minecraft/client/renderer/texture/TextureManager net/minecraft/client/render
getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; func_110581_b
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/AbstractTexture;)V m_118495_
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z func_110579_a
registerAndLoad (Lnet/minecraft/resources/Identifier;Lnet/minecraft/client/renderer/texture/ReloadableTexture;)V registerAndLoad
registerAndLoad (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ReloadableTexture;)V registerAndLoad
net/minecraft/client/resources/DefaultPlayerSkin net/minecraft/client/resources/DefaultPlayerSkin
getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; m_118627_
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/resources/Identifier;)Ljava/util/Optional; getResource
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_
@@ -67,6 +72,8 @@ net/minecraft/client/resources/SkinManager$TextureCache net/minecraft/client/res
net/minecraft/client/resources/data/TextureMetadataSection net/minecraft/client/resources/metadata/texture/TextureMetadataSection
net/minecraft/resources/IResource net/minecraft/server/packs/resources/Resource
net/minecraft/resources/IResourceManager net/minecraft/server/packs/resources/ResourceManager
net/minecraft/resources/Identifier net/minecraft/resources/Identifier
fromNamespaceAndPath (Ljava/lang/String;Ljava/lang/String;)Lnet/minecraft/resources/Identifier; fromNamespaceAndPath
net/minecraft/server/Services net/minecraft/server/Services
net/minecraft/util/ResourceLocation net/minecraft/resources/ResourceLocation
net/minecraft/util/StringUtils net/minecraft/util/StringUtil
+8 -8
View File
@@ -49,8 +49,6 @@ function initializeCoreMod() {
if (node.getOpcode() === Opcodes.RETURN) {
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 2));
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "setSkinCacheDir", "(Ljava/nio/file/Path;)V", false));
} else if (node.getOpcode() === Opcodes.INVOKEVIRTUAL && node.owner.equals("com/google/common/cache/CacheBuilder") && checkName(node.name, "build") && node.desc.equals("(Lcom/google/common/cache/CacheLoader;)Lcom/google/common/cache/LoadingCache;")) {
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "setCacheLoader", "(Lcom/google/common/cache/CacheLoader;)Lcom/google/common/cache/CacheLoader;", false));
}
}
} 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;")) { // 1.20.1-
@@ -120,11 +118,13 @@ function initializeCoreMod() {
} else if (checkName(mn.name, "m_293351_") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;)Ljava/util/concurrent/CompletableFuture;")) { // 1.20.2+
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
var node = iterator.next();
if (node.getOpcode() === Opcodes.INVOKESPECIAL && node.owner.equals("net/minecraft/client/resources/SkinManager$CacheKey") && checkName(node.name, "<init>") && node.desc.equals("(Ljava/util/UUID;Lcom/mojang/authlib/properties/Property;)V")) {
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "createProperty", "(Lcom/mojang/authlib/properties/Property;)Lcom/mojang/authlib/properties/Property;", false));
} else if (node.getOpcode() === Opcodes.INVOKEINTERFACE && node.owner.equals("com/google/common/cache/LoadingCache") && checkName(node.name, "getUnchecked") && node.desc.equals("(Ljava/lang/Object;)Ljava/lang/Object;")) {
if (node.getOpcode() === Opcodes.NEW && node.desc.equals("net/minecraft/client/resources/SkinManager$CacheKey")) {
iterator.remove();
iterator.next(); // DUP
iterator.remove();
} else if (node.getOpcode() === Opcodes.INVOKESPECIAL && node.owner.equals("net/minecraft/client/resources/SkinManager$CacheKey") && checkName(node.name, "<init>") && node.desc.equals("(Ljava/util/UUID;Lcom/mojang/authlib/properties/Property;)V")) {
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadCache", "(Ljava/lang/Object;Lcom/mojang/authlib/GameProfile;)Ljava/lang/Object;", false));
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager$FakeCacheKey", "createFakeCacheKey", "(Ljava/util/UUID;Lcom/mojang/authlib/properties/Property;Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/client/resources/SkinManager$CacheKey;", false));
}
}
}
@@ -163,7 +163,7 @@ function initializeCoreMod() {
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, "unpackTextures") && node.desc.equals("(Lcom/mojang/authlib/properties/Property;)Lcom/mojang/authlib/minecraft/MinecraftProfileTextures;")) {
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 0));
mn.instructions.insert(node, new TypeInsnNode(Opcodes.CHECKCAST, "com/mojang/authlib/minecraft/MinecraftProfileTextures"));
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadSkinFromCache", "(Lcom/mojang/authlib/minecraft/MinecraftSessionService;Lcom/mojang/authlib/properties/Property;Lnet/minecraft/client/resources/SkinManager$CacheKey;)Ljava/lang/Object;", false));
}
@@ -190,7 +190,7 @@ function initializeCoreMod() {
'name': 'net/minecraft/server/packs/resources/ResourceManager'
},
'transformer': function (cn) {
cn.interfaces.add("customskinloader/fake/itf/IFakeIResourceManager");
cn.interfaces.add("customskinloader/fake/itf/IFakeIResourceManager$V1");
return cn;
}
},
@@ -2,7 +2,7 @@ customskinloader/fake/itf/IFakeIResource$V1 customskinloader/fake/itf/IFakeIReso
func_199027_b ()Ljava/io/InputStream; getInputStream
customskinloader/fake/itf/IFakeIResource$V2 customskinloader/fake/itf/IFakeIResource$V2
open ()Ljava/io/InputStream; open
customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeIResourceManager
customskinloader/fake/itf/IFakeIResourceManager$V1 customskinloader/fake/itf/IFakeIResourceManager$V1
func_199002_a (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/resources/IResource; getResource
getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; getResource
customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft
@@ -29,6 +29,9 @@ 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/rendertype/RenderType net/minecraft/client/renderer/rendertype/RenderType
net/minecraft/client/renderer/rendertype/RenderTypes net/minecraft/client/renderer/rendertype/RenderTypes
entityTranslucent (Lnet/minecraft/resources/Identifier;)Lnet/minecraft/client/renderer/rendertype/RenderType; entityTranslucent
net/minecraft/client/renderer/texture/AbstractTexture net/minecraft/client/renderer/texture/AbstractTexture
net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject
net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/NativeImage
@@ -49,12 +52,14 @@ net/minecraft/client/renderer/texture/TextureManager net/minecraft/client/render
getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; getTexture
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/AbstractTexture;)V register
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z register
registerAndLoad (Lnet/minecraft/resources/Identifier;Lnet/minecraft/client/renderer/texture/ReloadableTexture;)V registerAndLoad
registerAndLoad (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ReloadableTexture;)V registerAndLoad
net/minecraft/client/resources/DefaultPlayerSkin net/minecraft/client/resources/DefaultPlayerSkin
getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; getDefaultSkin
net/minecraft/client/resources/IResource net/minecraft/server/packs/resources/Resource
getInputStream ()Ljava/io/InputStream; getInputStream
net/minecraft/client/resources/IResourceManager net/minecraft/server/packs/resources/ResourceManager
getResource (Lnet/minecraft/resources/Identifier;)Ljava/util/Optional; getResource
getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; getResource
net/minecraft/client/resources/SkinManager net/minecraft/client/resources/SkinManager
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V registerSkins
@@ -67,6 +72,8 @@ net/minecraft/client/resources/SkinManager$TextureCache net/minecraft/client/res
net/minecraft/client/resources/data/TextureMetadataSection net/minecraft/client/resources/metadata/texture/TextureMetadataSection
net/minecraft/resources/IResource net/minecraft/server/packs/resources/Resource
net/minecraft/resources/IResourceManager net/minecraft/server/packs/resources/ResourceManager
net/minecraft/resources/Identifier net/minecraft/resources/Identifier
fromNamespaceAndPath (Ljava/lang/String;Ljava/lang/String;)Lnet/minecraft/resources/Identifier; fromNamespaceAndPath
net/minecraft/server/Services net/minecraft/server/Services
net/minecraft/util/ResourceLocation net/minecraft/resources/ResourceLocation
net/minecraft/util/StringUtils net/minecraft/util/StringUtil
File renamed without changes.
@@ -1,8 +1,10 @@
dependencies=Forge|1.20.6,1.21,1.21.1,1.21.3,1.21.4,1.21.5,1.21.6,1.21.7,1.21.8,1.21.9,1.21.10;\
NeoForge|1.20.2,1.20.3,1.20.4,1.20.5,1.20.6,1.21,1.21.1,1.21.2,1.21.3,1.21.4,1.21.5,1.21.6,1.21.7,1.21.8,1.21.9,1.21.10
dependencies=Fabric|26.1;\
Forge|1.20.6,1.21,1.21.1,1.21.3,1.21.4,1.21.5,1.21.6,1.21.7,1.21.8,1.21.9,1.21.10,1.21.11,26.1;\
NeoForge|1.20.2,1.20.3,1.20.4,1.20.5,1.20.6,1.21,1.21.1,1.21.2,1.21.3,1.21.4,1.21.5,1.21.6,1.21.7,1.21.8,1.21.9,1.21.10,1.21.11,26.1;\
Quilt|26.1
java_full_versions=17,18,19,20,21,22
#forge gradle needs forge version
forge_mc_version=1.12.2
forge_version=14.23.5.2768
mappings_version=stable_39
srg_notch_map=Forge.tsrg
srg_notch_map=Universal.tsrg
@@ -3,10 +3,12 @@ net/minecraft/client/Minecraft net/minecraft/client/Minecraft
isIntegratedServerRunning ()Z isLocalServer
net/minecraft/client/entity/AbstractClientPlayer net/minecraft/client/player/AbstractClientPlayer
net/minecraft/client/gui/Gui net/minecraft/client/gui/GuiGraphics
net/minecraft/client/gui/GuiGraphicsExtractor net/minecraft/client/gui/GuiGraphicsExtractor
net/minecraft/client/gui/GuiPlayerTabOverlay net/minecraft/client/gui/components/PlayerTabOverlay
renderPlayerlist (ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V render
renderPlayerlist (Lcom/mojang/blaze3d/matrix/MatrixStack;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V render
renderPlayerlist (Lnet/minecraft/client/gui/Gui;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V render
renderPlayerlist (Lnet/minecraft/client/gui/GuiGraphicsExtractor;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V extractRenderState
net/minecraft/client/model/ModelRenderer net/minecraft/client/model/geom/ModelPart
net/minecraft/client/renderer/IImageBuffer net/minecraft/client/renderer/HttpTextureProcessor
net/minecraft/client/renderer/IRenderTypeBuffer net/minecraft/client/renderer/MultiBufferSource
@@ -27,8 +29,12 @@ net/minecraft/client/renderer/entity/layers/LayerCape net/minecraft/client/rende
doRenderLayer (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;ILnet/minecraft/client/renderer/entity/state/AvatarRenderState;FF)V submit
net/minecraft/client/renderer/entity/state/AvatarRenderState net/minecraft/client/renderer/entity/state/AvatarRenderState
net/minecraft/client/renderer/entity/state/PlayerRenderState net/minecraft/client/renderer/entity/state/PlayerRenderState
net/minecraft/client/renderer/rendertype/RenderType net/minecraft/client/renderer/rendertype/RenderType
net/minecraft/client/renderer/rendertype/RenderTypes net/minecraft/client/renderer/rendertype/RenderTypes
entitySolid (Lnet/minecraft/resources/Identifier;)Lnet/minecraft/client/renderer/rendertype/RenderType; entitySolid
net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/NativeImage
net/minecraft/client/renderer/texture/SkinTextureDownloader net/minecraft/client/renderer/texture/SkinTextureDownloader
downloadAndRegisterSkin (Lnet/minecraft/resources/Identifier;Ljava/nio/file/Path;Ljava/lang/String;Z)Ljava/util/concurrent/CompletableFuture; downloadAndRegisterSkin
downloadAndRegisterSkin (Lnet/minecraft/util/ResourceLocation;Ljava/nio/file/Path;Ljava/lang/String;Z)Ljava/util/concurrent/CompletableFuture; downloadAndRegisterSkin
lambda$downloadAndRegisterSkin$0 (Ljava/nio/file/Path;Ljava/lang/String;Z)Lnet/minecraft/client/renderer/texture/NativeImage; lambda$downloadAndRegisterSkin$0
lambda$downloadAndRegisterSkin$0 (Ljava/nio/file/Path;Lnet/minecraft/core/ClientAsset$DownloadedTexture;Z)Lnet/minecraft/client/renderer/texture/NativeImage; lambda$downloadAndRegisterSkin$0
@@ -54,6 +60,7 @@ net/minecraft/client/resources/SkinManager$TextureCache net/minecraft/client/res
registerTexture (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Ljava/util/concurrent/CompletableFuture; registerTexture
net/minecraft/client/resources/SkinManager$TextureInfo net/minecraft/client/resources/SkinManager$TextureInfo
net/minecraft/core/ClientAsset$DownloadedTexture net/minecraft/core/ClientAsset$DownloadedTexture
net/minecraft/resources/Identifier net/minecraft/resources/Identifier
net/minecraft/scoreboard/ScoreObjective net/minecraft/world/scores/Objective
net/minecraft/scoreboard/Scoreboard net/minecraft/world/scores/Scoreboard
net/minecraft/server/Services net/minecraft/server/Services
@@ -1,5 +1,4 @@
public-f com.mojang.blaze3d.platform.NativeImage # 24w46a+
public-f net.minecraft.client.resources.SkinManager$CacheKey # 23w42a+
public-f net.minecraft.resources.ResourceLocation # 24w46a+
public net.minecraft.client.resources.SkinManager$CacheKey <init>(Ljava/util/UUID;Lcom/mojang/authlib/properties/Property;)V # 23w42a+
public net.minecraft.resources.ResourceLocation <init>(Ljava/lang/String;Ljava/lang/String;)V # 24w18a+
@@ -0,0 +1,4 @@
accessWidener v2 official
extendable class com/mojang/blaze3d/platform/NativeImage # 24w46a+
extendable class net/minecraft/client/resources/SkinManager$CacheKey # 23w31a+
accessible method net/minecraft/client/resources/SkinManager$CacheKey <init> (Ljava/util/UUID;Lcom/mojang/authlib/properties/Property;)V # 23w42a+
@@ -0,0 +1,25 @@
{
"schemaVersion": 1,
"id": "customskinloader",
"version": "${modFullVersion}",
"name": "CustomSkinLoader",
"description": "Custom Skin Loader for Minecraft",
"authors": ["xfl03", "JLChnToZ", "ZekerZhayard"],
"contact": {
"homepage": "https://github.com/xfl03/MCCustomSkinLoader",
"issues": "https://github.com/xfl03/MCCustomSkinLoader/issues",
"sources": "https://github.com/xfl03/MCCustomSkinLoader"
},
"license": "GPL-3.0-only",
"environment": "client",
"mixins": [
"mixins.customskinloader.json"
],
"accessWidener": "customskinloader.accesswidener",
"depends": {
"minecraft": ">1.21.11"
}
}
@@ -5,16 +5,22 @@
"client": [
"MixinGuiPlayerTabOverlay",
"MixinIResource",
"MixinIResourceManager",
"MixinLayerCape",
"MixinIResourceManager$V1",
"MixinIResourceManager$V2",
"MixinLayerCape$V1",
"MixinLayerCape$V2",
"MixinMinecraft",
"MixinNativeImage",
"MixinRenderPlayer",
"MixinResourceLocation$V1",
"MixinResourceLocation$V2",
"MixinSkinManager$1",
"MixinSkinManager$TextureCache",
"MixinSkinManager$V1",
"MixinSkinManager$V3",
"MixinSkinTextureDownloader",
"MixinSkinTextureDownloader$V1",
"MixinSkinTextureDownloader$V2",
"MixinSkinTextureDownloader$V3",
"MixinThreadDownloadImageData$V2"
],
"refmap": "mixins.customskinloader.refmap.json",
@@ -13,7 +13,8 @@ public abstract class MixinGuiPlayerTabOverlay {
method = {
"Lnet/minecraft/client/gui/GuiPlayerTabOverlay;renderPlayerlist(ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V", // 20w16a-
"Lnet/minecraft/client/gui/GuiPlayerTabOverlay;renderPlayerlist(Lcom/mojang/blaze3d/matrix/MatrixStack;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V", // 20w17a ~ 23w14a
"Lnet/minecraft/client/gui/GuiPlayerTabOverlay;renderPlayerlist(Lnet/minecraft/client/gui/Gui;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V" // 23w16a+
"Lnet/minecraft/client/gui/GuiPlayerTabOverlay;renderPlayerlist(Lnet/minecraft/client/gui/Gui;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V", // 23w16a ~ 26.1-snapshot-11
"Lnet/minecraft/client/gui/GuiPlayerTabOverlay;renderPlayerlist(Lnet/minecraft/client/gui/GuiGraphicsExtractor;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V" // 26.1-pre-1+
},
at = @At(
value = "INVOKE",
@@ -1,10 +1,25 @@
package customskinloader.mixin;
import java.util.Optional;
import customskinloader.fake.itf.IFakeIResourceManager;
import customskinloader.fake.itf.IFakeResourceLocation;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.resources.Identifier;
import org.spongepowered.asm.mixin.Mixin;
@Mixin(IResourceManager.class)
public interface MixinIResourceManager extends IFakeIResourceManager {
public abstract class MixinIResourceManager {
@Mixin(IResourceManager.class)
public interface V1 extends IFakeIResourceManager.V1 {
}
// 25w45a+
@Mixin(IResourceManager.class)
public interface V2 extends IFakeIResourceManager.V2 {
@Override
default Optional getResource(IFakeResourceLocation location) {
return ((IResourceManager) this).getResource((Identifier) location);
}
}
}
@@ -2,31 +2,55 @@ package customskinloader.mixin;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.layers.LayerCape;
import net.minecraft.client.renderer.rendertype.RenderTypes;
import net.minecraft.resources.Identifier;
import net.minecraft.util.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(
value = LayerCape.class,
priority = 990
)
@SuppressWarnings("target")
public abstract class MixinLayerCape {
@Redirect(
method = {
"Lnet/minecraft/client/renderer/entity/layers/LayerCape;doRenderLayer(Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;FFFFFFF)V", // 19w39a ~ 19w44a
"Lnet/minecraft/client/renderer/entity/layers/LayerCape;doRenderLayer(Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;FFFFFF)V", // 19w45a ~ 1.21.1
"Lnet/minecraft/client/renderer/entity/layers/LayerCape;doRenderLayer(Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/renderer/entity/state/PlayerRenderState;FF)V", // 24w33a ~ 1.21.8
"Lnet/minecraft/client/renderer/entity/layers/LayerCape;doRenderLayer(Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;ILnet/minecraft/client/renderer/entity/state/AvatarRenderState;FF)V" // 25w31a+
},
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/RenderType;getEntitySolid(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType;"
),
require = 0
// 19w39a ~ 25w42a
@Mixin(
value = LayerCape.class,
priority = 990
)
private RenderType redirect_doRenderLayer(ResourceLocation locationIn) {
return RenderType.func_228644_e_(locationIn);
public abstract static class V1 {
@Redirect(
method = {
"Lnet/minecraft/client/renderer/entity/layers/LayerCape;doRenderLayer(Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;FFFFFFF)V", // 19w39a ~ 19w44a
"Lnet/minecraft/client/renderer/entity/layers/LayerCape;doRenderLayer(Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;FFFFFF)V", // 19w45a ~ 1.21.1
"Lnet/minecraft/client/renderer/entity/layers/LayerCape;doRenderLayer(Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/renderer/entity/state/PlayerRenderState;FF)V", // 24w33a ~ 1.21.8
"Lnet/minecraft/client/renderer/entity/layers/LayerCape;doRenderLayer(Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;ILnet/minecraft/client/renderer/entity/state/AvatarRenderState;FF)V" // 25w31a ~ 25w42a
},
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/RenderType;getEntitySolid(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType;"
),
require = 0
)
private RenderType redirect_doRenderLayer(ResourceLocation locationIn) {
return RenderType.func_228644_e_(locationIn);
}
}
// 25w43a+
@Mixin(
value = LayerCape.class,
priority = 990
)
public abstract static class V2 {
@Redirect(
method = "Lnet/minecraft/client/renderer/entity/layers/LayerCape;doRenderLayer(Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;ILnet/minecraft/client/renderer/entity/state/AvatarRenderState;FF)V", // 25w43a+
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/rendertype/RenderTypes;entitySolid(Lnet/minecraft/resources/Identifier;)Lnet/minecraft/client/renderer/rendertype/RenderType;"
),
require = 0
)
private net.minecraft.client.renderer.rendertype.RenderType redirect_doRenderLayer(Identifier identifier) {
return RenderTypes.entityTranslucent(identifier);
}
}
}
@@ -1,10 +1,21 @@
package customskinloader.mixin;
import customskinloader.fake.itf.IFakeNativeImage;
import customskinloader.fake.texture.FakeNativeImage;
import net.minecraft.client.renderer.texture.NativeImage;
import org.spongepowered.asm.mixin.Mixin;
@Mixin(NativeImage.class)
public abstract class MixinNativeImage implements IFakeNativeImage {
private FakeNativeImage fakeImage;
@Override
public FakeNativeImage getFakeImage() {
return this.fakeImage;
}
@Override
public void setFakeImage(FakeNativeImage fakeImage) {
this.fakeImage = fakeImage;
}
}
@@ -0,0 +1,39 @@
package customskinloader.mixin;
import customskinloader.fake.FakeMinecraftProfileTexture;
import customskinloader.fake.itf.IFakeResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.util.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
public abstract class MixinResourceLocation {
@Mixin(ResourceLocation.class)
public abstract static class V1 implements IFakeResourceLocation {
private FakeMinecraftProfileTexture texture;
@Override
public FakeMinecraftProfileTexture getTexture() {
return this.texture;
}
@Override
public void setTexture(FakeMinecraftProfileTexture texture) {
this.texture = texture;
}
}
@Mixin(Identifier.class)
public abstract static class V2 implements IFakeResourceLocation {
private FakeMinecraftProfileTexture texture;
@Override
public FakeMinecraftProfileTexture getTexture() {
return this.texture;
}
@Override
public void setTexture(FakeMinecraftProfileTexture texture) {
this.texture = texture;
}
}
}
@@ -37,7 +37,7 @@ public abstract class MixinSkinManager$TextureCache {
args.setAll(argsArr);
}
// 23w46a+
// 24w46a ~ 25w45a
@Group(
name = "modifyArgs_registerTexture",
min = 1
@@ -57,4 +57,25 @@ public abstract class MixinSkinManager$TextureCache {
argsArr = FakeSkinManager.createThreadDownloadImageData(ImmutableList.copyOf(argsArr), profileTexture, this.type);
args.setAll(argsArr);
}
// 25w46a+
@Group(
name = "modifyArgs_registerTexture",
min = 1
)
@ModifyArgs(
method = "Lnet/minecraft/client/resources/SkinManager$TextureCache;registerTexture(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Ljava/util/concurrent/CompletableFuture;",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/texture/SkinTextureDownloader;downloadAndRegisterSkin(Lnet/minecraft/resources/Identifier;Ljava/nio/file/Path;Ljava/lang/String;Z)Ljava/util/concurrent/CompletableFuture;"
)
)
private void modifyArgs_registerTexture_2(Args args, MinecraftProfileTexture profileTexture) {
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), profileTexture, this.type);
args.setAll(argsArr);
}
}
@@ -22,7 +22,6 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Coerce;
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.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@@ -242,20 +241,6 @@ public abstract class MixinSkinManager {
// 23w42a+
@Mixin(SkinManager.class)
public abstract static class V3 {
@ModifyArg(
method = {
"Lnet/minecraft/client/resources/SkinManager;getOrLoad(Lcom/mojang/authlib/GameProfile;)Ljava/util/concurrent/CompletableFuture;", // 23w42a ~ 25w33a
"Lnet/minecraft/client/resources/SkinManager;get(Lcom/mojang/authlib/GameProfile;)Ljava/util/concurrent/CompletableFuture;" // 25w34a+
},
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/resources/SkinManager$CacheKey;<init>(Ljava/util/UUID;Lcom/mojang/authlib/properties/Property;)V"
)
)
private Property modifyArg_getOrLoad(Property property) {
return FakeSkinManager.createProperty(property);
}
@Redirect(
method = {
"Lnet/minecraft/client/resources/SkinManager;getOrLoad(Lcom/mojang/authlib/GameProfile;)Ljava/util/concurrent/CompletableFuture;", // 23w42a ~ 25w33a
@@ -6,6 +6,7 @@ import customskinloader.fake.FakeSkinBuffer;
import customskinloader.fake.texture.FakeThreadDownloadImageData;
import net.minecraft.client.renderer.texture.NativeImage;
import net.minecraft.client.renderer.texture.SkinTextureDownloader;
import net.minecraft.resources.Identifier;
import net.minecraft.util.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@@ -13,32 +14,55 @@ import org.spongepowered.asm.mixin.injection.ModifyArgs;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
@Mixin(SkinTextureDownloader.class)
@SuppressWarnings("target")
public abstract class MixinSkinTextureDownloader {
@ModifyArgs(
method = "Lnet/minecraft/client/renderer/texture/SkinTextureDownloader;downloadAndRegisterSkin(Lnet/minecraft/util/ResourceLocation;Ljava/nio/file/Path;Ljava/lang/String;Z)Ljava/util/concurrent/CompletableFuture;",
at = @At(
value = "INVOKE",
target = "Ljava/util/concurrent/CompletableFuture;thenCompose(Ljava/util/function/Function;)Ljava/util/concurrent/CompletableFuture;",
remap = false
// 24w46a ~ 25w44a
@Mixin(SkinTextureDownloader.class)
public abstract static class V1 {
@ModifyArgs(
method = "Lnet/minecraft/client/renderer/texture/SkinTextureDownloader;downloadAndRegisterSkin(Lnet/minecraft/util/ResourceLocation;Ljava/nio/file/Path;Ljava/lang/String;Z)Ljava/util/concurrent/CompletableFuture;",
at = @At(
value = "INVOKE",
target = "Ljava/util/concurrent/CompletableFuture;thenCompose(Ljava/util/function/Function;)Ljava/util/concurrent/CompletableFuture;",
remap = false
)
)
)
private static void modifyArg_downloadAndRegisterSkin(Args args, ResourceLocation location, Path path, String url, boolean bl) {
args.set(0, FakeThreadDownloadImageData.createTexture(args.get(0), location, bl));
private static void modifyArg_downloadAndRegisterSkin(Args args, ResourceLocation location, Path path, String url, boolean bl) {
args.set(0, FakeThreadDownloadImageData.createTextureV1(args.get(0), location, bl));
}
}
@Redirect(
method = {
"Lnet/minecraft/client/renderer/texture/SkinTextureDownloader;lambda$downloadAndRegisterSkin$0(Ljava/nio/file/Path;Ljava/lang/String;Z)Lnet/minecraft/client/renderer/texture/NativeImage;", // 24w46a ~ 25w37a
"Lnet/minecraft/client/renderer/texture/SkinTextureDownloader;lambda$downloadAndRegisterSkin$0(Ljava/nio/file/Path;Lnet/minecraft/core/ClientAsset$DownloadedTexture;Z)Lnet/minecraft/client/renderer/texture/NativeImage;" // 1.21.9-pre1+
},
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/texture/SkinTextureDownloader;processLegacySkin(Lnet/minecraft/client/renderer/texture/NativeImage;Ljava/lang/String;)Lnet/minecraft/client/renderer/texture/NativeImage;"
// 24w46a+
@Mixin(SkinTextureDownloader.class)
public abstract static class V2 {
@Redirect(
method = {
"Lnet/minecraft/client/renderer/texture/SkinTextureDownloader;lambda$downloadAndRegisterSkin$0(Ljava/nio/file/Path;Ljava/lang/String;Z)Lnet/minecraft/client/renderer/texture/NativeImage;", // 24w46a ~ 25w37a
"Lnet/minecraft/client/renderer/texture/SkinTextureDownloader;lambda$downloadAndRegisterSkin$0(Ljava/nio/file/Path;Lnet/minecraft/core/ClientAsset$DownloadedTexture;Z)Lnet/minecraft/client/renderer/texture/NativeImage;" // 1.21.9-pre1+
},
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/texture/SkinTextureDownloader;processLegacySkin(Lnet/minecraft/client/renderer/texture/NativeImage;Ljava/lang/String;)Lnet/minecraft/client/renderer/texture/NativeImage;"
)
)
)
private static NativeImage redirect_lambda$downloadAndRegisterSkin$0(NativeImage image, String url) {
return FakeSkinBuffer.processLegacySkin(image, url);
private static NativeImage redirect_lambda$downloadAndRegisterSkin$0(NativeImage image, String url) {
return FakeSkinBuffer.processLegacySkin(image, url);
}
}
// 25w45a+
@Mixin(SkinTextureDownloader.class)
public abstract static class V3 {
@ModifyArgs(
method = "Lnet/minecraft/client/renderer/texture/SkinTextureDownloader;downloadAndRegisterSkin(Lnet/minecraft/resources/Identifier;Ljava/nio/file/Path;Ljava/lang/String;Z)Ljava/util/concurrent/CompletableFuture;",
at = @At(
value = "INVOKE",
target = "Ljava/util/concurrent/CompletableFuture;thenCompose(Ljava/util/function/Function;)Ljava/util/concurrent/CompletableFuture;",
remap = false
)
)
private static void modifyArg_downloadAndRegisterSkin(Args args, Identifier identifier, Path path, String url, boolean bl) {
args.set(0, FakeThreadDownloadImageData.createTextureV2(args.get(0), identifier, bl));
}
}
}
@@ -54,8 +54,10 @@ public class MixinConfigPlugin implements IMixinConfigPlugin {
boolean result = true;
if (mixinClassName.endsWith(".MixinIImageBuffer")) {
result = (this.world_version >= 0 && this.world_version <= 2204) && (this.protocol_version >= 0 && this.protocol_version <= 553); // 18w43b ~ 19w37a
} else if (mixinClassName.endsWith(".MixinLayerCape")) {
result = this.world_version >= 2210 && this.protocol_version >= 558; // 19w41a+
} else if (mixinClassName.endsWith(".MixinLayerCape$V1")) {
result = (this.world_version >= 2210 && this.world_version <= 4654) && ((this.protocol_version >= 558 && this.protocol_version <= 773) || (this.protocol_version >= 801 && this.protocol_version <= 803) || (this.protocol_version >= 0x40000001 && this.protocol_version <= 0x40000112)); // 19w41a ~ 25w42a
} else if (mixinClassName.endsWith(".MixinLayerCape$V2")) {
result = this.world_version >= 4655 && ((this.protocol_version >= 774 && this.protocol_version < 801) || (this.protocol_version > 803 && this.protocol_version < 0x40000001) || this.protocol_version >= 0x40000113); // 25w43a+
} else if (mixinClassName.endsWith(".MixinRenderPlayer")) {
result = (this.world_version >= 2210 && this.world_version <= 3955) && ((this.protocol_version >= 558 && this.protocol_version <= 767) || (this.protocol_version >= 801 && this.protocol_version <= 803) || (this.protocol_version >= 0x40000001 && this.protocol_version <= 0x400000CC)); // 19w41a ~ 1.21.1
} else if (mixinClassName.endsWith(".MixinSkinManager$V1")) {
@@ -66,8 +68,12 @@ public class MixinConfigPlugin implements IMixinConfigPlugin {
result = this.world_version >= 3684 && ((this.protocol_version >= 765 && this.protocol_version < 801) || (this.protocol_version > 803 && this.protocol_version < 0x40000001) || this.protocol_version >= 0x4000009D); // 23w42a+
} else if (mixinClassName.endsWith(".MixinSkinManager$1") || mixinClassName.endsWith(".MixinSkinManager$TextureCache")) {
result = this.world_version >= 3567 && ((this.protocol_version >= 764 && this.protocol_version < 801) || (this.protocol_version > 803 && this.protocol_version < 0x40000001) || this.protocol_version >= 0x40000090); // 23w31a+
} else if (mixinClassName.endsWith(".MixinSkinTextureDownloader")) {
} else if (mixinClassName.endsWith(".MixinSkinTextureDownloader$V1") || mixinClassName.endsWith(".MixinResourceLocation$V1")) {
result = (this.world_version >= 4178 && this.world_version <= 4659) && ((this.protocol_version >= 769 && this.protocol_version <= 773) || (this.protocol_version >= 0x400000DE && this.protocol_version <= 0x40000114)); // 24w46a ~ 25w44a
} else if (mixinClassName.endsWith(".MixinSkinTextureDownloader$V2")) {
result = this.world_version >= 4178 && ((this.protocol_version >= 769 && this.protocol_version < 801) || (this.protocol_version > 803 && this.protocol_version < 0x40000001) || this.protocol_version >= 0x400000DE); // 24w46a+
} else if (mixinClassName.endsWith(".MixinSkinTextureDownloader$V3") || mixinClassName.endsWith(".MixinIResourceManager$V2") || mixinClassName.endsWith(".MixinResourceLocation$V2")) {
result = this.world_version >= 4660 && ((this.protocol_version >= 774 && this.protocol_version < 801) || (this.protocol_version > 803 && this.protocol_version < 0x40000001) || this.protocol_version >= 0x40000115); // 25w45a+
} else if (mixinClassName.endsWith(".MixinThreadDownloadImageData$V1")) {
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(".MixinThreadDownloadImageData$V2")) {
+1 -1
View File
@@ -1,3 +1,3 @@
name=CustomSkinLoader
group=customskinloader
version=14.26.1
version=14.28
+90 -57
View File
@@ -26,39 +26,50 @@ configurations {
patchClass
}
void patch(Object dependency, Closure<Boolean> fileFilter, Closure<Boolean> classFilter, Closure<Boolean> methodFilter, Closure<Boolean> nodeFilter, Closure methodPathcer) {
void patch(Object dependency, Closure<Boolean> fileFilter, List<Map<String, Closure>> filters) {
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)
project.configurations.patchClass.findAll { fileFilter.call(it) }.each { File jarFile ->
def outputJar = file("${project.gradle.gradleUserHomeDir}/caches/customskinloader/libs/${jarFile.name}")
outputJar.parentFile.mkdirs()
new ZipOutputStream(new FileOutputStream(outputJar)).withCloseable { zos ->
new ZipFile(jarFile).withCloseable { zf ->
zf.entries().each { ZipEntry entry ->
if (entry.name.startsWith('META-INF/') && (entry.name.endsWith('.RSA') || entry.name.endsWith('.SF'))) {
return
}
def applicableFilters = filters.findAll { it.classFilter.call(entry.name) }
if (applicableFilters) {
def cn = new ClassNode()
new ClassReader(zf.getInputStream(entry).bytes).accept(cn, 0)
applicableFilters.each { filter ->
cn.methods.findAll { filter.methodFilter.call(it) }.each { method ->
method.instructions.toArray().findAll { filter.nodeFilter.call(it) }.each { filter.methodPatcher.call(method.instructions, it) }
}
}
def cw = new ClassWriter(ClassWriter.COMPUTE_MAXS)
cn.accept(cw)
zos.putNextEntry(new ZipEntry(entry.name))
zos.write(cw.toByteArray())
zos.closeEntry()
} else {
zos.putNextEntry(new ZipEntry(entry.name))
zos.write(zf.getInputStream(entry).bytes)
zos.closeEntry()
}
}
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 files(outputJar)
compile dependency
}
}
@@ -68,45 +79,67 @@ void patch(Object dependency, Closure<Boolean> fileFilter, Closure<Boolean> clas
// 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))
}
"org.cadixdev:mercury:0.1.0",
{ File f ->
f.name == "mercury-0.1.0.jar"
},
[
[
classFilter: { String name ->
name == "org/cadixdev/mercury/remapper/RemapperVisitor.class"
},
methodFilter: { MethodNode mn ->
mn.name == "remapType" && mn.desc == "(Lorg/eclipse/jdt/core/dom/SimpleName;Lorg/eclipse/jdt/core/dom/ITypeBinding;)V"
},
nodeFilter: { AbstractInsnNode node ->
node.opcode == Opcodes.ASTORE && node.var == 4
},
methodPatcher: { 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() {
// Mixin uses incorrect method for field descriptors to get the signature.
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))
}
"org.spongepowered:mixin:0.8.5",
{ File f ->
f.name == "mixin-0.8.5.jar"
},
[
[
classFilter: { String name ->
name == "org/spongepowered/tools/obfuscation/mirror/TypeHandleASM.class"
},
methodFilter: { MethodNode mn ->
mn.name == "findField" && mn.desc == "(Ljava/lang/String;Ljava/lang/String;Z)Lorg/spongepowered/tools/obfuscation/mirror/FieldHandle;"
},
nodeFilter: { 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;"
},
methodPatcher: { 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))
}
],
[
classFilter: { String name ->
name == "org/spongepowered/tools/obfuscation/mapping/common/MappingProvider.class"
},
methodFilter: { MethodNode mn ->
mn.name == "<init>" && mn.desc == "(Ljavax/annotation/processing/Messager;Ljavax/annotation/processing/Filer;)V"
},
nodeFilter: { AbstractInsnNode node ->
node.opcode == Opcodes.PUTFIELD && node.owner == "org/spongepowered/tools/obfuscation/mapping/common/MappingProvider" && node.desc == "Lcom/google/common/collect/BiMap;"
},
methodPatcher: { InsnList list, AbstractInsnNode node ->
list.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/dummy/FakeBiMap", "create", "(Lcom/google/common/collect/BiMap;)Lcom/google/common/collect/BiMap;", false))
}
]
]
)
}
+4 -3
View File
@@ -13,8 +13,9 @@ include "Forge/Common"
include "Forge/V1"
//Forge Edition for [1.17,1.20.4]
include "Forge/V2"
//Forge Edition for [1.20.5,) and NeoForge Edition for [1.20.2,)
include "Forge/V3"
//Fabric Edition for [1.14,)
//Fabric Edition for [26.1,), Forge Edition for [1.20.6,) and NeoForge Edition for [1.20.2,)
include "Universal"
//Fabric Edition for [1.14,1.21.11]
include "Fabric"