@@ -4,43 +4,73 @@ title: "Example Steam Multiblock"
44
55### Large Steam Compressor Multiblock
66
7- In order to use multiblock logic extending beyond the normal WorkableElectricMultiblockMachine, (This is the multiblock type used by default for kubejs) you need to load a class. Steam multiblocks such as the Steam Grinder and Steam Oven use this class.
8-
9- ``` const $SteamMulti = Java.loadClass('com.gregtechceu.gtceu.common.machine.multiblock.steam.SteamParallelMultiblockMachine'); ```
10-
117Below is an example of a multiblock using the SteamParallelMultiblockMachine class.
8+ Steam multiblocks such as the Steam Grinder and Steam Oven use this class.
129
1310### Multiblock
1411
15- ``` js title="example_steam_multiblock_multiblock.js"
16- GTCEuStartupEvents .registry (' gtceu:machine' , event => {
17- event .create (' large_steam_compressor' , ' multiblock' )
18- .machine ((holder ) => new $SteamMulti (holder, 4 ))
19- // The number in holder is the max amount of parallel it can use.
20- .rotationState (RotationState .NON_Y_AXIS )
21- .recipeType (' compressor' )
22- .recipeModifier ((machine , recipe ) => $SteamMulti .recipeModifier (machine, recipe), true )
23- .pattern (definition => FactoryBlockPattern .start ()
24- .aisle (" BCCCB" , " BBCBB" , " BBCBB" , " BBBBB" , " BBBBB" )
25- .aisle (" CDDDC" , " BDBDB" , " BDEDB" , " BBDBB" , " BBBBB" )
26- .aisle (" CDDDC" , " CBBBC" , " CEFEC" , " BDDDB" , " BBGBB" )
27- .aisle (" CDDDC" , " BDBDB" , " BDEDB" , " BBDBB" , " BBBBB" )
28- .aisle (" BCCCB" , " BBHBB" , " BBCBB" , " BBBBB" , " BBBBB" )
29- .where (' B' , Predicates .any ())
30- .where (' C' , Predicates .blocks (' gtceu:steam_machine_casing' ).setMinGlobalLimited (10 )
31- .or (Predicates .abilities (PartAbility .STEAM_IMPORT_ITEMS ).setMaxGlobalLimited (1 ))
32- .or (Predicates .abilities (PartAbility .STEAM ).setMaxGlobalLimited (1 ))
33- .or (Predicates .abilities (PartAbility .STEAM_EXPORT_ITEMS ).setMaxGlobalLimited (1 )))
34- .where (" D" , Predicates .blocks (" gtceu:industrial_steam_casing" ))
35- .where (" E" , Predicates .blocks (" gtceu:bronze_brick_casing" ))
36- .where (" F" , Predicates .blocks (" gtceu:bronze_firebox_casing" ))
37- .where (" G" , Predicates .blocks (" gtceu:bronze_machine_casing" ))
38- .where (' H' , Predicates .controller (Predicates .blocks (definition .get ())))
39- .build ())
40- .workableCasingModel (" gtceu:block/casings/steam/bronze/bottom" ,
41- " gtceu:block/machines/compressor" )
42- })
43- ```
12+ === "JavaScript"
13+ ```js title="example_steam_multiblock_multiblock.js"
14+ // In order to use multiblock logic extending beyond the default multiblock type for KJS (WorkableElectricMultiblockMachine), you need to load a class.
15+ const $SteamMulti = Java.loadClass('com.gregtechceu.gtceu.common.machine.multiblock.steam.SteamParallelMultiblockMachine');
16+
17+ GTCEuStartupEvents.registry('gtceu:machine', event => {
18+ event.create('large_steam_compressor', 'multiblock')
19+ .machine((holder) => new $SteamMulti(holder, 4))
20+ // The number in holder is the max amount of parallel it can use.
21+ .rotationState(RotationState.NON_Y_AXIS)
22+ .recipeType('compressor')
23+ .recipeModifier((machine, recipe) => $SteamMulti.recipeModifier(machine, recipe), true)
24+ .pattern(definition => FactoryBlockPattern.start()
25+ .aisle("BCCCB", "BBCBB", "BBCBB", "BBBBB", "BBBBB")
26+ .aisle("CDDDC", "BDBDB", "BDEDB", "BBDBB", "BBBBB")
27+ .aisle("CDDDC", "CBBBC", "CEFEC", "BDDDB", "BBGBB")
28+ .aisle("CDDDC", "BDBDB", "BDEDB", "BBDBB", "BBBBB")
29+ .aisle("BCCCB", "BBHBB", "BBCBB", "BBBBB", "BBBBB")
30+ .where('B', Predicates.any())
31+ .where('C', Predicates.blocks('gtceu:steam_machine_casing').setMinGlobalLimited(10)
32+ .or(Predicates.abilities(PartAbility.STEAM_IMPORT_ITEMS).setMaxGlobalLimited(1))
33+ .or(Predicates.abilities(PartAbility.STEAM).setMaxGlobalLimited(1))
34+ .or(Predicates.abilities(PartAbility.STEAM_EXPORT_ITEMS).setMaxGlobalLimited(1)))
35+ .where('D', Predicates.blocks("gtceu:industrial_steam_casing"))
36+ .where('E', Predicates.blocks("gtceu:bronze_brick_casing"))
37+ .where('F', Predicates.blocks("gtceu:bronze_firebox_casing"))
38+ .where('G', Predicates.blocks("gtceu:bronze_machine_casing"))
39+ .where('H', Predicates.controller(Predicates.blocks(definition.get())))
40+ .build())
41+ .workableCasingModel("gtceu:block/casings/steam/bronze/bottom",
42+ "gtceu:block/machines/compressor")
43+ })
44+ ```
45+
46+ === "Java"
47+ ```java
48+ public static final MultiblockMachineDefinition LARGE_STEAM_COMPRESSOR = REGISTRATE
49+ .multiblock("large_steam_compressor", (holder) -> new SteamParallelMultiblockMachine(holder, 4))
50+ .rotationState(RotationState.NON_Y_AXIS)
51+ .recipeType(COMPRESSOR_RECIPES)
52+ .recipeModifier((machine, recipe) -> SteamParallelMultiblockMachine.recipeModifier(machine, recipe), true)
53+ .pattern(definition -> FactoryBlockPattern.start()
54+ .aisle("BCCCB", "BBCBB", "BBCBB", "BBBBB", "BBBBB")
55+ .aisle("CDDDC", "BDBDB", "BDEDB", "BBDBB", "BBBBB")
56+ .aisle("CDDDC", "CBBBC", "CEFEC", "BDDDB", "BBGBB")
57+ .aisle("CDDDC", "BDBDB", "BDEDB", "BBDBB", "BBBBB")
58+ .aisle("BCCCB", "BBHBB", "BBCBB", "BBBBB", "BBBBB")
59+ .where('B', Predicates.any())
60+ .where('C', Predicates.blocks(GTBlocks.CASING_BRONZE_BRICKS.get()).setMinGlobalLimited(10)
61+ .or(Predicates.abilities(PartAbility.STEAM_IMPORT_ITEMS).setMaxGlobalLimited(1))
62+ .or(Predicates.abilities(PartAbility.STEAM).setMaxGlobalLimited(1))
63+ .or(Predicates.abilities(PartAbility.STEAM_EXPORT_ITEMS).setMaxGlobalLimited(1)))
64+ .where('D', Predicates.blocks(GCYMBlocks.CASING_INDUSTRIAL_STEAM.get()))
65+ .where('E', Predicates.blocks(GTBlocks.BRONZE_BRICKS_HULL.get()))
66+ .where('F', Predicates.blocks(GTBlocks.FIREBOX_BRONZE.get()))
67+ .where('G', Predicates.blocks(GTBlocks.BRONZE_HULL.get()))
68+ .where('H', Predicates.controller(Predicates.blocks(definition.get())))
69+ .build())
70+ .workableCasingModel(GTCEu.id("block/casings/steam/bronze/bottom"),
71+ GTCEu.id("block/machines/compressor"))
72+ .register();
73+ ```
4474
4575### Lang
4676
0 commit comments