aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/moe/nea/firmament/mixins/custommodels/HeadModelReplacerPatch.java
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-11-06 16:14:10 +0100
committerLinnea Gräf <nea@nea.moe>2024-11-06 16:14:10 +0100
commitee21f2da76ea2218ef6a0c6fefa97befa654d115 (patch)
treeaeefb78518a83d37a025673f6cadaa7d89d87449 /src/main/java/moe/nea/firmament/mixins/custommodels/HeadModelReplacerPatch.java
parented3e9f0d70a758ac1c23c6c8d67eeb7105d13817 (diff)
downloadFirmament-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.java6
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);
}