From e72959d436ed31d1154f3ea4eca160474e14b1a1 Mon Sep 17 00:00:00 2001 From: abel1502 Date: Sat, 28 Feb 2026 14:19:40 +0100 Subject: [PATCH] Require shift to place crates in world Essentially makes crate opening from hand take priority over placing, if it is enabled at all. Not the other way round (shift forces opening, regular click places) because that would make it improssible to place a crate on an interactable block --- .../com/hbm/items/block/ItemBlockStorageCrate.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/hbm/items/block/ItemBlockStorageCrate.java b/src/main/java/com/hbm/items/block/ItemBlockStorageCrate.java index d7dab2a25..d7cf8e81e 100644 --- a/src/main/java/com/hbm/items/block/ItemBlockStorageCrate.java +++ b/src/main/java/com/hbm/items/block/ItemBlockStorageCrate.java @@ -36,6 +36,16 @@ public class ItemBlockStorageCrate extends ItemBlockBase implements IGUIProvider return 1; } + @Override + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { + // If crates can be opened from hand, prioritize this and require sneaking to place them + if (ServerConfig.CRATE_OPEN_HELD.get() && !player.isSneaking()) { + return false; + } + + return super.onItemUse(stack, player, world, x, y, z, side, hitX, hitY, hitZ); + } + @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { if(!ServerConfig.CRATE_OPEN_HELD.get()) return stack;