コード例 #1
0
  public void onSelectionChanged(String oreName) {

    oreList = OreDictionaryArbiter.getOres(oreName);
    oreSelection = 0;

    lexiconInv.setInventorySlotContents(0, oreList.get(oreSelection));
    PacketTFBase.sendLexiconStudySelectPacketToServer(ContainerLexiconStudy.SELECT_ORE, (oreName));
  }
コード例 #2
0
  public void handlePacket(PacketTFBase payload) {

    switch (payload.getByte()) {
      case ORE_PREV:
        prevOre();
        return;
      case ORE_NEXT:
        nextOre();
        return;
      case SET_PREFERRED:
        doSetPreferred();
        return;
      case CLEAR_PREFERRED:
        doClearPreferred();
        return;
      case SELECT_ORE:
        String oreName = payload.getString();
        oreList = OreDictionaryArbiter.getOres(oreName);
        if (LexiconManager.hasPreferredStack(player, oreName)) {
          ItemStack ore = LexiconManager.getPreferredStack(player, oreName);
          lexiconInv.setInventorySlotContents(0, ore);
          for (int i = 0; i < oreList.size(); i++) {
            if (oreList.get(i) == ore) {
              oreSelection = i;
              break;
            }
          }
          hasPreferredStack = true;
        } else {
          lexiconInv.setInventorySlotContents(0, OreDictionaryArbiter.getOres(oreName).get(0));
          oreSelection = 0;
          hasPreferredStack = false;
        }
        syncClient = true;
      default:
    }
  }