public void upgrade() { if (this.canUpgrade()) { if (ItemStackHelper.consume( this.inventoryItems, this.currentUpgradeOption.getUpgradeToCurentNeeds(), 3)) { this.villager.upgrade(this.currentUpgradeOption.getRegID()); this.player.closeScreen(); } } }
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; } } }