aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/moe/nea
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/moe/nea')
-rw-r--r--src/main/java/moe/nea/firmament/mixins/custommodels/PatchArmorTexture.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/main/java/moe/nea/firmament/mixins/custommodels/PatchArmorTexture.java b/src/main/java/moe/nea/firmament/mixins/custommodels/PatchArmorTexture.java
new file mode 100644
index 0000000..bfbfcc5
--- /dev/null
+++ b/src/main/java/moe/nea/firmament/mixins/custommodels/PatchArmorTexture.java
@@ -0,0 +1,36 @@
+/*
+ * 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 moe.nea.firmament.features.texturepack.CustomGlobalArmorOverrides;
+import net.minecraft.client.render.entity.feature.ArmorFeatureRenderer;
+import net.minecraft.item.ArmorMaterial;
+import net.minecraft.item.ItemStack;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+
+import java.util.List;
+
+@Mixin(ArmorFeatureRenderer.class)
+public class PatchArmorTexture {
+ @WrapOperation(
+ method = "renderArmor",
+ at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ArmorMaterial;layers()Ljava/util/List;"))
+ private List<ArmorMaterial.Layer> overrideLayers(
+ ArmorMaterial instance,
+ Operation<List<ArmorMaterial.Layer>> original,
+ @Local ItemStack itemStack
+ ) {
+ var overrides = CustomGlobalArmorOverrides.overrideArmor(itemStack);
+ if (overrides == null)
+ return original.call(instance);
+ return overrides;
+ }
+}