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

Add machine mode to the GUI of MultiMapControllers - MUI2 #2713

Merged
merged 6 commits into from
Feb 26, 2025
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 @@ -3,10 +3,12 @@
import gregtech.api.capability.GregtechDataCodes;
import gregtech.api.capability.GregtechTileCapabilities;
import gregtech.api.capability.IMultipleRecipeMaps;
import gregtech.api.metatileentity.multiblock.ui.MultiblockUIBuilder;
import gregtech.api.metatileentity.multiblock.ui.MultiblockUIFactory;
import gregtech.api.mui.GTGuiTextures;
import gregtech.api.pattern.TraceabilityPredicate;
import gregtech.api.recipes.RecipeMap;
import gregtech.api.util.GTUtility;

import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
Expand Down Expand Up @@ -156,6 +158,17 @@ protected MultiblockUIFactory createUIFactory() {
});
}

@Override
protected void configureDisplayText(MultiblockUIBuilder builder) {
builder.setWorkingStatus(recipeMapWorkable.isWorkingEnabled(), recipeMapWorkable.isActive())
.addRecipeMapLine(getCurrentRecipeMap())
.addEnergyUsageLine(this.getEnergyContainer())
.addEnergyTierLine(GTUtility.getTierByVoltage(recipeMapWorkable.getMaxVoltage()))
.addParallelsLine(recipeMapWorkable.getParallelLimit())
.addWorkingStatusLine()
.addProgressLine(recipeMapWorkable.getProgressPercent());
}

@Override
public void addInformation(ItemStack stack, @Nullable World player, List<String> tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import gregtech.api.GTValues;
import gregtech.api.capability.IEnergyContainer;
import gregtech.api.recipes.RecipeMap;
import gregtech.api.util.KeyUtil;
import gregtech.api.util.TextFormattingUtil;
import gregtech.common.ConfigHolder;
Expand Down Expand Up @@ -466,6 +467,20 @@ public MultiblockUIBuilder addFuelNeededLine(String fuelName, int previousRecipe
return this;
}

/**
* Adds the name of a recipe map to the display.
*
* @param map the {@link RecipeMap} to get the name of
*/
public MultiblockUIBuilder addRecipeMapLine(RecipeMap<?> map) {
if (!isStructureFormed) return this;

IKey mapName = KeyUtil.lang(TextFormatting.YELLOW, map.getTranslationKey());
addKey(KeyUtil.lang(TextFormatting.GRAY, "gregtech.multiblock.machine_mode", mapName));

return this;
}

/** Insert an empty line into the text list. */
public MultiblockUIBuilder addEmptyLine() {
addKey(IKey.LINE_FEED);
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/gregtech/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -5909,6 +5909,8 @@ gregtech.multiblock.hpca.info_coolant_name=PCB Coolant
gregtech.multiblock.hpca.info_bridging_enabled=Bridging Enabled
gregtech.multiblock.hpca.info_bridging_disabled=Bridging Disabled

gregtech.multiblock.machine_mode=Machine Mode: %s

gregtech.command.usage=Usage: /gregtech <worldgen/hand/recipecheck/datafix>
gregtech.command.worldgen.usage=Usage: /gregtech worldgen <reload>
gregtech.command.worldgen.reload.usage=Usage: /gregtech worldgen reload
Expand Down