Skip to content

KubeJS compat

kotakotik22 edited this page Aug 16, 2021 · 6 revisions

Picking and extracting recipes

// kubejs/server_scripts/script.js
onEvent('recipes', event => {
	// this creates a recipe for extracting 30 netherrack from obsidian, dealing 304 damage and taking an hour to mine at 128 RPM
	event.recipes.createautomated.extracting("minecraft:obsidian", "minecraft:netherrack")
            .drillDamage(304)
             // either 2 integers, in which case it will give a random amount between them, or 1 integer in which case it will always give this many
            .ore(30)
             // options: 
             // requiredProgressTicks, requiredProgressSeconds, requiredProgressMinutes
            .requiredProgressMinutes(128, 60) 

        // This creates a recipe for picking a stack of diamonds from a diamond block, with a 50% chance
        // note: does not automatically add deploying recipes, pass in the event as the final argument to automatically create a picking recipe
	event.recipes.createautomated.picking("minecraft:diamond_block", Item.of("minecraft:diamond")
	    .withChance(0.5)
	    .withCount(64))
})

Custom drill heads

The item

// kubejs/startup_scripts/script.js
onEvent('item.registry.drillhead', event => {
    // creates a drill item with 3 durability
    event.create('test_item').displayName('Test Item').durability(3)
})

Drill partials

This is the 3d model that will be rendered on the extractor, if not provided, it will render the default one

// kubejs/client_scripts/script.js
onEvent('partial.registry.drillhead', event => {
    // the first argument is your item's id, and then your model's location. in this case it will have to be in 
    // assets/kubejs/models/block/test_item
    event.create("kubejs:test_item", "kubejs:block/test_item")
})
Clone this wiki locally