Skip to content

Commit

Permalink
1.21.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ZekerZhayard committed Oct 25, 2024
1 parent cdf2fbe commit 082f621
Show file tree
Hide file tree
Showing 14 changed files with 54 additions and 18 deletions.
18 changes: 7 additions & 11 deletions Common/src/main/java/customskinloader/fake/FakeSkinManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import com.mojang.authlib.minecraft.MinecraftSessionService;
import com.mojang.authlib.properties.Property;
import customskinloader.CustomSkinLoader;
import customskinloader.fake.itf.IFakeSkinManagerCacheKey;
import customskinloader.fake.itf.FakeInterfaceManager;
import customskinloader.loader.MojangAPILoader;
import customskinloader.profile.ModelManager0;
import customskinloader.profile.UserProfile;
Expand Down Expand Up @@ -217,21 +217,17 @@ public void skinAvailable() {

public static class FakeCacheKey {
public static Object wrapCacheKey(Object cacheKey, GameProfile profile) {
IFakeSkinManagerCacheKey fakeCacheKey = (IFakeSkinManagerCacheKey) cacheKey;
if (fakeCacheKey.profile() != null) {
return cacheKey; // 23w31a ~ 23w41a
} else {
TextureUtil.AuthlibField.PROPERTY_SIGNATURE.set(fakeCacheKey.packedTextures(), MojangAPILoader.GSON.toJson(profile, GameProfile.class));
return fakeCacheKey; // 23w42a+
if (FakeInterfaceManager.SkinManagerCacheKey_profile(cacheKey) == null) { // 23w42a+
TextureUtil.AuthlibField.PROPERTY_SIGNATURE.set(FakeInterfaceManager.SkinManagerCacheKey_packedTextures(cacheKey), MojangAPILoader.GSON.toJson(profile, GameProfile.class));
}
return cacheKey;
}

public static GameProfile unwrapCacheKey(Object cacheKey) {
IFakeSkinManagerCacheKey fakeCacheKey = (IFakeSkinManagerCacheKey) cacheKey;
if (fakeCacheKey.profile() != null) {
return fakeCacheKey.profile(); // 23w31a ~ 23w41a
if (FakeInterfaceManager.SkinManagerCacheKey_profile(cacheKey) != null) {
return FakeInterfaceManager.SkinManagerCacheKey_profile(cacheKey); // 23w31a ~ 23w41a
} else {
return unwrapProperty(fakeCacheKey.packedTextures()); // 23w42a+
return unwrapProperty(FakeInterfaceManager.SkinManagerCacheKey_packedTextures(cacheKey)); // 23w42a+
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import java.io.InputStream;
import java.util.Optional;

import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import net.minecraft.client.resources.IResource;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
Expand All @@ -20,4 +22,16 @@ public static Optional<IResource> IResourceManager_getResource(Object resourceMa
public static IResourceManager Minecraft_getResourceManager(Object minecraft) {
return (IResourceManager) ((IFakeMinecraft) minecraft).func_195551_G();
}

public static int NativeImage_getPixel(Object nativeImage, int x, int y) {
return ((IFakeNativeImage) nativeImage).getPixel(x, y);
}

public static GameProfile SkinManagerCacheKey_profile(Object skinManagerCacheKey) {
return ((IFakeSkinManagerCacheKey) skinManagerCacheKey).profile();
}

public static Property SkinManagerCacheKey_packedTextures(Object skinManagerCacheKey) {
return ((IFakeSkinManagerCacheKey) skinManagerCacheKey).packedTextures();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package customskinloader.fake.itf;

import net.minecraft.client.renderer.texture.NativeImage;

public interface IFakeNativeImage {
default int getPixel(int x, int y) {
return ((NativeImage) this).func_195709_a(x, y);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.io.InputStream;

import customskinloader.fake.itf.FakeInterfaceManager;
import net.minecraft.client.renderer.texture.NativeImage;

public class FakeNativeImage implements FakeImage {
Expand Down Expand Up @@ -36,7 +37,7 @@ public int getHeight() {
}

public int getRGBA(int x, int y) {
return image.func_195709_a(x, y);
return FakeInterfaceManager.NativeImage_getPixel(image, x, y);
}

public void setRGBA(int x, int y, int rgba) {
Expand Down
2 changes: 2 additions & 0 deletions Fabric/Fabric.tsrg
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeI
getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; method_14486
customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft
func_195551_G ()Lnet/minecraft/resources/IResourceManager; method_1478
customskinloader/fake/itf/IFakeNativeImage customskinloader/fake/itf/IFakeNativeImage
getPixel (II)I method_61940
customskinloader/fake/itf/IFakeSkinManagerCacheKey customskinloader/fake/itf/IFakeSkinManagerCacheKey
profile ()Lcom/mojang/authlib/GameProfile; comp_1631
packedTextures ()Lcom/mojang/authlib/properties/Property; comp_2011
Expand Down
4 changes: 2 additions & 2 deletions Fabric/build.properties
Original file line number Diff line number Diff line change
@@ -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;\
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
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;\
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
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
Expand Down
1 change: 0 additions & 1 deletion Fabric/src/main/resources/customskinloader.accesswidener
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
accessWidener v2 intermediary
accessible method net/minecraft/class_2960 <init> (Ljava/lang/String;Ljava/lang/String;)V # 24w18a+
accessible method net/minecraft/class_1011 method_4315 (II)I # 24w33a+
1 change: 1 addition & 0 deletions Fabric/src/main/resources/mixins.customskinloader.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"MixinIResourceManager",
"MixinLayerCape",
"MixinMinecraft",
"MixinNativeImage",
"MixinRenderPlayer",
"MixinSkinManager$1",
"MixinSkinManager$CacheKey",
Expand Down
2 changes: 2 additions & 0 deletions Forge/V2/Forge.tsrg
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeI
getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; m_213713_
customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft
func_195551_G ()Lnet/minecraft/resources/IResourceManager; m_91098_
customskinloader/fake/itf/IFakeNativeImage customskinloader/fake/itf/IFakeNativeImage
getPixel (II)I getPixel
customskinloader/fake/itf/IFakeSkinManagerCacheKey customskinloader/fake/itf/IFakeSkinManagerCacheKey
profile ()Lcom/mojang/authlib/GameProfile; f_290972_
packedTextures ()Lcom/mojang/authlib/properties/Property; f_303729_
Expand Down
2 changes: 2 additions & 0 deletions Forge/V3/Forge.tsrg
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeI
getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; getResource
customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft
func_195551_G ()Lnet/minecraft/resources/IResourceManager; getResourceManager
customskinloader/fake/itf/IFakeNativeImage customskinloader/fake/itf/IFakeNativeImage
getPixel (II)I getPixel
customskinloader/fake/itf/IFakeSkinManagerCacheKey customskinloader/fake/itf/IFakeSkinManagerCacheKey
profile ()Lcom/mojang/authlib/GameProfile; profile
packedTextures ()Lcom/mojang/authlib/properties/Property; packedTextures
Expand Down
4 changes: 2 additions & 2 deletions Forge/V3/build.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dependencies=Forge|1.20.6,1.21,1.21.1;\
NeoForge|1.20.2,1.20.3,1.20.4,1.20.5,1.20.6,1.21,1.21.1
dependencies=Forge|1.20.6,1.21,1.21.1,1.21.3;\
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
java_full_versions=17,18,19,20,21,22
#forge gradle needs forge version
forge_mc_version=1.12.2
Expand Down
1 change: 0 additions & 1 deletion Forge/V3/src/main/resources/META-INF/accesstransformer.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
public net.minecraft.resources.ResourceLocation <init>(Ljava/lang/String;Ljava/lang/String;)V # 24w18a+
public com.mojang.blaze3d.platform.NativeImage getPixelRGBA(II)I # 24w33a+
1 change: 1 addition & 0 deletions Forge/V3/src/main/resources/mixins.customskinloader.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"MixinIResourceManager",
"MixinLayerCape",
"MixinMinecraft",
"MixinNativeImage",
"MixinRenderPlayer",
"MixinSkinManager$1",
"MixinSkinManager$CacheKey",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package customskinloader.mixin;

import customskinloader.fake.itf.IFakeNativeImage;
import net.minecraft.client.renderer.texture.NativeImage;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(NativeImage.class)
public abstract class MixinNativeImage implements IFakeNativeImage {

}

0 comments on commit 082f621

Please sign in to comment.