Merge pull request #2738 from abel1502/abel-crates-shift

Make placing crates in the world require shift
This commit is contained in:
HbmMods 2026-04-27 08:06:27 +02:00 committed by GitHub
commit 300be53a3a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -36,6 +36,16 @@ public class ItemBlockStorageCrate extends ItemBlockBase implements IGUIProvider
return 1; 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() && Block.getBlockFromItem(stack.getItem()) != ModBlocks.mass_storage) {
return false;
}
return super.onItemUse(stack, player, world, x, y, z, side, hitX, hitY, hitZ);
}
@Override @Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
if(!ServerConfig.CRATE_OPEN_HELD.get()) return stack; if(!ServerConfig.CRATE_OPEN_HELD.get()) return stack;