Exemple #1
0
 @Override
 public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
   if (!world.isRemote) {
     SmartWrenchMode mode = getCurrentMode(stack);
     if (mode == SmartWrenchMode.MODE_WRENCH) {
       mode = SmartWrenchMode.MODE_SELECT;
     } else {
       mode = SmartWrenchMode.MODE_WRENCH;
     }
     NBTTagCompound tagCompound = stack.getTagCompound();
     if (tagCompound == null) {
       tagCompound = new NBTTagCompound();
       stack.setTagCompound(tagCompound);
     }
     tagCompound.setString("mode", mode.getCode());
     Logging.message(
         player,
         EnumChatFormatting.YELLOW + "Smart wrench is now in " + mode.getName() + " mode.");
   }
   return super.onItemRightClick(stack, world, player);
 }