public static SmartWrenchMode getCurrentMode(ItemStack itemStack) { SmartWrenchMode mode = SmartWrenchMode.MODE_WRENCH; NBTTagCompound tagCompound = itemStack.getTagCompound(); if (tagCompound != null) { String modeString = tagCompound.getString("mode"); if (modeString != null && !modeString.isEmpty()) { mode = SmartWrenchMode.getMode(modeString); } } return mode; }