diff --git a/build.gradle.kts b/build.gradle.kts index eb35dc7..1902d7d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -36,6 +36,7 @@ java { neoForge { version = loaderVersion + validateAccessTransformers = true mods { register(modId) { diff --git a/src/main/java/icu/puqns67/skintypefix/util/Utils.java b/src/main/java/icu/puqns67/skintypefix/util/Utils.java index 3c7b6e3..858a6d2 100644 --- a/src/main/java/icu/puqns67/skintypefix/util/Utils.java +++ b/src/main/java/icu/puqns67/skintypefix/util/Utils.java @@ -28,9 +28,8 @@ public class Utils { var timesForSlim = new HashMap(); PlayerSkin.Model result = null; - // The result of NativeImage.getPixelRGBA() is ARGB, not RGBA, like 0xAARRGGBB - PLAYER_SKIN_DIFF_SLIM_TO_WILD.forEach(p -> timesForDiff.merge(image.getPixelRGBA(p.x(), p.y()), 1, Integer::sum)); - PLAYER_SKIN_SLIM.forEach(p -> timesForSlim.merge(image.getPixelRGBA(p.x(), p.y()), 1, Integer::sum)); + PLAYER_SKIN_DIFF_SLIM_TO_WILD.forEach(p -> timesForDiff.merge(image.getPixelABGR(p.x(), p.y()), 1, Integer::sum)); + PLAYER_SKIN_SLIM.forEach(p -> timesForSlim.merge(image.getPixelABGR(p.x(), p.y()), 1, Integer::sum)); var blackTimesForDiff = timesForDiff.getOrDefault(0xff000000, 0); var blackTimesForSlim = timesForSlim.getOrDefault(0xff000000, 0); diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg new file mode 100644 index 0000000..d75c08c --- /dev/null +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -0,0 +1 @@ +public com.mojang.blaze3d.platform.NativeImage getPixelABGR(II)I diff --git a/src/main/resources/META-INF/neoforge.mods.toml b/src/main/resources/META-INF/neoforge.mods.toml index 9d50017..9d240ce 100644 --- a/src/main/resources/META-INF/neoforge.mods.toml +++ b/src/main/resources/META-INF/neoforge.mods.toml @@ -12,6 +12,9 @@ logoFile="assets/${mod_id}/logo.png" authors="${mod_authors}" description='''${mod_description}''' +[[accessTransformers]] +file="META-INF/accesstransformer.cfg" + [[mixins]] config="${mod_id}.mixins.json"