Skip to content

KubeJS Integration

SihenZhang edited this page Dec 11, 2021 · 6 revisions

Crock Pot Cooking Recipe

event.recipes.crockpot.crockPotCooking(output, priority, cookingtime, potlevel)
event.recipes.crockpot.crockPotCooking(output, priority, weight, cookingtime, potlevel)
event.recipes.crockpot.crockPotCooking(output, priority, weight, cookingtime, potlevel).requirement(object)
event.recipes.crockpot.crockPotCooking(output, priority, weight, cookingtime, potlevel)
    .requirementCategoryMax(string, float)
    .requirementCategoryMaxExclusive(string, float)
    .requirementCategoryMin(string, float)
    .requirementCategoryMinExclusive(string, float)
    .requirementCombinationAnd(object, object)
    .requirementCombinationOr(object, object)
    .requirementMustContainIngredient(ingredient, int)
    .requirementMustContainIngredientLessThan(ingredient, int)

Here are some examples.

Note: Only items has Food Values can be put into Crock Pot. So if you want to use other items as ingredient, you should define Food Values for them first.

event.recipes.crockpot.crockPotCooking("3x minecraft:diamond", 100, 1200, 2)
    .requirement({ type: "must_contain_ingredient", ingredient: { tag: "forge:ores/diamond" }, quantity: 2 })
    .requirement({ type: "category_min", category: "INEDIBLE", min: 3 })
event.recipes.crockpot.crockPotCooking("minecraft:grass_block", 50, 1, 200, 0)
    .requirementMustContainIngredient("minecraft:dirt", 2)
    .requirementCombinationOr(
        { type: "category_min_exclusive", category: "VEGGIE", min: 0 },
        { type: "category_min_exclusive", category: "FRUIT", min: 0 }
    )

Diamond

Grass Block

Food Values Definition

event.recipes.crockpot.foodValues(foodvalues, istag, ...ids)
event.recipes.crockpot.foodValues(foodvalues, istag, ...ids).define(string)

Here are some examples.

Note: Food values have a priority, specifically the more 'detailed' the description of a food value, the higher the priority. For example, the item type will always have the highest priority and the priority of the tag type will depend on the number of "/"s in the tag, the more "/"s the higher the priority.

event.recipes.crockpot.foodValues({VEGGIE: 0.5, INEDIBLE: 1.0}, false, "minecraft:dirt", "minecraft:mycelium")
event.recipes.crockpot.foodValues({INEDIBLE: 1.0}, true).define("forge:ores/gold").define("#forge:ores/diamond")

Dirt

Mycelium

Gold Ore

Diamond Ore

Explosion Crafting Recipe

event.recipes.crockpot.explosionCrafting(output, input)
event.recipes.crockpot.explosionCrafting(output, input, lossrate)
event.recipes.crockpot.explosionCrafting(output, input, lossrate, onlyblock)
event.recipes.crockpot.explosionCrafting(output, input).lossRate(float).onlyBlock()
event.recipes.crockpot.explosionCrafting(output, input).lossRate(float).onlyBlock(boolean)

Here are some examples.

event.recipes.crockpot.explosionCrafting("9x minecraft:diamond", "#forge:storage_blocks/diamond")
event.recipes.crockpot.explosionCrafting("minecraft:diamond", "minecraft:dirt").lossRate(0.9).onlyBlock()

Diamond Block to Diamond

Dirt to Diamond

Piglin Bartering Recipe

event.recipes.crockpot.piglinBartering(input)
event.recipes.crockpot.piglinBartering(output, input)
event.recipes.crockpot.piglinBartering([outputs], input)
event.recipes.crockpot.piglinBartering(output, input)
    .weightedOutput(object)
    .weightedOutput(item)
    .weightedOutput(item, weight)
    .weightedOutput(item, count, weight)
    .weightedOutput(item, min, max, weight)

Here are some examples.

Note: Outputs of Piglin Bartering Recipe doesn't support KubeJS's syntax for describing ItemStack with count (eg. "9x minecraft:diamond").

event.recipes.crockpot.piglinBartering([
    { item: "minecraft:iron_ingot", count: { min: 1, max: 2}, weight: 3 },
    { item: "minecraft:gold_ingot", weight: 2 },
    "minecraft:diamond"], "#forge:stone")
    .weightedOutput("minecraft:coal", 1, 4, 4)
    .weightedOutput("minecraft:cobblestone", 2, 4)
    .weightedOutput({ item: "minecraft:lapis_lazuli", count: 2 })
event.recipes.crockpot.piglinBartering("minecraft:sand").weightedOutput("minecraft:glass")

Stone

Sand