From 4bc07d9cbf16e31e3da762ec01a80461ff5f2fe9 Mon Sep 17 00:00:00 2001 From: abel1502 Date: Mon, 2 Jun 2025 21:05:15 +0300 Subject: [PATCH] Add missing check --- .../hbm/blocks/generic/BlockStorageCrate.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/hbm/blocks/generic/BlockStorageCrate.java b/src/main/java/com/hbm/blocks/generic/BlockStorageCrate.java index cd088bd22..02784843f 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockStorageCrate.java +++ b/src/main/java/com/hbm/blocks/generic/BlockStorageCrate.java @@ -171,16 +171,18 @@ public class BlockStorageCrate extends BlockContainer implements IBlockMulti, IT } } - try { - byte[] abyte = CompressedStreamTools.compress(drop.stackTagCompound); + if (drop.hasTagCompound()) { + try { + byte[] abyte = CompressedStreamTools.compress(drop.stackTagCompound); - if(abyte.length > 6000) { - player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + "Warning: Container NBT exceeds 6kB, contents will be ejected!")); - world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(this))); - return world.setBlockToAir(x, y, z); - } + if(abyte.length > 6000) { + player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + "Warning: Container NBT exceeds 6kB, contents will be ejected!")); + world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(this))); + return world.setBlockToAir(x, y, z); + } - } catch(IOException e) { } + } catch(IOException e) { } + } world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, drop)); }