aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/moe/nea/firmament/mixins/custommodels/HeadModelReplacerPatch.java
diff options
context:
space:
mode:
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);
}