diff options
author | Linnea Gräf <nea@nea.moe> | 2024-11-06 16:14:10 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-11-06 16:14:10 +0100 |
commit | ee21f2da76ea2218ef6a0c6fefa97befa654d115 (patch) | |
tree | aeefb78518a83d37a025673f6cadaa7d89d87449 /src/main/java/moe/nea/firmament/mixins/custommodels/HeadModelReplacerPatch.java | |
parent | ed3e9f0d70a758ac1c23c6c8d67eeb7105d13817 (diff) | |
download | Firmament-ee21f2da76ea2218ef6a0c6fefa97befa654d115.tar.gz Firmament-ee21f2da76ea2218ef6a0c6fefa97befa654d115.tar.bz2 Firmament-ee21f2da76ea2218ef6a0c6fefa97befa654d115.zip |
Fix model unwrapping
Diffstat (limited to 'src/main/java/moe/nea/firmament/mixins/custommodels/HeadModelReplacerPatch.java')
-rw-r--r-- | src/main/java/moe/nea/firmament/mixins/custommodels/HeadModelReplacerPatch.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/moe/nea/firmament/mixins/custommodels/HeadModelReplacerPatch.java b/src/main/java/moe/nea/firmament/mixins/custommodels/HeadModelReplacerPatch.java index 7518041..26c331e 100644 --- a/src/main/java/moe/nea/firmament/mixins/custommodels/HeadModelReplacerPatch.java +++ b/src/main/java/moe/nea/firmament/mixins/custommodels/HeadModelReplacerPatch.java @@ -35,7 +35,8 @@ public class HeadModelReplacerPatch<S extends LivingEntityRenderState, M extends private Block replaceSkull(BlockItem instance, Operation<Block> original, @Local BakedModel bakedModel) { var oldBlock = original.call(instance); if (oldBlock instanceof AbstractSkullBlock) { - if (bakedModel instanceof BakedModelExtra extra && extra.getHeadModel_firmament() != null) + var extra = BakedModelExtra.cast(bakedModel); + if (extra != null && extra.getHeadModel_firmament() != null) return Blocks.ENCHANTING_TABLE; // Any non skull block. Let's choose the enchanting table because it is very distinct. } return oldBlock; @@ -48,7 +49,8 @@ public class HeadModelReplacerPatch<S extends LivingEntityRenderState, M extends at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/feature/ArmorFeatureRenderer;hasModel(Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/EquipmentSlot;)Z")) private boolean replaceHasModel(ItemStack stack, EquipmentSlot slot, Operation<Boolean> original, @Local BakedModel bakedModel) { - if (bakedModel instanceof BakedModelExtra extra && extra.getHeadModel_firmament() != null) + var extra = BakedModelExtra.cast(bakedModel); + if (extra != null && extra.getHeadModel_firmament() != null) return false; return original.call(stack, slot); } |