Skip to content

Commit

Permalink
The AT has a good UI now.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghostipedia committed Aug 20, 2024
1 parent 996d726 commit 75ad349
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/generated/resources/assets/gtceu/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -3579,6 +3579,11 @@
"gtceu.mode.fluid": "ɹ§pınןℲ6§",
"gtceu.mode.item": "ɹ§ɯǝʇI9§",
"gtceu.muffler.recovery_tooltip": "%d%%ɟ§ :ǝɔuɐɥƆ ʎɹǝʌoɔǝᴚq§",
"gtceu.multiblock.active_transformer.average_in": "ʇ/∩Ǝ %sɟ§ :ʇnduI ˙bʌⱯq§",
"gtceu.multiblock.active_transformer.average_out": "ʇ/∩Ǝ %sɟ§ :ʇndʇnO ˙bʌⱯq§",
"gtceu.multiblock.active_transformer.danger_enabled": "ǝʌısoןdxƎ :ᴚƎ⅁NⱯᗡq§ɔ§",
"gtceu.multiblock.active_transformer.max_input": "ʇ/∩Ǝ %sɟ§ :ʇnduI xɐWɐ§",
"gtceu.multiblock.active_transformer.max_output": "ʇ/∩Ǝ %sɟ§ :ʇndʇnO xɐWɔ§",
"gtceu.multiblock.advanced_processing_array.description": "˙uoıʇɐɯoʇnɐ buısɐǝ ʎןǝʌıʇɔǝɟɟǝ 'ʞɔoןqıʇןnɯ ǝןbuıs ɐ uı )s(ǝuıɥɔɐɯ ʞɔoןq ǝןbuıs ㄣ9 oʇ dn sǝuıqɯoɔ ʎɐɹɹⱯ buıssǝɔoɹԀ ǝɥ⟘",
"gtceu.multiblock.assembly_line.description": "˙sʇuǝuodɯoɔ buıʇɟɐɹɔ pǝɔuɐʌpɐ buıʇɐǝɹɔ ɹoɟ pǝsn 'ǝuıɥɔɐW buıןqɯǝssⱯ ǝbɹɐן s,ʇı 'ʎɹoǝɥʇ uI ˙\"sǝɔıןs\" 9Ɩ oʇ ϛ ɟo buıʇsısuoɔ ǝɹnʇɔnɹʇs ʞɔoןqıʇןnɯ ǝbɹɐן ɐ sı ǝuıꞀ ʎןqɯǝssⱯ ǝɥ⟘",
"gtceu.multiblock.blast_furnace.max_temperature": "%s :ʎʇıɔɐdɐƆ ʇɐǝH",
Expand Down Expand Up @@ -3642,7 +3647,7 @@
"gtceu.multiblock.hpca.warning_structure_header": ":sbuıuɹɐM ǝɹnʇɔnɹʇS",
"gtceu.multiblock.hpca.warning_temperature": "¡Ɔ00Ɩ ʇɐ pǝbɐɯɐp ǝq ʎɐɯ sʇuǝuodɯoɔ 'Ɔ0ϛ ǝʌoqɐ ǝɹnʇɐɹǝdɯǝ⟘",
"gtceu.multiblock.hpca.warning_temperature_active_cool": "sɹǝןooɔ ǝʌıʇɔɐ buızıןıʇn ʎןןnℲ",
"gtceu.multiblock.idling": "˙buıןpI",
"gtceu.multiblock.idling": "˙buıןpI9§",
"gtceu.multiblock.implosion_compressor.description": "˙sɯǝb buıpuodsǝɹɹoɔ ɹıǝɥʇ oʇuı sʇsnp ɯǝb uɹnʇ oʇ sǝʌısoןdxǝ sǝsn ʇɐɥʇ ǝɹnʇɔnɹʇs ʞɔoןqıʇןnɯ ɐ sı ɹossǝɹdɯoƆ uoısoןdɯI ǝɥ⟘",
"gtceu.multiblock.invalid_structure": "˙ǝɹnʇɔnɹʇs pıןɐʌuI",
"gtceu.multiblock.invalid_structure.tooltip": "˙IƎſ uı ǝʇɐןdɯǝʇ ǝɹnʇɔnɹʇs ǝǝs 'dןǝɥ buıpןınq ɹoℲ ˙ǝɹnʇɔnɹʇs ʞɔoןqıʇןnɯ ǝɥʇ ɟo ɹǝןןoɹʇuoɔ ɐ sı ʞɔoןq sıɥ⟘",
Expand Down
7 changes: 6 additions & 1 deletion src/generated/resources/assets/gtceu/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -3579,6 +3579,11 @@
"gtceu.mode.fluid": "§9Fluid§r",
"gtceu.mode.item": "§6Item§r",
"gtceu.muffler.recovery_tooltip": "§bRecovery Chance: §f%d%%",
"gtceu.multiblock.active_transformer.average_in": "§bAvg. Input: §f%s EU/t",
"gtceu.multiblock.active_transformer.average_out": "§bAvg. Output: §f%s EU/t",
"gtceu.multiblock.active_transformer.danger_enabled": "§c§bDANGER: Explosive",
"gtceu.multiblock.active_transformer.max_input": "§aMax Input: §f%s EU/t",
"gtceu.multiblock.active_transformer.max_output": "§cMax Output: §f%s EU/t",
"gtceu.multiblock.advanced_processing_array.description": "The Processing Array combines up to 64 single block machine(s) in a single multiblock, effectively easing automation.",
"gtceu.multiblock.assembly_line.description": "The Assembly Line is a large multiblock structure consisting of 5 to 16 \"slices\". In theory, it's large Assembling Machine, used for creating advanced crafting components.",
"gtceu.multiblock.blast_furnace.max_temperature": "Heat Capacity: %s",
Expand Down Expand Up @@ -3642,7 +3647,7 @@
"gtceu.multiblock.hpca.warning_structure_header": "Structure Warnings:",
"gtceu.multiblock.hpca.warning_temperature": "Temperature above 50C, components may be damaged at 100C!",
"gtceu.multiblock.hpca.warning_temperature_active_cool": "Fully utilizing active coolers",
"gtceu.multiblock.idling": "Idling.",
"gtceu.multiblock.idling": "§6Idling.",
"gtceu.multiblock.implosion_compressor.description": "The Implosion Compressor is a multiblock structure that uses explosives to turn gem dusts into their corresponding gems.",
"gtceu.multiblock.invalid_structure": "Invalid structure.",
"gtceu.multiblock.invalid_structure.tooltip": "This block is a controller of the multiblock structure. For building help, see structure template in JEI.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,28 @@
import com.gregtechceu.gtceu.api.capability.IEnergyContainer;
import com.gregtechceu.gtceu.api.capability.recipe.EURecipeCapability;
import com.gregtechceu.gtceu.api.capability.recipe.IO;
import com.gregtechceu.gtceu.api.gui.GuiTextures;
import com.gregtechceu.gtceu.api.gui.fancy.FancyMachineUIWidget;
import com.gregtechceu.gtceu.api.machine.ConditionalSubscriptionHandler;
import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity;
import com.gregtechceu.gtceu.api.machine.MetaMachine;
import com.gregtechceu.gtceu.api.machine.feature.IExplosionMachine;
import com.gregtechceu.gtceu.api.machine.feature.IFancyUIMachine;
import com.gregtechceu.gtceu.api.machine.feature.multiblock.IDisplayUIMachine;
import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiPart;
import com.gregtechceu.gtceu.api.machine.multiblock.PartAbility;
import com.gregtechceu.gtceu.api.machine.multiblock.WorkableElectricMultiblockMachine;
import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic;
import com.gregtechceu.gtceu.api.misc.EnergyContainerList;
import com.gregtechceu.gtceu.api.pattern.TraceabilityPredicate;
import com.gregtechceu.gtceu.config.ConfigHolder;
import com.gregtechceu.gtceu.utils.FormattingUtil;

