Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Crafter

Hierarchy

Implements

Index

Constructors

constructor

Properties

Readonly accessibleItems

accessibleItems: Item[]

Optional after

after: Milestone[]

Readonly id

Optional Readonly imagePath

imagePath: undefined | string

isGlobal

isGlobal: boolean = false

Whether this milestone modifier is host-exclusive, IE, clients connecting to a server can't select this modifier.

Modifiers with custom options: IGameOptions are always host-exclusive.

Readonly random

Readonly recipe

recipe: Recipe

Methods

addDecay

  • addDecay(decay: number, weight?: number): this
  • Parameters

    • decay: number
    • Default value weight: number = 1

    Returns this

attemptCraft

  • Returns ICraftResult

forceResultQuality

  • forceResultQuality(quality?: Quality): this
  • Parameters

    Returns this

freeUsed

  • Returns whether the input could be "freed" (the requirement using it could use sth else instead).

    What is this for?

    A single input could be used for more than one thing in a recipe. Consider the following example:

    1. We have a recipe that takes any rock item, and an item from the "sharpened" group.
    2. We have only one sharpened rock and one large rock in our inventory.
    3. The recipe requirements are iterated through:
      • For the "any rock item" requirement, the first item that matches is "used". In this case, it's the "sharpened rock".
      • For the "sharpened group" requirement, the only remaining item is the large rock, so it doesn't match.
        • Since there were no items that matched the sharpened group, it looks back to the items already "used", and tries to "free" those items. That's this function.
        • Freeing an item means returning back to the requirement that used it, and checking if any other items will fit the requirement.
        • If any other items matched that item, this method returns true, and then the item can be used by the requirement that needed it to be freed.
        • In this example, the large rock also fits the "any rock item" requirement, so the sharpened rock is freed for use by the "sharpened group" requirement.

    Type parameters

    Parameters

    Returns boolean

getCrafter

  • Returns Entity

getDecay

  • getDecay(): number
  • Returns number

getForcedResultQuality

getGroup

getOptions

  • getOptions(resolve?: boolean): undefined | ({} & { milestoneModifiers?: undefined })
  • Parameters

    • Default value resolve: boolean = false

    Returns undefined | ({} & { milestoneModifiers?: undefined })

getQuality

  • getQuality(): Quality
  • Returns the quality of the output items. This is randomised for each call if the quality is not forced.

    Returns Quality

getQualityBonus

  • getQualityBonus(): number
  • Returns number

getRandom

getUsable

getUsed

initialize

  • initialize(): void

isEnabledForPlayer

  • isEnabledForPlayer(entity: Entity): any

tilesAroundCrafter

  • tilesAroundCrafter(includeCrafterTile?: boolean): Stream<any>
  • Gets a stream of the tiles around the crafter entity.

    Parameters

    • Default value includeCrafterTile: boolean = true

      Whether the tile the crafter is on should be included. Defaults to true.

    Returns Stream<any>

uninitialize

  • uninitialize(): void

use

Object literals

options

options: object

player

player: object

crafting

crafting: object

difficultyMultiplier

difficultyMultiplier: Mergeable<number> & number = Merge.MULTIPLY(1.25)

durabilityMultiplier

durabilityMultiplier: Mergeable<number> & number = Merge.MULTIPLY(1.40)

Generated using TypeDoc