diff --git a/gradle.properties b/gradle.properties index 502d72f..28b3895 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,6 +8,6 @@ satin_version=1.8.0 sodium_version=mc1.19-0.4.2 iris_version=1.19.x-v1.2.5 -mod_version = 6.1.0 +mod_version = 6.1.1 maven_group = net.ludocrypt archives_base_name = limlib \ No newline at end of file diff --git a/src/main/java/net/ludocrypt/limlib/mixin/client/render/WorldRendererMixin.java b/src/main/java/net/ludocrypt/limlib/mixin/client/render/WorldRendererMixin.java index d5b9d51..eef7626 100644 --- a/src/main/java/net/ludocrypt/limlib/mixin/client/render/WorldRendererMixin.java +++ b/src/main/java/net/ludocrypt/limlib/mixin/client/render/WorldRendererMixin.java @@ -179,7 +179,9 @@ public void renderBlocks(Framebuffer framebuffer, float tickDelta, MatrixStack m matrices.translate(pos.getX() - camera.getPos().getX(), pos.getY() - camera.getPos().getY(), pos.getZ() - camera.getPos().getZ()); BakedModel model = MinecraftClient.getInstance().getBlockRenderManager().getModel(state); - LimlibRendering.LIMINAL_QUAD_RENDERER.get(((ModelAccess) model).getLiminalQuadRenderer().get()).renderModel(model, world, pos, state, matrices, camera); + if (((ModelAccess) model).getLiminalQuadRenderer().isPresent()) { + LimlibRendering.LIMINAL_QUAD_RENDERER.get(((ModelAccess) model).getLiminalQuadRenderer().get()).renderModel(model, world, pos, state, matrices, camera); + } matrices.pop(); }); diff --git a/src/main/java/net/ludocrypt/limlib/mixin/client/render/gui/ItemRendererMixin.java b/src/main/java/net/ludocrypt/limlib/mixin/client/render/gui/ItemRendererMixin.java index 05c80fa..15cefc8 100644 --- a/src/main/java/net/ludocrypt/limlib/mixin/client/render/gui/ItemRendererMixin.java +++ b/src/main/java/net/ludocrypt/limlib/mixin/client/render/gui/ItemRendererMixin.java @@ -31,18 +31,20 @@ public class ItemRendererMixin implements ItemRendererAccess { @Inject(method = "Lnet/minecraft/client/render/item/ItemRenderer;renderBakedItemModel(Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/item/ItemStack;IILnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;)V", at = @At("HEAD")) private void limlib$renderBakedItemModel(BakedModel model, ItemStack stack, int light, int overlay, MatrixStack matrices, VertexConsumer vertices, CallbackInfo ci) { - MinecraftClient client = MinecraftClient.getInstance(); + if (((ModelAccess) model).getLiminalQuadRenderer().isPresent()) { + MinecraftClient client = MinecraftClient.getInstance(); - boolean isHandRendering = ((WorldRendererAccess) client.worldRenderer).isRenderingHands() || (FabricLoader.getInstance().isModLoaded("iris") && ((IrisClientAccess) client).isHandRenderingActive()); - boolean isItemRendering = ((WorldRendererAccess) client.worldRenderer).isRenderingItems(); + boolean isHandRendering = ((WorldRendererAccess) client.worldRenderer).isRenderingHands() || (FabricLoader.getInstance().isModLoaded("iris") && ((IrisClientAccess) client).isHandRenderingActive()); + boolean isItemRendering = ((WorldRendererAccess) client.worldRenderer).isRenderingItems(); - if (isHandRendering || isItemRendering || inGui) { - MatrixStack matrixStack = new MatrixStack(); - matrixStack.multiplyPositionMatrix(matrices.peek().getPositionMatrix().copy()); - List immediateRenderer = Lists.newArrayList(); - LimlibRendering.LIMINAL_QUAD_RENDERER.get(((ModelAccess) model).getLiminalQuadRenderer().get()).renderItemModel(model, client.world, stack.copy(), matrixStack, client.gameRenderer.getCamera(), inGui); - immediateRenderer.forEach(Runnable::run); - immediateRenderer.clear(); + if (isHandRendering || isItemRendering || inGui) { + MatrixStack matrixStack = new MatrixStack(); + matrixStack.multiplyPositionMatrix(matrices.peek().getPositionMatrix().copy()); + List immediateRenderer = Lists.newArrayList(); + LimlibRendering.LIMINAL_QUAD_RENDERER.get(((ModelAccess) model).getLiminalQuadRenderer().get()).renderItemModel(model, client.world, stack.copy(), matrixStack, client.gameRenderer.getCamera(), inGui); + immediateRenderer.forEach(Runnable::run); + immediateRenderer.clear(); + } } }