-
Notifications
You must be signed in to change notification settings - Fork 17
KubeJS Machine Upgrades
Frinn38 edited this page Jan 29, 2022
·
1 revision
Custom Machine upgrades can be made with KubeJS script.
Create a .js file in the kubejs\server_scripts
folder (ex: custom_machine_upgrades.js) and look at the example below to see all the available methods to create a Custom Machine upgrade with KubeJS.
If you're not familiar about custom machine upgrades see the wiki page.
//Use the 'cm_upgrades' event to register custom machine upgrades.
onEvent('cm_upgrades', event => {
//Create an upgrade from the item you want, ex: vanilla diamond.
//You must also specify the max amount of this upgrade the machine can accept, ex: 64.
//Syntax: event.create(Item.of("item_id"), maxAmount)
event.create(Item.of('minecraft:diamond'), 64)
//Add a machine that can accept this upgrade, you can use this method several times to add differents machines.
//You MUST specify at least one machine or the upgrade will not be created and an error will be thrown.
//Syntax: .machine("machine_id")
.machine("custommachinery:power_crusher")
//You can add a custom tooltip to the machine upgrade item.
.tooltip('Ultra booster MK3')
//Add various requirement modifiers using the methods below.
//Add an addition modifier for all input requirements of type: "requirement_id".
//"target" is for specifying a specific property of the requirement, ex: "chance" to modify the "chance" property of requirements that have this property.
//chance is a value between 0.0 and 1.0 that define the chance of the modifier to be applied.
.addInput("requirement_id", value)
.addInput("requirement_id", value, "target")
.addInput("requirement_id", value, chance)
.addInput("requirement_id", value, "target", chance)
//Add a multiplication modifier for all input requirements of type: "requirement_id".
//"target" is for specifying a specific property of the requirement, ex: "chance" to modify the "chance" property of requirements that have this property.
//chance is a value between 0.0 and 1.0 that define the chance of the modifier to be applied.
.mulInput("requirement_id", value)
.mulInput("requirement_id", value, "target")
.mulInput("requirement_id", value, chance)
.mulInput("requirement_id", value, "target", chance)
//Add an addition modifier for all output requirements of type: "requirement_id".
//"target" is for specifying a specific property of the requirement, ex: "chance" to modify the "chance" property of requirements that have this property.
//chance is a value between 0.0 and 1.0 that define the chance of the modifier to be applied.
.addOutput("requirement_id", value)
.addOutput("requirement_id", value, "target")
.addOutput("requirement_id", value, chance)
.addOutput("requirement_id", value, "target", chance)
//Add a multiplication modifier for all output requirements of type: "requirement_id".
//"target" is for specifying a specific property of the requirement, ex: "chance" to modify the "chance" property of requirements that have this property.
//chance is a value between 0.0 and 1.0 that define the chance of the modifier to be applied.
.mulOutput("requirement_id", value)
.mulOutput("requirement_id", value, "target")
.mulOutput("requirement_id", value, chance)
.mulOutput("requirement_id", value, "target", chance)
})
A gold ingot put inside the Power Crusher will double it's energy comsumption but also increase the speed by 50%.
onEvent('cm_upgrades', event => {
event.create(Item.of('minecraft:gold_ingot'), 64)
.machine("custommachinery:power_crusher")
.mulInput('custommachinery:energy', 2)
.mulInput('custommachinery:speed', 1.5)
})
3. Machine GUI
- Dump Element
- Energy Element
- Fluid Element
- Fuel Element
- Player Inventory Element
- Progress Bar Element
- Reset Element
- Slot Element
- Status Element
- Text Element
- Texture Element
5. Catalysts
- Biome Requirement
- Block Requirement
- Command Requirement
- Dimension Requirement
- Drop Requirement
- Durability Requirement
- Effect Requirement
- Energy Requirement
- Energy Per Tick Requirement
- Entity Requirement
- Fluid Requirement
- Fluid Per Tick Requirement
- Fuel Requirement
- Item Requirement
- Light Requirement
- Loot Table Requirement
- Position Requirement
- Structure Requirement
- Redstone Requirement
- Time Requirement
- Weather Requirement