import com.lowdragmc.lowdraglib.gui.modular.ModularUI;
import com.lowdragmc.lowdraglib.gui.widget.*;

import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.block.Block;

import it.unimi.dsi.fastutil.longs.Long2ObjectMaps;
Expand All @@ -29,7 +39,7 @@
import static com.gregtechceu.gtceu.api.pattern.Predicates.abilities;

public class ActiveTransformerMachine extends WorkableElectricMultiblockMachine
implements IControllable, IExplosionMachine {
implements IControllable, IExplosionMachine, IFancyUIMachine, IDisplayUIMachine {

private IEnergyContainer powerOutput;
private IEnergyContainer powerInput;
Expand Down Expand Up @@ -147,4 +157,55 @@ public static TraceabilityPredicate getHatchPredicates() {
.or(abilities(PartAbility.INPUT_LASER).setPreviewCount(1))
.or(abilities(PartAbility.OUTPUT_LASER).setPreviewCount(1));
}

@Override
public void addDisplayText(List<Component> textList) {
// super.addDisplayText(textList); idek what it does stop doing what you do for a minute pls
// Assume That the Structure is ALWAYS formed, and has at least 1 In and 1 Out, there is never a case where this
// does not occur.
if (isFormed()) {
if (!isWorkingEnabled()) {
textList.add(Component.translatable("gtceu.multiblock.work_paused"));
} else if (isActive()) {
textList.add(Component.translatable("gtceu.multiblock.running"));
textList.add(Component
.translatable("gtceu.multiblock.active_transformer.max_input",
FormattingUtil.formatNumbers(
Math.abs(powerInput.getInputVoltage() * powerInput.getInputAmperage()))));
textList.add(Component
.translatable("gtceu.multiblock.active_transformer.max_output",
FormattingUtil.formatNumbers(
Math.abs(powerOutput.getOutputVoltage() * powerOutput.getOutputAmperage()))));
textList.add(Component
.translatable("gtceu.multiblock.active_transformer.average_in",
FormattingUtil.formatNumbers(Math.abs(powerInput.getInputPerSec() / 20))));
textList.add(Component
.translatable("gtceu.multiblock.active_transformer.average_out",
FormattingUtil.formatNumbers(Math.abs(powerOutput.getOutputPerSec() / 20))));
if (!ConfigHolder.INSTANCE.machines.harmlessActiveTransformers) {
textList.add(Component
.translatable("gtceu.multiblock.active_transformer.danger_enabled"));
}
} else {
textList.add(Component.translatable("gtceu.multiblock.idling"));
}
}
}

@Override
public @NotNull Widget createUIWidget() {
var group = new WidgetGroup(0, 0, 182 + 8, 117 + 8);
group.addWidget(new DraggableScrollableWidgetGroup(4, 4, 182, 117).setBackground(getScreenTexture())
.addWidget(new LabelWidget(4, 5, self().getBlockState().getBlock().getDescriptionId()))
.addWidget(new ComponentPanelWidget(4, 17, this::addDisplayText)
.setMaxWidthLimit(150)
.clickHandler(this::handleDisplayClick)));
group.setBackground(GuiTextures.BACKGROUND_INVERSE);
return group;
}

@Override
public @NotNull ModularUI createUI(@NotNull Player entityPlayer) {
return new ModularUI(198, 208, this, entityPlayer).widget(new FancyMachineUIWidget(this, 198, 208));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ public static void init(RegistrateLangProvider provider) {
provider.add("gtceu.duct_pipe.transfer_rate", "§bAir transfer rate: %s");
provider.add("gtceu.multiblock.work_paused", "Work Paused.");
provider.add("gtceu.multiblock.running", "Running perfectly.");
provider.add("gtceu.multiblock.idling", "Idling.");
provider.add("gtceu.multiblock.idling", "§6Idling.");
provider.add("gtceu.multiblock.not_enough_energy", "WARNING: Machine needs more energy.");
provider.add("gtceu.multiblock.not_enough_energy_output", "WARNING: Energy Dynamo Tier Too Low!");
provider.add("gtceu.multiblock.waiting", "WARNING: Machine is waiting.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,11 @@ protected static void init(RegistrateLangProvider provider) {
provider.add("gtceu.multiblock.power_substation.time_forever", "Forever");
provider.add("gtceu.multiblock.power_substation.under_one_hour_left",
"Less than 1 hour until fully drained!");
provider.add("gtceu.multiblock.active_transformer.average_in", "§bAvg. Input: §f%s EU/t");
provider.add("gtceu.multiblock.active_transformer.average_out", "§bAvg. Output: §f%s EU/t");
provider.add("gtceu.multiblock.active_transformer.max_input", "§aMax Input: §f%s EU/t");
provider.add("gtceu.multiblock.active_transformer.max_output", "§cMax Output: §f%s EU/t");
provider.add("gtceu.multiblock.active_transformer.danger_enabled", "§c§bDANGER: Explosive");
provider.add("gtceu.multiblock.data_bank.providing", "Providing data.");
provider.add("gtceu.multiblock.hpca.computation", "Providing: %s");
provider.add("gtceu.multiblock.hpca.energy", "Using: %s / %s EU/t (%s)");
Expand Down

0 comments on commit 75ad349

Please sign in to comment.