From 81d62543a929aa018195bb6d847337353ea1f233 Mon Sep 17 00:00:00 2001 From: Gronglegrowth Date: Sun, 29 Sep 2024 09:38:51 -0400 Subject: [PATCH] models are overriden only if they need to be this prevents a stack overflow crash if the models are the same --- .../de/dafuqs/revelationary/mixin/client/BlockModelsMixin.java | 2 +- .../de/dafuqs/revelationary/mixin/client/ItemModelsMixin.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/dafuqs/revelationary/mixin/client/BlockModelsMixin.java b/src/main/java/de/dafuqs/revelationary/mixin/client/BlockModelsMixin.java index d86dc23..d6f40e2 100644 --- a/src/main/java/de/dafuqs/revelationary/mixin/client/BlockModelsMixin.java +++ b/src/main/java/de/dafuqs/revelationary/mixin/client/BlockModelsMixin.java @@ -26,7 +26,7 @@ public class BlockModelsMixin { @Inject(at = @At("HEAD"), method = "getModel", cancellable = true) private void getModel(BlockState blockState, CallbackInfoReturnable callbackInfoReturnable) { - if (ClientRevelationHolder.isCloaked(blockState)) { + if (ClientRevelationHolder.isCloaked(blockState) && !ClientRevelationHolder.getCloakTarget(blockState).equals(blockState)) { BlockState destinationBlockState = ClientRevelationHolder.getCloakTarget(blockState); BakedModel overriddenModel = this.models.getOrDefault(destinationBlockState, modelManager.getMissingModel()); callbackInfoReturnable.setReturnValue(overriddenModel); diff --git a/src/main/java/de/dafuqs/revelationary/mixin/client/ItemModelsMixin.java b/src/main/java/de/dafuqs/revelationary/mixin/client/ItemModelsMixin.java index bb1c6af..f8c0838 100644 --- a/src/main/java/de/dafuqs/revelationary/mixin/client/ItemModelsMixin.java +++ b/src/main/java/de/dafuqs/revelationary/mixin/client/ItemModelsMixin.java @@ -22,7 +22,7 @@ public abstract class ItemModelsMixin { @Inject(at = @At("HEAD"), method = "getModel(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/client/render/model/BakedModel;", cancellable = true) private void revelationary$getModel(ItemStack itemStack, CallbackInfoReturnable callbackInfoReturnable) { - if (ClientRevelationHolder.isCloaked(itemStack.getItem())) { + if (ClientRevelationHolder.isCloaked(itemStack.getItem()) && !ClientRevelationHolder.getCloakTarget(itemStack.getItem()).equals(itemStack.getItem())) { Item destinationItem = ClientRevelationHolder.getCloakTarget(itemStack.getItem()); BakedModel overriddenModel = getModel(destinationItem.getDefaultStack()); callbackInfoReturnable.setReturnValue(overriddenModel);