Can not pass parameter machineFunction when creating CustomMultiblock
iamSmallY opened this issue ยท 0 comments
Checked for existing issues
- I have checked for existing issues, and have found none.
Tested latest version
- I have checked that this occurs on the latest version.
GregTech CEu Version
directly source code
Recipe Viewer Installed
None
Environment
Singleplayer
Cross-Mod Interaction
No
Other Installed Mods
directly source code
Expected Behavior
I wanted to customize the shape of the steam turbine, so I checked the existing definitions of steam turbines, and then wrote the following code using Kubejs.
const LargeTurbineMachine = Java.loadClass("com.gregtechceu.gtceu.common.machine.multiblock.generator.LargeTurbineMachine")
GTCEuStartupEvents.registry("gtceu:machine", event => {
event.create("cocat_steam_turbine", "multiblock", (holder, trie) => new LargeTurbineMachine(holder, trie), 5)
.rotationState(RotationState.NON_Y_AXIS)
.appearanceBlock(GTBlocks.CASING_STAINLESS_TURBINE)
.recipeType("gtceu:steam_turbine")
.recipeModifier(LargeTurbineMachine.recipeModifier)
.pattern(definition => FactoryBlockPattern.start()
.aisle("CCCC", "CHHC", "CCCC")
.aisle("CHHC", "RAAR", "CHHC")
.aisle("CCCC", "CSHC", "CCCC")
.where("S", Predicates.controller(Predicates.blocks(definition.get())))
.where("A", Predicates.blocks('create:flywheel'))
.where("H", Predicates.blocks('gtceu:stainless_steel_turbine_casing')
.or(Predicates.abilities(PartAbility.MAINTENANCE).setExactLimit(1))
.or(Predicates.abilities(PartAbility.MUFFLER).setExactLimit(1))
.or(Predicates.abilities(PartAbility.IMPORT_FLUIDS))
.or(Predicates.abilities(PartAbility.EXPORT_FLUIDS)))
.where("R", Predicates.abilities(PartAbility.OUTPUT_ENERGY).setExactLimit(1)
.or(Predicates.abilities(PartAbility.ROTOR_HOLDER).setExactLimit(1)))
.where("C", Predicates.blocks("gtceu:stainless_steel_turbine_casing"))
.build())
.workableCasingRenderer(
"gtceu:block/casings/mechanic/machine_casing_turbine_stainless_steel",
"gtceu:block/multiblock/generator/large_steam_turbine", false)
});
I think it should generate a level IV steam turbine.
Actual Behavior
It just give me a machine with class WorkableElectricMultiblockMachine
, not a LargeTurbineMachine
. Also, it can not work.
Steps to Reproduce
just put the js code in startup_script in kubejs
Additional Information
I have tried to debug with it and found that when creating the block, the args[0] is a dev.latvian.mods.rhino.ArrowFunction
, not BiFunction<?,?,?>
so it never enter the if statement.
I try to use the Class type at args[0] and change the source code to directly pass it into the corresponding constructor, then I can get the required block.