Skip to content

Commit

Permalink
Add gender mod integration for custom armor
Browse files Browse the repository at this point in the history
Closes #33
  • Loading branch information
nea89o committed Jul 5, 2024
1 parent c3d3255 commit 429eed9
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 3 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -61,13 +62,15 @@ 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"]
runtime_required = [
"architectury_fabric",
"rei_fabric",
"notenoughanimations",
"femalegender",
]
runtime_optional = [
"devauth",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* SPDX-FileCopyrightText: 2024 Linnea Gräf <[email protected]>
*
* 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()
));
}
}

0 comments on commit 429eed9

Please sign in to comment.