Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Steam Multiblocks to have variable parallel amounts #2108

Merged
merged 5 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,18 @@
@MethodsReturnNonnullByDefault
public class SteamParallelMultiblockMachine extends WorkableMultiblockMachine implements IDisplayUIMachine {

public static final int MAX_PARALLELS = 8;
public int maxParallels = ConfigHolder.INSTANCE.machines.steamMultiParallelAmount;

// if in millibuckets, this is 0.5, Meaning 2mb of steam -> 1 EU
private static final double CONVERSION_RATE = 0.5D;

Deepacat marked this conversation as resolved.
Show resolved Hide resolved
public SteamParallelMultiblockMachine(IMachineBlockEntity holder, Object... args) {
super(holder, args);
public SteamParallelMultiblockMachine(IMachineBlockEntity holder) {
this(holder, ConfigHolder.INSTANCE.machines.steamMultiParallelAmount);
}

public SteamParallelMultiblockMachine(IMachineBlockEntity holder, int parallelAmount) {
super(holder);
maxParallels = parallelAmount;
}

@Override
Expand Down Expand Up @@ -78,13 +83,13 @@ public void onStructureFormed() {
@Nullable
public static GTRecipe recipeModifier(MetaMachine machine, @NotNull GTRecipe recipe, @NotNull OCParams params,
@NotNull OCResult result) {
if (machine instanceof SteamParallelMultiblockMachine) {
if (machine instanceof SteamParallelMultiblockMachine steamMachine) {
if (RecipeHelper.getRecipeEUtTier(recipe) > GTValues.LV) {
return null;
}
int duration = recipe.duration;
var eut = RecipeHelper.getInputEUt(recipe);
var parallelRecipe = GTRecipeModifiers.accurateParallel(machine, recipe, MAX_PARALLELS, false);
var parallelRecipe = GTRecipeModifiers.accurateParallel(machine, recipe, steamMachine.maxParallels, false);

// we remove tick inputs, as our "cost" is just steam now, just stored as EU/t
// also set the duration to just 1.5x the original, instead of fully multiplied
Expand Down Expand Up @@ -114,7 +119,8 @@ public void addDisplayText(List<Component> textList) {

} else if (isActive()) {
textList.add(Component.translatable("gtceu.multiblock.running"));
textList.add(Component.translatable("gtceu.multiblock.parallel", MAX_PARALLELS));
if (maxParallels > 1)
textList.add(Component.translatable("gtceu.multiblock.parallel", maxParallels));
int currentProgress = (int) (recipeLogic.getProgressPercent() * 100);
double maxInSec = (float) recipeLogic.getDuration() / 20.0f;
double currentInSec = (float) recipeLogic.getProgress() / 20.0f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,13 @@ public static class MachineConfigs {
})
public boolean enableMoreDualHatchAbility = false;

@Configurable
@Configurable.Comment({
"Default maximum parallel of steam multiblocks",
"Default: 8"
})
public int steamMultiParallelAmount = 8;

@Configurable
@Configurable.Comment("Small Steam Boiler Options")
public SmallBoilers smallBoilers = new SmallBoilers();
Expand Down