Skip to content

Commit

Permalink
Fix IllegalAccessError. (#317)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZekerZhayard authored Nov 12, 2024
1 parent aa68af3 commit 8e63429
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ public static int NativeImage_getPixel(Object nativeImage, int x, int y) {
return ((IFakeNativeImage) nativeImage).getPixel(x, y);
}

public static void NativeImage_setPixel(Object nativeImage, int x, int y, int color) {
((IFakeNativeImage) nativeImage).setPixel(x, y, color);
}

public static GameProfile SkinManagerCacheKey_profile(Object skinManagerCacheKey) {
return ((IFakeSkinManagerCacheKey) skinManagerCacheKey).profile();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ public interface IFakeNativeImage {
default int getPixel(int x, int y) {
return ((NativeImage) this).func_195709_a(x, y);
}

default void setPixel(int x, int y, int color) {
((NativeImage) this).func_195700_a(x, y, color);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public int getRGBA(int x, int y) {
}

public void setRGBA(int x, int y, int rgba) {
image.func_195700_a(x, y, rgba);
FakeInterfaceManager.NativeImage_setPixel(image, x, y, rgba);
}

public void copyImageData(FakeImage image) {
Expand Down
1 change: 1 addition & 0 deletions Fabric/Fabric.tsrg
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraf
func_195551_G ()Lnet/minecraft/resources/IResourceManager; method_1478
customskinloader/fake/itf/IFakeNativeImage customskinloader/fake/itf/IFakeNativeImage
getPixel (II)I method_61940
setPixel (III)V method_61941
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
16 changes: 15 additions & 1 deletion Fabric/src/main/java/customskinloader/fabric/DevEnvRemapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,17 @@ public class DevEnvRemapper extends SimpleRemapper {
Lists.newArrayList("customskinloader.fake.itf.FakeInterfaceManager")
)
);
remappedClasses.put(
"net.minecraft.class_1011",
new AbstractMap.SimpleEntry<>(
Lists.newArrayList("customskinloader.fake.itf.IFakeNativeImage"),
Lists.newArrayList("customskinloader.fake.itf.FakeInterfaceManager")
)
);
remappedClasses.put(
"net.minecraft.class_3298",
new AbstractMap.SimpleEntry<>(
Lists.newArrayList("customskinloader.fake.itf.IFakeIResource"),
Lists.newArrayList("customskinloader.fake.itf.IFakeIResource$V1", "customskinloader.fake.itf.IFakeIResource$V2"),
Lists.newArrayList("customskinloader.fake.itf.FakeInterfaceManager")
)
);
Expand All @@ -49,6 +56,13 @@ public class DevEnvRemapper extends SimpleRemapper {
Lists.newArrayList("customskinloader.fake.itf.FakeInterfaceManager")
)
);
remappedClasses.put(
"net.minecraft.class_1071$class_8686",
new AbstractMap.SimpleEntry<>(
Lists.newArrayList("customskinloader.fake.itf.IFakeSkinManagerCacheKey"),
Lists.newArrayList("customskinloader.fake.itf.FakeInterfaceManager")
)
);
}

@SuppressWarnings("unchecked")
Expand Down
1 change: 1 addition & 0 deletions Forge/V2/Forge.tsrg
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraf
func_195551_G ()Lnet/minecraft/resources/IResourceManager; m_91098_
customskinloader/fake/itf/IFakeNativeImage customskinloader/fake/itf/IFakeNativeImage
getPixel (II)I getPixel
setPixel (III)V setPixel
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
1 change: 1 addition & 0 deletions Forge/V3/Forge.tsrg
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraf
func_195551_G ()Lnet/minecraft/resources/IResourceManager; getResourceManager
customskinloader/fake/itf/IFakeNativeImage customskinloader/fake/itf/IFakeNativeImage
getPixel (II)I getPixel
setPixel (III)V setPixel
customskinloader/fake/itf/IFakeSkinManagerCacheKey customskinloader/fake/itf/IFakeSkinManagerCacheKey
profile ()Lcom/mojang/authlib/GameProfile; profile
packedTextures ()Lcom/mojang/authlib/properties/Property; packedTextures
Expand Down
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name=CustomSkinLoader
group=customskinloader
version=14.21.1
version=14.21.2

0 comments on commit 8e63429

Please sign in to comment.