Exemplo n.º 1
0
  private boolean onTick() {

    tickNumber++;

    // Not calling "cfgManager.makeSureConfigurationIsLoaded()" for performance reasons
    InvTweaksConfig config = cfgManager.getConfig();
    if (config == null) {
      return false;
    }

    // Clone the hotbar to be able to monitor changes on it
    if (itemPickupPending) {
      onItemPickup();
    }
    apn currentScreen = getCurrentScreen();
    if (currentScreen == null || isGuiInventory(currentScreen)) {
      cloneHotbar();
    }

    // Handle sort key changes
    if (sortingKeyCodeCache != getKeyCode(SORT_KEY_BINDING)) {
      if (sortingKeyCodeCache == -1) {
        sortingKeyCodeCache = getKeyCode(SORT_KEY_BINDING);
      } else {
        int keyCode = getKeyCode(SORT_KEY_BINDING);
        if (keyCode > 0) {
          config.setProperty(InvTweaksConfig.PROP_KEY_SORT_INVENTORY, Keyboard.getKeyName(keyCode));
        }
      }
    }

    handleConfigSwitch();

    return true;
  }
Exemplo n.º 2
0
  private boolean onTick() {

    tickNumber++;

    // Not calling "cfgManager.makeSureConfigurationIsLoaded()" for performance reasons
    InvTweaksConfig config = cfgManager.getConfig();
    if (config == null) {
      return false;
    }

    // Clone the hotbar to be able to monitor changes on it
    if (itemPickupPending) {
      onItemPickup();
    }
    aue currentScreen = getCurrentScreen();
    if (currentScreen == null || isGuiInventory(currentScreen)) {
      cloneHotbar();
    }

    // Handle sort key
    if (Keyboard.isKeyDown(config.getSortKeyCode())) {
      if (!sortKeyDown) {
        sortKeyDown = true;
        onSortingKeyPressed();
      }
    } else {
      sortKeyDown = false;
    }

    // Handle config switch
    handleConfigSwitch();

    return true;
  }