コード例 #1
0
ファイル: ItemApp.java プロジェクト: upidea/AcademyCraft
 @Override
 public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
   if (!world.isRemote) {
     TerminalData terminalData = TerminalData.get(player);
     if (!terminalData.isTerminalInstalled()) {
       player.addChatMessage(new ChatComponentTranslation("ac.terminal.notinstalled"));
     } else if (terminalData.isInstalled(app)) {
       player.addChatMessage(
           new ChatComponentTranslation("ac.terminal.app_alrdy_installed", app.getDisplayName()));
     } else {
       if (!player.capabilities.isCreativeMode) stack.stackSize--;
       terminalData.installApp(app);
       player.addChatMessage(
           new ChatComponentTranslation("ac.terminal.app_installed", app.getDisplayName()));
     }
   }
   return stack;
 }