From 3adc91f43493d5bac80d4828fb83c0955898feed Mon Sep 17 00:00:00 2001 From: BlayTheNinth <1933180+BlayTheNinth@users.noreply.github.com> Date: Sat, 11 Jan 2025 18:17:50 +0100 Subject: [PATCH] fix: Fix crash when mod returns null container https://github.com/TwelveIterationMods/CookingForBlockheads/issues/747 --- .../main/java/net/blay09/mods/balm/fabric/FabricBalm.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fabric/src/main/java/net/blay09/mods/balm/fabric/FabricBalm.java b/fabric/src/main/java/net/blay09/mods/balm/fabric/FabricBalm.java index 57ce1d05..8765e30d 100644 --- a/fabric/src/main/java/net/blay09/mods/balm/fabric/FabricBalm.java +++ b/fabric/src/main/java/net/blay09/mods/balm/fabric/FabricBalm.java @@ -24,7 +24,8 @@ public class FabricBalm implements ModInitializer { - private static final SidedProxy proxy = sidedProxy("net.blay09.mods.balm.fabric.FabricBalmProxy", "net.blay09.mods.balm.fabric.client.FabricBalmClientProxy"); + private static final SidedProxy proxy = sidedProxy("net.blay09.mods.balm.fabric.FabricBalmProxy", + "net.blay09.mods.balm.fabric.client.FabricBalmClientProxy"); @Override public void onInitialize() { @@ -44,7 +45,10 @@ public void onInitialize() { ItemStorage.SIDED.registerFallback((world, pos, state, blockEntity, direction) -> { if (blockEntity instanceof BalmContainerProvider containerProvider) { - return InventoryStorage.of(containerProvider.getContainer(direction), direction); + final var container = containerProvider.getContainer(direction); + if (container != null) { + return InventoryStorage.of(container, direction); + } } return null;