https://www.curseforge.com/minecraft/mc-mods/kubejs-create-automation
KJSCAuto allows KubeJS scripts to modify key automation behaviors in Create.
- Deployer item/tool usage
- Basin recipe operations
- Block breaking by drills and saws
These hooks were selected to address several common automation control issues I often see discussed in the KubeJS community. If you feel there are other Create behaviors that would benefit from script hooks, feel free to suggest them in the discussion forum.
Example Script:
Deploying tool without consuming durability.
KJSCAutoEvents.deployerUse(event => {
var {block, outputs, heldItem} = event
if(heldItem != "create:sand_paper") return //only works for sand paper
if(!block.offset(0, -3, 0).blockState.is(Blocks.DIAMOND_BLOCK)) return; //only works when the belt/deposit (y = -2) has a diamond block below.
event.setDamage(0) //set the durability usage to 0
while(outputs.length > 0) outputs.remove(0) //remove all original outputs
outputs.add(0, Item.of("diamond")) //add diamond
})
Mixing wool and red dye while not consuming the dye
This is to enable some "catalyst" like behavior.
KJSCAutoEvents.basinOperation(event => {
var {basin, block, fluidOutputs, heatLevel, outputs, recipe} = event;
if(recipe.getId().toString() == "minecraft:dye_red_wool"){
event.addInput("red_dye")
}
})
Protective Ground for Contraptions
Blocks placed on soul soil cannot be broken by contraption machines.
ContraptionEvents.beforeBlockDestroy(event => {
const { level, targetPos } = event
const below = level.getBlockState(targetPos.below())
if (!below.is("minecraft:soul_soil")) return
event.cancel() // prevent the contraption from breaking the block
})
1.21.1 has several changes so the script also needs some adjustment. Here's the example for 1.21.1 neoforge.
https://github.com/vomiter-scp-zh/KubeJS_Create_Automation/wiki/1.21-example