Recipes
Index
Classes
Interfaces
Functions
- addFurnace
- addFurnaceFuel
- addShaped
- addShaped2
- addShapedGeneric
- addShapedVanilla
- addShapeless
- addShapelessGeneric
- addShapelessVanilla
- deleteRecipe
- getAllFurnaceRecipes
- getAllWorkbenchRecipes
- getFuelBurnDuration
- getFurnaceRecipeResult
- getFurnaceRecipesByResult
- getRecipeByField
- getRecipeResult
- getWorkbenchRecipesByIngredient
- getWorkbenchRecipesByResult
- provideRecipe
- provideRecipeForPlayer
- removeFurnaceFuel
- removeFurnaceRecipe
- removeWorkbenchRecipe
Classes
WorkbenchUIHandler
Class used to simplify creation of custom workbenches.
constructor
Constructs a new Workbench UI handler.
Parameters
target: ElementSet
target UI.WindowContent.elements section
targetCon: Container
target container
field: WorkbenchField
workbench field
Returns WorkbenchUIHandler
deselectCurrentRecipe
Deselects current recipe (asynchronously).
Returns void
refresh
Refreshes all the recipes in the workbench.
Returns number
Amount of recipes displayed.
refreshAsync
Runs recipes refresh in the ticking thread delaying refresh process for a tick. To get recipes count use WorkbenchUIHandler.setOnRefreshListener.
Returns void
setMaximumRecipesToShow
Sets workbench recipes displaying limit.
Parameters
count: number
count of the recipes to show
Returns void
setOnRefreshListener
Registers listener to be notified when the workbench starts and completes refreshing.
Parameters
listener: { onRefreshCompleted: (count: number) => void; onRefreshStarted: () => void }
workbench refresh listener
onRefreshCompleted: (count: number) => void
onRefreshStarted: () => void
Returns void
setOnSelectionListener
Registers listener to be notified when some recipe is selected.
Parameters
listener: { onRecipeSelected: (recipe: WorkbenchRecipe) => void }
recipe selection listener
onRecipeSelected: (recipe: WorkbenchRecipe) => void
Returns void
setPrefix
Sets custom workbench prefix.
Parameters
prefix: string
custom workbench prefix
Returns void
Interfaces
CraftingFunction
Parameters
api: WorkbenchFieldAPI
field: Slot[]
result: ItemInstance
player: number
Returns void
FurnaceRecipe
Object representing furnace recipe.
readonlyinData
readonlyinId
readonlyresData
readonlyresId
publicclone
Returns any
publicequals
Parameters
param0: any
Returns boolean
publicfinalize
Returns void
publicgetClass
Returns Class<any>
getInputKey
Returns number
getPrefix
Returns string
Recipe prefix.
getResult
Returns ItemInstance
Resulting item instance.
publichashCode
Returns number
isMatchingPrefix
Compares current recipe's prefix with given one.
Parameters
prefix: string
prefix value to compare with
Returns boolean
true
, if current recipe's prefix is the same as given one,false
otherwise.
isValid
Returns boolean
true
, if the recipe is valid,false
otherwise.
publicnotify
Returns void
publicnotifyAll
Returns void
setPrefix
Sets prefix value for the recipe.
Parameters
prefix: string
new prefix value
Returns void
publictoString
Returns string
publicwait
Returns void
RecipeEntry
Crafting recipe entry.
readonlydata
readonlyid
getCode
Returns number
getCodeByItem
Parameters
id: number
data: number
Returns number
getMask
Returns string
isMatching
Parameters
slot: AbstractSlot
slot to compare with
Returns boolean
true
if recipe entry matches the slot.
WorkbenchField
Object representing workbench field.
asScriptableField
Returns AbstractSlot[]
JS array of all slots.
getFieldSlot
Parameters
slot: number
slot index
Returns AbstractSlot
Workbench slot instance by slot index.
getWorkbenchFieldSize
- since: 2.2.1b106
Returns number
WorkbenchFieldAPI
Object used to work with workbench field in the craft function.
decreaseFieldSlot
Decreases item count in the specified slot, if possible.
Parameters
slot: number
slot index
Returns void
getFieldSize
- since: 2.2.1b106
Returns number
getFieldSlot
Parameters
slot: number
slot index
Returns Slot
Workbench slot instance by slot index.
isPrevented
Returns boolean
true
, if crafting event was prevented,false
otherwise.
prevent
Prevents crafting event.
Returns void
WorkbenchRecipe
Object representing workbench recipe.
addToVanillaWorkbench
Returns void
publicclone
Returns any
publicequals
Parameters
param0: any
Returns boolean
publicfinalize
Returns void
getCallback
Returns CraftingFunction
Current crafting function or null if no one was specified.
publicgetClass
Returns Class<any>
getEntry
Parameters
c: string
recipe entry character
Returns RecipeEntry
Recipe entry by entry character.
getEntryCodes
getEntryCollection
Returns Collection<RecipeEntry>
getPrefix
Returns string
Recipe prefix.
getRecipeMask
Returns string
Recipe unique mask identifier.
getRecipeUid
Returns number
getResult
Returns ItemInstance
Resulting item instance.
getSortedEntries
Returns Array<RecipeEntry>
All recipe's entries in a java array.
publichashCode
Returns number
isMatchingField
Parameters
field: WorkbenchField
workbench field to compare with
Returns boolean
true
if the field contains this recipe, false` otherwise.
isMatchingPrefix
Compares current recipe's prefix with given one.
Parameters
prefix: string
prefix value to compare with
Returns boolean
true
, if current recipe's prefix is the same as given one,false
otherwise.
isMatchingResult
Parameters
id: number
count: number
data: number
Returns boolean
true
if specified item is recipe's result,false
otherwise.
isPossibleForInventory
isValid
Returns boolean
true
, if the recipe is valid,false
otherwise.
isVanilla
Returns boolean
publicnotify
Returns void
publicnotifyAll
Returns void
provideRecipe
Parameters
field: WorkbenchField
Returns ItemInstance
provideRecipeForPlayer
Parameters
field: WorkbenchField
player: number
Returns ItemInstance
putIntoTheField
Tries to fill workbench field with current recipe.
Parameters
field: WorkbenchField
workbench field to fill
Returns void
setCallback
Sets craft function for the recipe.
Parameters
callback: CraftingFunction
function to be called on item craft
Returns void
setEntries
Parameters
entries: HashMap<Character, RecipeEntry>
Returns void
setPrefix
Sets prefix value for the recipe.
Parameters
prefix: string
new prefix value
Returns void
setVanilla
Parameters
isVanilla: boolean
Returns WorkbenchRecipe
Reference to itself to be used in sequential calls.
publictoString
Returns string
publicwait
Returns void
WorkbenchShapedRecipe
Object representing workbench shaped recipe.
addToVanillaWorkbench
Returns void
addVariants
Parameters
variants: ArrayList<WorkbenchRecipe>
Returns void
publicclone
Returns any
publicequals
Parameters
param0: any
Returns boolean
publicfinalize
Returns void
getCallback
Returns CraftingFunction
Current crafting function or null if no one was specified.
publicgetClass
Returns Class<any>
getEntry
Parameters
c: string
recipe entry character
Returns RecipeEntry
Recipe entry by entry character.
getEntryCodes
getEntryCollection
Returns Collection<RecipeEntry>
getPrefix
Returns string
Recipe prefix.
getRecipeMask
Returns string
Recipe unique mask identifier.
getRecipeUid
Returns number
getResult
Returns ItemInstance
Resulting item instance.
getSortedEntries
Returns Array<RecipeEntry>
All recipe's entries in a java array.
publichashCode
Returns number
isMatchingField
Parameters
field: WorkbenchField
workbench field to compare with
Returns boolean
true
if the field contains this recipe, false` otherwise.
isMatchingPrefix
Compares current recipe's prefix with given one.
Parameters
prefix: string
prefix value to compare with
Returns boolean
true
, if current recipe's prefix is the same as given one,false
otherwise.
isMatchingResult
Parameters
id: number
count: number
data: number
Returns boolean
true
if specified item is recipe's result,false
otherwise.
isPossibleForInventory
isValid
Returns boolean
true
, if the recipe is valid,false
otherwise.
isVanilla
Returns boolean
publicnotify
Returns void
publicnotifyAll
Returns void
provideRecipe
Parameters
field: WorkbenchField
Returns ItemInstance
provideRecipeForPlayer
Parameters
field: WorkbenchField
player: number
Returns ItemInstance
putIntoTheField
Tries to fill workbench field with current recipe.
Parameters
field: WorkbenchField
workbench field to fill
Returns void
setCallback
Sets craft function for the recipe.
Parameters
callback: CraftingFunction
function to be called on item craft
Returns void
setEntries
Parameters
entries: HashMap<Character, RecipeEntry>
Returns void
setPattern
Parameters
pattern: string[]
Returns void
setPrefix
Sets prefix value for the recipe.
Parameters
prefix: string
new prefix value
Returns void
setVanilla
Parameters
isVanilla: boolean
Returns WorkbenchRecipe
Reference to itself to be used in sequential calls.
publictoString
Returns string
publicwait
Returns void
WorkbenchShapelessRecipe
Object representing workbench shapeless recipe.
addToVanillaWorkbench
Returns void
addVariants
Parameters
variants: ArrayList<WorkbenchRecipe>
Returns void
publicclone
Returns any
publicequals
Parameters
param0: any
Returns boolean
publicfinalize
Returns void
getCallback
Returns CraftingFunction
Current crafting function or null if no one was specified.
publicgetClass
Returns Class<any>
getEntry
Parameters
c: string
recipe entry character
Returns RecipeEntry
Recipe entry by entry character.
getEntryCodes
getEntryCollection
Returns Collection<RecipeEntry>
getPrefix
Returns string
Recipe prefix.
getRecipeMask
Returns string
Recipe unique mask identifier.
getRecipeUid
Returns number
getResult
Returns ItemInstance
Resulting item instance.
getSortedEntries
Returns Array<RecipeEntry>
All recipe's entries in a java array.
publichashCode
Returns number
isMatchingField
Parameters
field: WorkbenchField
workbench field to compare with
Returns boolean
true
if the field contains this recipe, false` otherwise.
isMatchingPrefix
Compares current recipe's prefix with given one.
Parameters
prefix: string
prefix value to compare with
Returns boolean
true
, if current recipe's prefix is the same as given one,false
otherwise.
isMatchingResult
Parameters
id: number
count: number
data: number
Returns boolean
true
if specified item is recipe's result,false
otherwise.
isPossibleForInventory
isValid
Returns boolean
true
, if the recipe is valid,false
otherwise.
isVanilla
Returns boolean
publicnotify
Returns void
publicnotifyAll
Returns void
provideRecipe
Parameters
field: WorkbenchField
Returns ItemInstance
provideRecipeForPlayer
Parameters
field: WorkbenchField
player: number
Returns ItemInstance
putIntoTheField
Tries to fill workbench field with current recipe.
Parameters
field: WorkbenchField
workbench field to fill
Returns void
setCallback
Sets craft function for the recipe.
Parameters
callback: CraftingFunction
function to be called on item craft
Returns void
setEntries
Parameters
entries: HashMap<Character, RecipeEntry>
Returns void
setPrefix
Sets prefix value for the recipe.
Parameters
prefix: string
new prefix value
Returns void
setVanilla
Parameters
isVanilla: boolean
Returns WorkbenchRecipe
Reference to itself to be used in sequential calls.
publictoString
Returns string
publicwait
Returns void
Functions
addFurnace
Adds new furnace recipe.
Parameters
sourceId: number
source item ID
sourceData: number
source item data
resultId: number
resulting item ID
resultData: number
resulting item data
optionalprefix: string
prefix, used to create recipes for non-vanilla furnaces
Returns void
addFurnaceFuel
Adds fuel that can be used in the furnace.
Parameters
id: number
fuel item ID
data: number
fuel item data
time: number
burning time in ticks
Returns void
addShaped
Adds new shaped crafting recipe.
Learn how to useRecipes.addShaped({ id: 264, count: 1, data: 0 }, [
"ax",
"xa",
"ax"
], ['x', 265, 0, 'a', 266, 0]);
Module used to manipulate crafting recipes for vanilla and custom workbenches.