Skip to content

Instantly share code, notes, and snippets.

@LatvianModder LatvianModder/example.js
Last active Dec 2, 2019

What would you like to do?
KubeJS 1.14+ Recipes
// kubejs/data/modpack/kubejs/example.js
// This is just an example script to show off multiple types of recipes and removal methods
// Supports /reload
// Enable recipe logging, off by default
server.logAddedRecipes = true
server.logRemovedRecipes = true
// Listen to server recipe event
events.listen('', function (event) {
// Remove broken recipes from vanilla and other mods
// This is on by default, so you don't need this line
//event.removeBrokenRecipes = true
event.nuke() // Deletes all recipes
event.removeId('minecraft:glowstone') // Removes data/minecraft/recipes/glowstone.json
event.removeInput('#forge:dusts/redstone') // Removes all recipes where input is Redstone Dust tag
event.removeOutput('#minecraft:wool') // Removes all recipes where output is Wool tag
event.removeMod('quartzchests') // Remove all recipes from Quartz Chests mod
event.removeType('minecraft:campfire_cooking') // Remove all campfire cooking recipes
// Add shaped recipe for 3 Stone from 8 Sponge in chest shape
// (Shortcut for
event.shaped('minecraft:stone 3', [
'S S',
], {
S: 'minecraft:sponge'
// Add shapeless recipe for 4 Cobblestone from 1 Stone and 1 Glowstone
// (Shortcut for
event.shapeless(item.of('minecraft:cobblestone', 4), ['minecraft:stone', '#forge:dusts/glowstone'])
// Add Stonecutter recipe for Golden Apple to 4 Apples'minecraft:apple', 4), 'minecraft:golden_apple')
// Add Stonecutter recipe for Golden Apple to 2 Carrots'minecraft:carrot', 2), 'minecraft:golden_apple')
// Add Furnace recipe for Golden Apple to 3 Carrots
// (Shortcut for
event.smelting(item.of('minecraft:carrot', 2), 'minecraft:golden_apple')
// Add similar recipes for Blast Furnace, Smoker and Campfire'minecraft:apple', 3), 'minecraft:golden_apple')'minecraft:apple', 5), 'minecraft:golden_apple')'minecraft:apple', 'minecraft:golden_apple')
// You can also add .xp(1.0) at end of any smelting recipe to change given XP
// Create a variable for function and use that to make things shorter
var s =
s('minecraft:blue_dye', '#forge:gems/lapis')
s('minecraft:black_dye', 'minecraft:ink_sac')
s('minecraft:white_dye', 'minecraft:bone_meal')
// Add Create's crushing recipe, Apple to Apple + 50% Carrot['minecraft:apple', item.of('minecraft:carrot').chance(0.5)], 'minecraft:apple', 100)
// If you use {} as only argument, it will be using vanilla Json syntax
// You can add recipe to any recipe handler that uses vanilla recipe system or isn't supported by KubeJS{
ingredients: [
{ item: 'minecraft:carrot' }
results: [
{ item: 'minecraft:apple', count: 1, chance: 0.5 },
{ item: 'minecraft:carrot', count: 1 }
processingTime: 100
// Listen to server tag event
events.listen('server.datapack.tags', function (event) {
// Add forge:cobblestone tag to Diorite and Granite
event.tags.items.get('forge:cobblestone').add('minecraft:diorite', 'minecraft:granite')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.