Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ItemRequirement

Hierarchy

Index

Constructors

constructor

Properties

Readonly item

Readonly quantity

quantity: number

Readonly type

type: Item

Static Readonly BASE

BASE: ItemRequirement = new ItemRequirement(ItemType.None)

Methods

consumed

  • consumed(): boolean
  • Returns boolean

getChangeInto

  • Returns undefined | ItemOutput

getOutput

  • Returns the ItemOutput that this requirement is used for. This is called internally, it should have no real use in recipe construction.

    Returns undefined | Intermediate

getUsable

isMet

  • isMet(api: Crafter, quantity?: number): boolean
  • Parameters

    • api: Crafter
    • Default value quantity: number = this.quantity

    Returns boolean

setBestItem

  • setBestItem(item: Item): this
  • Sets the "best" item to be used for this requirement. Used to display the efficacy of an actual input item.

    Parameters

    Returns this

setChangeInto

  • setChangeInto(item: ItemType, initializer?: undefined | ((output: ItemOutput) => any)): this
  • Sets this item requirement to be changed into another item on recipe completion.

    Parameters

    • item: ItemType

      The item to change into.

    • Optional initializer: undefined | ((output: ItemOutput) => any)

      An initializer for configuring the item that the input will be changed into.

      Notes:

      • Using ChangeInto will ignore the Consumed setting
      • Configuring the quantity of the ItemOutput in the initializer will have no effect.

    Returns this

setConsumed

  • setConsumed(consumed?: boolean): this
  • Item requirements are consumed by default, so this method should usually only be used to disable that.

    Parameters

    • Default value consumed: boolean = true

    Returns this

setDecayWeight

  • setDecayWeight(weight: number): this
  • Sets this items used for this item requirement to contribute their decay to the output items at the given weight.

    The default weight is 1, so if there is one item at default weight and one item at a weight of 2, the final decay would be 66% of the 2 weight item and 33% of the 1 weight item.

    Parameters

    • weight: number

    Returns this

setInheritQualityFrom

  • setInheritQualityFrom(): this
  • Sets the quality of the output items to use the quality of the highest-quality item passed to this requirement. Note: The output items will only use this quality by default, it can still be overridden by the item outputs.

    Returns this

setOutputIntermediate

  • Sets the ItemOutput that this requirement will be used for. This is called internally, it should have no real use in recipe construction.

    Parameters

    Returns this

setPredicate

  • setPredicate(predicate: (item: Item, consumed: boolean) => boolean): this
  • Parameters

    • predicate: (item: Item, consumed: boolean) => boolean
        • (item: Item, consumed: boolean): boolean
        • Parameters

          • item: Item
          • consumed: boolean

          Returns boolean

    Returns this

Generated using TypeDoc