create-the-brass-oncerto/kubejs/startup_scripts/machine/single_mech.js

44 lines
1.5 KiB
JavaScript

StartupEvents.registry('block', event => {
//Syntax : event.create("namespace:block_id", "custommachinery").machine("namespace:machine_id)
event.create("kubejs:emergency_industrial_platform", "custommachinery")
.machine("dut:emergency_industrial_platform")
event.create("kubejs:emergency_industrial_platform_block", "custommachinery")
.machine("dut:emergency_industrial_platform_block")
event.create("kubejs:emergency_industrial_platform_dark", "custommachinery")
.machine("dut:emergency_industrial_platform_dark")
event.create("kubejs:emergency_industrial_platform_dark_block", "custommachinery")
.machine("dut:emergency_industrial_platform_dark_block")
event.create("kubejs:battery_slot", "custommachinery")
.machine("dut:battery_slot")
event.create("kubejs:culture_bin", "custommachinery")
.machine("dut:culture_bin")
})
StartupEvents.registry('block', event => {
//太阳能板
event.create("solar_panel", "cardinal")
.glassSoundType()
.box(4, 0, 4, 12, 8, 12, true)
.viewBlocking(true)
.tagBlock('create:wrench_pickup')
.noValidSpawns(true)
.suffocating(false)
.notSolid()
.defaultCutout()
.blockEntity(info => {
info.attachCapability(CapabilityBuilder.ENERGY.customBlockEntity()
.canExtract(() => true)
.getEnergyStored(i => 240)
.getMaxEnergyStored(i => 240)
.extractEnergy((be, i, sim) => {
let { level, blockPos } = be
let block = level.getBlock(blockPos)
if (level.day && block.up.canSeeSky) { return 240 }
return 0
})
)
})
})