diff options
-rw-r--r-- | build.gradle.kts | 2 | ||||
-rw-r--r-- | gradle/libs.versions.toml | 3 | ||||
-rw-r--r-- | src/main/java/moe/nea/firmament/mixins/custommodels/PatchArmorTexturesInGenderMod.java | 41 |
3 files changed, 46 insertions, 0 deletions
diff --git a/build.gradle.kts b/build.gradle.kts index aaee76d..33f018e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -142,6 +142,8 @@ dependencies { modCompileOnly(libs.jarvis.api) include(libs.jarvis.fabric) + modCompileOnly(libs.femalegender) + // Actual dependencies modCompileOnly(libs.rei.api) { exclude(module = "architectury") diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ba7713d..b63a839 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -17,6 +17,7 @@ citresewn = "1.1.3+1.20" sodium = "mc1.21-0.5.11" freecammod = "U5eR0FyR" ncr = "Fabric-1.21-v2.8.0" +femalegender = "kJmjQvAS" explosiveenhancement = "1.2.3-1.21.0" notenoughanimations = "WaI2x21x" @@ -61,6 +62,7 @@ citresewn = { module = "maven.modrinth:cit-resewn", version.ref = "citresewn" } ncr = { module = "maven.modrinth:no-chat-reports", version.ref = "ncr" } sodium = { module = "maven.modrinth:sodium", version.ref = "sodium" } freecammod = { module = "maven.modrinth:freecam", version.ref = "freecammod" } +femalegender = { module = "maven.modrinth:female-gender", version.ref = "femalegender" } [bundles] dbus = ["dbus_java_core", "dbus_java_unixsocket"] @@ -68,6 +70,7 @@ runtime_required = [ "architectury_fabric", "rei_fabric", "notenoughanimations", + "femalegender", ] runtime_optional = [ "devauth", diff --git a/src/main/java/moe/nea/firmament/mixins/custommodels/PatchArmorTexturesInGenderMod.java b/src/main/java/moe/nea/firmament/mixins/custommodels/PatchArmorTexturesInGenderMod.java new file mode 100644 index 0000000..833c7d9 --- /dev/null +++ b/src/main/java/moe/nea/firmament/mixins/custommodels/PatchArmorTexturesInGenderMod.java @@ -0,0 +1,41 @@ +/* + * SPDX-FileCopyrightText: 2024 Linnea Gräf <nea@nea.moe> + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +package moe.nea.firmament.mixins.custommodels; + +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import com.llamalad7.mixinextras.sugar.Local; +import com.wildfire.render.GenderArmorLayer; +import moe.nea.firmament.features.texturepack.CustomGlobalArmorOverrides; +import net.minecraft.item.ArmorItem; +import net.minecraft.item.ArmorMaterial; +import net.minecraft.item.ItemStack; +import net.minecraft.registry.entry.RegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +@Mixin(GenderArmorLayer.class) +public class PatchArmorTexturesInGenderMod { + @WrapOperation(method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/entity/LivingEntity;FFFFFF)V", + at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ArmorItem;getMaterial()Lnet/minecraft/registry/entry/RegistryEntry;")) + private RegistryEntry<ArmorMaterial> replaceArmorMaterial(ArmorItem instance, Operation<RegistryEntry<ArmorMaterial>> original, @Local ItemStack chestplate) { + var entry = original.call(instance); + var overrides = CustomGlobalArmorOverrides.overrideArmor(chestplate); + if (overrides == null) + return entry; + var material = entry.value(); + return RegistryEntry.of(new ArmorMaterial( + material.defense(), + material.enchantability(), + material.equipSound(), + material.repairIngredient(), + overrides, + material.toughness(), + material.knockbackResistance() + )); + } +} |