diff --git a/CHANGELOG.md b/CHANGELOG.md index 801a675799..e753a2f7bb 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### Fixed - Fixed all Refined Storage advancements being granted when joining a world. +- Fixed potential Pattern crash when loading Minecraft. ## [v1.10.0-beta.1] - 2021-12-15 diff --git a/src/main/java/com/refinedmods/refinedstorage/item/PatternItem.java b/src/main/java/com/refinedmods/refinedstorage/item/PatternItem.java index 499bb80c10..7187d20f7b 100644 --- a/src/main/java/com/refinedmods/refinedstorage/item/PatternItem.java +++ b/src/main/java/com/refinedmods/refinedstorage/item/PatternItem.java @@ -219,7 +219,7 @@ public BlockEntityWithoutLevelRenderer getItemStackRenderer() { public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltip, TooltipFlag flag) { super.appendHoverText(stack, level, tooltip, flag); - if (!stack.hasTag()) { + if (!stack.hasTag() || level == null) { return; } diff --git a/src/main/java/com/refinedmods/refinedstorage/render/blockentity/PatternItemBlockEntityRenderer.java b/src/main/java/com/refinedmods/refinedstorage/render/blockentity/PatternItemBlockEntityRenderer.java index 199cc8fea0..8829bdf921 100644 --- a/src/main/java/com/refinedmods/refinedstorage/render/blockentity/PatternItemBlockEntityRenderer.java +++ b/src/main/java/com/refinedmods/refinedstorage/render/blockentity/PatternItemBlockEntityRenderer.java @@ -22,7 +22,7 @@ public PatternItemBlockEntityRenderer(BlockEntityRenderDispatcher dispatcher, En @Override public void renderByItem(ItemStack stack, ItemTransforms.TransformType transformType, PoseStack poseStack, MultiBufferSource renderTypeBuffer, int combinedLight, int combinedOverlay) { - ICraftingPattern pattern = PatternItem.fromCache(null, stack); + ICraftingPattern pattern = PatternItem.fromCache(Minecraft.getInstance().level, stack); ItemStack outputStack = pattern.getOutputs().get(0);