Optimize Material and ItemStack handling