Support 1.21.11 (#359)

* Support 1.21.11

* Update supported versions
This commit is contained in:
ZekerZhayard authored and GitHub committed 2025-12-14 23:23:34 +08:00
1 parent 73c31593f2
commit 73beb4c29e
34 files changed
+513 -164

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?
@@ -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 {
/**
@@ -79,7 +78,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-
@@ -3,6 +3,7 @@ package customskinloader.fake.itf;
import java.io.InputStream;
import java.util.Optional;
import customskinloader.fake.FakeMinecraftProfileTexture;
import net.minecraft.client.resources.IResource;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
@@ -12,8 +13,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 +31,12 @@ public class FakeInterfaceManager {
public static void NativeImage_setPixel(Object nativeImage, int x, int y, int color) {
((IFakeNativeImage) nativeImage).setPixel(x, y, color);
}
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);
}
}
@@ -0,0 +1,9 @@
package customskinloader.fake.itf;
import customskinloader.fake.FakeMinecraftProfileTexture;
public interface IFakeResourceLocation {
FakeMinecraftProfileTexture getTexture();
void setTexture(FakeMinecraftProfileTexture texture);
}
@@ -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;
}
}
@@ -6,11 +6,13 @@ import java.util.function.Function;
import customskinloader.fake.FakeCapeBuffer;
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 +20,27 @@ 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 -> {
if (FakeInterfaceManager.ResourceLocation_getTexture(location) != null && _image instanceof FakeNativeImage.Extended) {
FakeSkinManager.BaseBuffer.judgeType(FakeInterfaceManager.ResourceLocation_getTexture(location), () -> FakeSkinBuffer.judgeType0(((FakeNativeImage.Extended) _image).getFakeImage()));
}
return function.apply(_image);
} : _image -> function.apply(_image).thenApply(cape.apply(_image));
}
public FakeThreadDownloadImageData(ResourceLocation location, FakeNativeImage image) {
@@ -36,6 +49,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);
@@ -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
+5
View File
@@ -27,8 +27,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 +58,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
@@ -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
+1 -1
View File
@@ -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;
}
},
+8 -1
View File
@@ -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
+2 -2
View File
@@ -1,5 +1,5 @@
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=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;\
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
java_full_versions=17,18,19,20,21,22
#forge gradle needs forge version
forge_mc_version=1.12.2
+5
View File
@@ -27,8 +27,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 +58,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
@@ -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",
@@ -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);
}
}
}
@@ -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);
}
}
@@ -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.27
+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))
}
]
]
)
}