Skip to content
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 @@ -126,6 +126,11 @@ public void afterWorking() {
spreadEnvironmentalHazard();
}

@Override
public long getDisplayRecipeVoltage() {
return GTValues.V[this.tier];
}

//////////////////////////////////////
// *********** GUI ***********//
//////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,15 @@ public void onMachineRemoved() {
}
}

/// //////////////////////////////////
// ****** RECIPE LOGIC *******//
/// //////////////////////////////////

@Override
public long getDisplayRecipeVoltage() {
return GTValues.V[this.tier];
}

//////////////////////////////////////
// *********** GUI ***********//
//////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.gregtechceu.gtceu.api.recipe.GTRecipeType;
import com.gregtechceu.gtceu.api.recipe.RecipeHelper;
import com.gregtechceu.gtceu.config.ConfigHolder;
import com.gregtechceu.gtceu.integration.jade.provider.RecipeLogicProvider;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -126,6 +127,14 @@ default boolean shouldWorkingPlaySound() {
(!(self() instanceof IMufflableMachine mufflableMachine) || !mufflableMachine.isMuffled());
}

/**
* Display recipe voltage used by {@link RecipeLogicProvider}
*/

default long getDisplayRecipeVoltage() {
return -1;
}

//////////////////////////////////////
// ******* IWorkable ********//
//////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,12 @@ public long getMaxVoltage() {
}
}

@Override
public long getDisplayRecipeVoltage() {
return Math.max(this.getEnergyContainer().getHighestInputVoltage(),
this.getEnergyContainer().getOutputVoltage());
}

/**
* Is this multiblock a generator?
* Used for max voltage calculations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
import com.gregtechceu.gtceu.api.GTValues;
import com.gregtechceu.gtceu.api.blockentity.MetaMachineBlockEntity;
import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper;
import com.gregtechceu.gtceu.api.machine.SimpleGeneratorMachine;
import com.gregtechceu.gtceu.api.machine.SimpleTieredMachine;
import com.gregtechceu.gtceu.api.machine.multiblock.WorkableElectricMultiblockMachine;
import com.gregtechceu.gtceu.api.machine.steam.SimpleSteamMachine;
import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic;
import com.gregtechceu.gtceu.api.recipe.RecipeHelper;
Expand Down Expand Up @@ -62,18 +59,10 @@ protected void write(CompoundTag data, RecipeLogic capability) {
}

public static long getVoltage(RecipeLogic capability) {
long voltage = -1;
if (capability.machine instanceof SimpleTieredMachine machine) {
voltage = GTValues.V[machine.getTier()];
} else if (capability.machine instanceof SimpleGeneratorMachine machine) {
voltage = GTValues.V[machine.getTier()];
} else if (capability.machine instanceof WorkableElectricMultiblockMachine machine) {
voltage = Math.max(machine.getEnergyContainer().getHighestInputVoltage(),
machine.getEnergyContainer().getOutputVoltage());
}
long voltage = capability.machine.getDisplayRecipeVoltage();

// default display as LV, this shouldn't happen because a machine is either electric or steam
if (voltage == -1) voltage = 32;
return voltage;
return voltage == -1 ? GTValues.V[GTValues.LV] : voltage;
}

@Override
Expand Down