コード例 #1
0
 private void doSalvage() {
   IPowerModule module = targetModule.getSelectedModule().getModule();
   MusePacket newpacket =
       new MusePacketSalvageModuleRequest(
           (Player) player, targetItem.getSelectedItem().inventorySlot, module.getName());
   player.sendQueue.addToSendQueue(newpacket.getPacket250());
 }
コード例 #2
0
 /**
  * Performs all the functions associated with the install button. This requires communicating with
  * the server.
  */
 private void doInstall() {
   ItemStack stack = targetItem.getSelectedItem().getItem();
   IPowerModule module = targetModule.getSelectedModule().getModule();
   if (player.capabilities.isCreativeMode
       || MuseItemUtils.hasInInventory(module.getInstallCost(), player.inventory)) {
     Musique.playClientSound(SoundLoader.SOUND_GUI_INSTALL, 1);
     // Now send request to server to make it legit
     MusePacket newpacket =
         new MusePacketInstallModuleRequest(
             (Player) player, targetItem.getSelectedItem().inventorySlot, module.getName());
     player.sendQueue.addToSendQueue(newpacket.getPacket250());
   }
 }
コード例 #3
0
  @Override
  public void tickEnd(EnumSet<TickType> type, Object... tickData) {
    EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;

    if (player != null) {
      if (slotSelected > -1) {
        player.inventory.currentItem = slotSelected;
        Minecraft.getMinecraft().playerController.updateController();
        ItemStack stack = player.inventory.getStackInSlot(slotSelected);
        if (stack != null && stack.getItem() instanceof IModularItem) {
          NBTTagCompound itemTag = MuseItemUtils.getMuseItemTag(stack);
          String mode = itemTag.getString("Mode");
          List<String> modes = MuseItemUtils.getModes(stack, player);
          if (mode.isEmpty() && modes.size() > 0) {
            mode = modes.get(0);
          }
          if (modes.size() > 0 && dWheel != 0) {
            int modeIndex = modes.indexOf(mode);
            String newMode = modes.get(clampMode(modeIndex + dWheel, modes.size()));
            itemTag.setString("Mode", newMode);
            RenderTickHandler.lastSwapTime = System.currentTimeMillis();
            RenderTickHandler.lastSwapDirection = (int) Math.signum(dWheel);
            MusePacket modeChangePacket =
                new MusePacketModeChangeRequest(
                    (Player) player, newMode, player.inventory.currentItem);
            player.sendQueue.addToSendQueue(modeChangePacket.getPacket250());
            dWheel = 0;
          }
        }
        slotSelected = -1;
      }
      PlayerInputMap inputmap = PlayerInputMap.getInputMapFor(player.username);
      inputmap.downKey =
          Keyboard.isKeyDown(Keyboard.KEY_Z) && Minecraft.getMinecraft().inGameHasFocus;
      inputmap.forwardKey = player.movementInput.moveForward;
      inputmap.strafeKey = player.movementInput.moveStrafe;
      inputmap.jumpKey = player.movementInput.jump;
      inputmap.sneakKey = player.movementInput.sneak;
      inputmap.motionX = player.motionX;
      inputmap.motionY = player.motionY;
      inputmap.motionZ = player.motionZ;

      MusePacket inputPacket = new MusePacketPlayerUpdate(player, inputmap);
      player.sendQueue.addToSendQueue(inputPacket.getPacket250());
    }
  }
コード例 #4
0
 @Override
 public void onMouseUp(double x, double y, int button) {
   if (selectedSlider != null
       && itemTarget.getSelectedItem() != null
       && moduleTarget.getSelectedModule() != null) {
     ClickableItem item = itemTarget.getSelectedItem();
     IPowerModule module = moduleTarget.getSelectedModule().getModule();
     MusePacket tweakRequest =
         new MusePacketTweakRequest(
             (Player) player,
             item.inventorySlot,
             module.getName(),
             selectedSlider.getName(),
             selectedSlider.getValue());
     player.sendQueue.addToSendQueue(tweakRequest.getPacket250());
   }
   if (button == 0) {
     selectedSlider = null;
   }
 }