diff --git a/build.gradle.kts b/build.gradle.kts index 0c52bd0..850c8a1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -39,6 +39,10 @@ java { targetCompatibility = JavaVersion.valueOf("VERSION_${javaVersion}") } +loom { + accessWidenerPath = file("src/main/resources/${modId}.accesswidener") +} + modrinth { token = System.getenv("MODRINTH_TOKEN") ?: properties["modrinth_token"]?.toString() projectId = modId diff --git a/src/main/java/icu/puqns67/skintypefix/util/Utils.java b/src/main/java/icu/puqns67/skintypefix/util/Utils.java index e7796c5..91d3167 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/assets/skintypefix/lang/en_us.json b/src/main/resources/assets/skintypefix/lang/en_us.json index c213432..2cb839e 100644 --- a/src/main/resources/assets/skintypefix/lang/en_us.json +++ b/src/main/resources/assets/skintypefix/lang/en_us.json @@ -1,5 +1,5 @@ { - "modmenu.nameTranslation.skintypefix": "Skin type fix", - "modmenu.summaryTranslation.skintypefix": "Fix wrong skin type for some players.", - "modmenu.descriptionTranslation.skintypefix": "Fix an issue where the skin type of some players did not match the skin type of the actual skin file." + "modmenu.nameTranslation.skintypefix": "Skin type fix", + "modmenu.summaryTranslation.skintypefix": "Fix wrong skin type for some players.", + "modmenu.descriptionTranslation.skintypefix": "Fix an issue where the skin type of some players did not match the skin type of the actual skin file." } \ No newline at end of file diff --git a/src/main/resources/assets/skintypefix/lang/zh_cn.json b/src/main/resources/assets/skintypefix/lang/zh_cn.json index 130f646..0924ebc 100644 --- a/src/main/resources/assets/skintypefix/lang/zh_cn.json +++ b/src/main/resources/assets/skintypefix/lang/zh_cn.json @@ -1,5 +1,5 @@ { - "modmenu.nameTranslation.skintypefix": "皮肤类型修复", - "modmenu.summaryTranslation.skintypefix": "为部分玩家修复错误的皮肤类型。", - "modmenu.descriptionTranslation.skintypefix": "修复部分玩家的皮肤类型与实际皮肤文件的实际皮肤类型不匹配的问题。" + "modmenu.nameTranslation.skintypefix": "皮肤类型修复", + "modmenu.summaryTranslation.skintypefix": "为部分玩家修复错误的皮肤类型。", + "modmenu.descriptionTranslation.skintypefix": "修复部分玩家的皮肤类型与实际皮肤文件的实际皮肤类型不匹配的问题。" } \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 2f26524..f319f90 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,36 +1,37 @@ { - "schemaVersion": 1, - "id": "${mod_id}", - "name": "${mod_name}", - "version": "${mod_version}", - "description": "${mod_description}", - "authors": [ - "Puqns67" - ], - "contact": { - "homepage": "https://modrinth.com/project/skintypefix", - "sources": "https://github.com/Puqns67/SkinTypeFix" - }, - "license": "${mod_license}", - "icon": "assets/skintypefix/icon.png", - "environment": "client", - "entrypoints": { - "client": [ - "icu.puqns67.skintypefix.SkinTypeFix" - ] - }, - "mixins": [ - { - "config": "skintypefix.mixins.json", - "environment": "client" - } - ], - "depends": { - "java": ">=${java_version}", - "minecraft": "~${minecraft_version}", - "fabricloader": ">=${fabric_version}" - }, - "suggests": { - "another-mod": "*" - } + "schemaVersion": 1, + "id": "${mod_id}", + "name": "${mod_name}", + "version": "${mod_version}", + "description": "${mod_description}", + "authors": [ + "Puqns67" + ], + "contact": { + "homepage": "https://modrinth.com/project/skintypefix", + "sources": "https://github.com/Puqns67/SkinTypeFix" + }, + "license": "${mod_license}", + "icon": "assets/skintypefix/icon.png", + "environment": "client", + "entrypoints": { + "client": [ + "icu.puqns67.skintypefix.SkinTypeFix" + ] + }, + "accessWidener": "${mod_id}.accesswidener", + "mixins": [ + { + "config": "skintypefix.mixins.json", + "environment": "client" + } + ], + "depends": { + "java": ">=${java_version}", + "minecraft": "~${minecraft_version}", + "fabricloader": ">=${fabric_version}" + }, + "suggests": { + "another-mod": "*" + } } \ No newline at end of file diff --git a/src/main/resources/skintypefix.accesswidener b/src/main/resources/skintypefix.accesswidener new file mode 100644 index 0000000..0084980 --- /dev/null +++ b/src/main/resources/skintypefix.accesswidener @@ -0,0 +1,2 @@ +accessWidener v2 named +accessible method com/mojang/blaze3d/platform/NativeImage getPixelABGR (II)I