diff options
author | Linnea Gräf <nea@nea.moe> | 2024-12-07 13:26:03 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-12-07 13:26:03 +0100 |
commit | bf7795df22ca7892fae1238403feebb57c005562 (patch) | |
tree | 3a49db5bade38498f976321b6e9008203f2d4d3b /src/texturePacks/java/moe/nea/firmament/mixins/custommodels/ReplaceItemModelPatch.java | |
parent | cdb5e60f52eea9030af9ca2d4a49913664023965 (diff) | |
download | Firmament-bf7795df22ca7892fae1238403feebb57c005562.tar.gz Firmament-bf7795df22ca7892fae1238403feebb57c005562.tar.bz2 Firmament-bf7795df22ca7892fae1238403feebb57c005562.zip |
WIP: Port to compilation on 1.21.4
Diffstat (limited to 'src/texturePacks/java/moe/nea/firmament/mixins/custommodels/ReplaceItemModelPatch.java')
-rw-r--r-- | src/texturePacks/java/moe/nea/firmament/mixins/custommodels/ReplaceItemModelPatch.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/ReplaceItemModelPatch.java b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/ReplaceItemModelPatch.java new file mode 100644 index 0000000..0863caa --- /dev/null +++ b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/ReplaceItemModelPatch.java @@ -0,0 +1,24 @@ +package moe.nea.firmament.mixins.custommodels; + + +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import moe.nea.firmament.events.CustomItemModelEvent; +import net.minecraft.client.item.ItemModelManager; +import net.minecraft.component.ComponentType; +import net.minecraft.item.ItemStack; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +@Mixin(ItemModelManager.class) +public class ReplaceItemModelPatch { + @WrapOperation( + method = "update(Lnet/minecraft/client/render/item/ItemRenderState;Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ModelTransformationMode;Lnet/minecraft/world/World;Lnet/minecraft/entity/LivingEntity;I)V", + at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;get(Lnet/minecraft/component/ComponentType;)Ljava/lang/Object;")) + private Object replaceItemModelByIdentifier(ItemStack instance, ComponentType componentType, Operation<Object> original) { + var override = CustomItemModelEvent.getModelIdentifier(instance); + if (override != null) + return override; + return original.call(instance, componentType); + } +} |