diff options
author | Linnea Gräf <nea@nea.moe> | 2024-05-28 22:25:27 +0200 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-05-28 22:25:27 +0200 |
commit | fac6103658b2c8d6bab3598606d57041cfe16e0c (patch) | |
tree | fe7b5079075762c5028616802eed96a9e88f10f8 /src/main/java/moe/nea/firmament/mixins | |
parent | 8c66016bb3041793961375178d470546519e0e69 (diff) | |
download | Firmament-fac6103658b2c8d6bab3598606d57041cfe16e0c.tar.gz Firmament-fac6103658b2c8d6bab3598606d57041cfe16e0c.tar.bz2 Firmament-fac6103658b2c8d6bab3598606d57041cfe16e0c.zip |
Add armor texture overrides
Diffstat (limited to 'src/main/java/moe/nea/firmament/mixins')
-rw-r--r-- | src/main/java/moe/nea/firmament/mixins/custommodels/PatchArmorTexture.java | 36 |
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; + } +} |