Exemplo n.º 1
0
 public void upgrade() {
   if (this.canUpgrade()) {
     if (ItemStackHelper.consume(
         this.inventoryItems, this.currentUpgradeOption.getUpgradeToCurentNeeds(), 3)) {
       this.villager.upgrade(this.currentUpgradeOption.getRegID());
       this.player.closeScreen();
     }
   }
 }
Exemplo n.º 2
0
  public void resetUpgradeOptionAndSlots() {
    Profession[] options = this.villager.getProfession().getUpgradeToNextOptions();
    this.currentUpgradeOption = options == null ? null : options[this.currentUpgradeOptionIndex];

    this.canUpgrade = false;
    if (this.currentUpgradeOption != null) {
      if (ItemStackHelper.match(
          this.inventoryItems, this.currentUpgradeOption.getUpgradeToCurentNeeds(), 3)) {
        this.canUpgrade = true;
      }
    }
  }