-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add multiblock constructors to KJS + lang (#2667)
- Loading branch information
Showing
5 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/java/com/gregtechceu/gtceu/integration/kjs/helpers/MachineConstructors.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.gregtechceu.gtceu.integration.kjs.helpers; | ||
|
||
import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; | ||
import com.gregtechceu.gtceu.api.machine.multiblock.MultiblockControllerMachine; | ||
import com.gregtechceu.gtceu.common.machine.multiblock.electric.FusionReactorMachine; | ||
import com.gregtechceu.gtceu.common.machine.multiblock.generator.LargeCombustionEngineMachine; | ||
import com.gregtechceu.gtceu.common.machine.multiblock.generator.LargeTurbineMachine; | ||
import com.gregtechceu.gtceu.common.machine.multiblock.steam.SteamParallelMultiblockMachine; | ||
|
||
/** | ||
* Collection of functions that can be used in the Machine Creation Functions in KJS definitions | ||
* Makes using them for KJS easier, as loading the relevant class won't be required. | ||
*/ | ||
@SuppressWarnings("unused") | ||
public final class MachineConstructors { | ||
|
||
// This one in particular stops a crash when trying to define a new LCE | ||
// The crash is caused by the static FluidStack members in LargeCombustionEngine.class | ||
public static MultiblockControllerMachine createLargeCombustionEngine(IMachineBlockEntity holder, int tier) { | ||
return new LargeCombustionEngineMachine(holder, tier); | ||
} | ||
|
||
public static MultiblockControllerMachine createLargeTurbine(IMachineBlockEntity holder, int tier) { | ||
return new LargeTurbineMachine(holder, tier); | ||
} | ||
|
||
public static MultiblockControllerMachine createFusionReactor(IMachineBlockEntity holder, int tier) { | ||
return new FusionReactorMachine(holder, tier); | ||
} | ||
|
||
public static MultiblockControllerMachine createSteamMultiblock(IMachineBlockEntity holder, int parallels) { | ||
return new SteamParallelMultiblockMachine(holder, parallels); | ||
} | ||
} |