From 04d84feae92c8e3c99d39ef0ee4558cfb760b3a9 Mon Sep 17 00:00:00 2001 From: YoungOnion <39562198+YoungOnionMC@users.noreply.github.com> Date: Tue, 20 Aug 2024 20:25:15 -0600 Subject: [PATCH 1/6] Print out output lines --- .../resources/assets/gtceu/lang/en_ud.json | 6 +- .../resources/assets/gtceu/lang/en_us.json | 6 +- .../multiblock/MultiblockDisplayText.java | 76 ++++++++++++++++++- .../WorkableElectricMultiblockMachine.java | 6 +- .../gtceu/data/lang/LangHandler.java | 6 +- .../gtceu/utils/FormattingUtil.java | 5 ++ 6 files changed, 96 insertions(+), 9 deletions(-) diff --git a/src/generated/resources/assets/gtceu/lang/en_ud.json b/src/generated/resources/assets/gtceu/lang/en_ud.json index 6019654a36..4707248f3a 100644 --- a/src/generated/resources/assets/gtceu/lang/en_ud.json +++ b/src/generated/resources/assets/gtceu/lang/en_ud.json @@ -3700,6 +3700,10 @@ "gtceu.multiblock.ore_rig.drilled_ore_entry": "%s - ", "gtceu.multiblock.ore_rig.drilled_ores_list": ":sǝɹO", "gtceu.multiblock.ore_rig.ore_amount": "%s :ǝʇɐᴚ buıןןıɹᗡ", + "gtceu.multiblock.output_line.0": ")ɐǝ/%ss( ɹ§%sǝ§ x %s", + "gtceu.multiblock.output_line.1": ")s/%s( ɹ§%sǝ§ x %s", + "gtceu.multiblock.output_line.2": ")ɐǝ/%ss( ɹ§%sǝ§ ≈ %s", + "gtceu.multiblock.output_line.3": ")s/%s( ɹ§%sǝ§ ≈ %s", "gtceu.multiblock.page_switcher.io.both": "sʇndʇnO + sʇnduI pǝuıqɯoƆϛ§", "gtceu.multiblock.page_switcher.io.export": "sʇndʇnOㄣ§", "gtceu.multiblock.page_switcher.io.import": "sʇnduIᄅ§", @@ -3757,7 +3761,7 @@ "gtceu.multiblock.primitive_water_pump.extra2.4": "", "gtceu.multiblock.primitive_water_pump.extra2.5": "˙%%0ϛ ʎq pǝsɐǝɹɔuı ǝq ןןıʍ uoıʇɔnpoɹd ɹǝʇɐʍ ןɐʇoʇ ǝɥʇ 'ǝɯoıᗺ s,dɯnԀ ǝɥʇ uı buıuıɐɹ ǝןıɥM", "gtceu.multiblock.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.progress": "%s%% :ssǝɹboɹԀ", + "gtceu.multiblock.progress": ")%s%%( %ss / %ss :ssǝɹboɹԀ", "gtceu.multiblock.pyrolyse_oven.description": "˙ןıO ʎʌɐǝH puɐ ɥsⱯ ɹo 'ןıO ǝʇosoǝɹƆ puɐ ןɐoɔɹɐɥƆ oʇuı sboꞀ buıuɹnʇ ɹoɟ pǝsn ǝɹnʇɔnɹʇs ʞɔoןqıʇןnɯ ɐ sı uǝʌO ǝsʎןoɹʎԀ ǝɥ⟘", "gtceu.multiblock.pyrolyse_oven.speed": "%s%% :pǝǝdS buıssǝɔoɹԀ", "gtceu.multiblock.require_steam_parts": "¡sǝsnᗺ puɐ sǝɥɔʇɐH ɯɐǝʇS sǝɹınbǝᴚ", diff --git a/src/generated/resources/assets/gtceu/lang/en_us.json b/src/generated/resources/assets/gtceu/lang/en_us.json index 4c4ac1d0b2..4dc8009e91 100644 --- a/src/generated/resources/assets/gtceu/lang/en_us.json +++ b/src/generated/resources/assets/gtceu/lang/en_us.json @@ -3700,6 +3700,10 @@ "gtceu.multiblock.ore_rig.drilled_ore_entry": " - %s", "gtceu.multiblock.ore_rig.drilled_ores_list": "Ores:", "gtceu.multiblock.ore_rig.ore_amount": "Drilling Rate: %s", + "gtceu.multiblock.output_line.0": "%s x §e%s§r (%ss/ea)", + "gtceu.multiblock.output_line.1": "%s x §e%s§r (%s/s)", + "gtceu.multiblock.output_line.2": "%s ≈ §e%s§r (%ss/ea)", + "gtceu.multiblock.output_line.3": "%s ≈ §e%s§r (%s/s)", "gtceu.multiblock.page_switcher.io.both": "§5Combined Inputs + Outputs", "gtceu.multiblock.page_switcher.io.export": "§4Outputs", "gtceu.multiblock.page_switcher.io.import": "§2Inputs", @@ -3757,7 +3761,7 @@ "gtceu.multiblock.primitive_water_pump.extra2.4": "", "gtceu.multiblock.primitive_water_pump.extra2.5": "While raining in the Pump's Biome, the total water production will be increased by 50%%.", "gtceu.multiblock.processing_array.description": "The Processing Array combines up to 16 single block machine(s) in a single multiblock, effectively easing automation.", - "gtceu.multiblock.progress": "Progress: %s%%", + "gtceu.multiblock.progress": "Progress: %ss / %ss (%s%%)", "gtceu.multiblock.pyrolyse_oven.description": "The Pyrolyse Oven is a multiblock structure used for turning Logs into Charcoal and Creosote Oil, or Ash and Heavy Oil.", "gtceu.multiblock.pyrolyse_oven.speed": "Processing Speed: %s%%", "gtceu.multiblock.require_steam_parts": "Requires Steam Hatches and Buses!", diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java index d229164d60..2c9107d86e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java @@ -2,6 +2,9 @@ import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.IEnergyContainer; +import com.gregtechceu.gtceu.api.capability.recipe.FluidRecipeCapability; +import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability; +import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.utils.FormattingUtil; @@ -305,11 +308,76 @@ public Builder addIdlingLine(boolean checkState) { * * @param progressPercent Progress formatted as a range of [0,1] representing the progress of the recipe. */ - public Builder addProgressLine(double progressPercent) { // todo + public Builder addProgressLine(double currentDuration, double maxDuration, double progressPercent) { // todo if (!isStructureFormed || !isActive) return this; int currentProgress = (int) (progressPercent * 100); - textList.add(Component.translatable("gtceu.multiblock.progress", currentProgress)); + double currentInSec = currentDuration / 20.0; + double maxInSec = maxDuration / 20.0; + textList.add(Component.translatable("gtceu.multiblock.progress", + String.format("%.2f", (float) currentInSec), + String.format("%.2f", (float) maxInSec), currentProgress)); + return this; + } + + public Builder addOutputLines(GTRecipe recipe) { + if (!isStructureFormed || !isActive) + return this; + if (recipe != null) { + double maxDurationSec = (double) recipe.duration / 20.0; + var itemOutputs = recipe.getOutputContents(ItemRecipeCapability.CAP); + var fluidOutputs = recipe.getOutputContents(FluidRecipeCapability.CAP); + for (var item : itemOutputs) { + var stack = (ItemRecipeCapability.CAP.of(item.content).getItems()[0]); + if (stack.getCount() < maxDurationSec) { + if (item.chance < item.maxChance) { + double averageDurationforRoll = (double) item.maxChance / (double) item.chance; + textList.add(Component.translatable("gtceu.multiblock.output_line.2", stack.getHoverName(), + stack.getCount(), + FormattingUtil.formatNumber2Places(averageDurationforRoll * maxDurationSec))); + } else { + textList.add(Component.translatable("gtceu.multiblock.output_line.0", stack.getHoverName(), + stack.getCount(), maxDurationSec)); + } + } else { + double countPerSec = (double) stack.getCount() / maxDurationSec; + if (item.chance < item.maxChance) { + double averageDurationforRoll = (double) item.maxChance / (double) item.chance; + textList.add(Component.translatable("gtceu.multiblock.output_line.3", + stack.getHoverName(), stack.getCount(), + FormattingUtil.formatNumber2Places(averageDurationforRoll * countPerSec))); + } else { + textList.add(Component.translatable("gtceu.multiblock.output_line.1", + stack.getHoverName(), stack.getCount(), countPerSec)); + } + } + } + for (var fluid : fluidOutputs) { + var stack = (FluidRecipeCapability.CAP.of(fluid.content).getStacks()[0]); + if (stack.getAmount() < maxDurationSec) { + if (fluid.chance < fluid.maxChance) { + double averageDurationforRoll = (double) fluid.maxChance / (double) fluid.chance; + textList.add(Component.translatable("gtceu.multiblock.output_line.2", + stack.getDisplayName(), stack.getAmount(), + FormattingUtil.formatNumber2Places(averageDurationforRoll * maxDurationSec))); + } else { + textList.add(Component.translatable("gtceu.multiblock.output_line.0", + stack.getDisplayName(), stack.getAmount(), maxDurationSec)); + } + } else { + double countPerSec = (double) stack.getAmount() / maxDurationSec; + if (fluid.chance < fluid.maxChance) { + double averageDurationforRoll = (double) fluid.maxChance / (double) fluid.chance; + textList.add(Component.translatable("gtceu.multiblock.output_line.1", + stack.getDisplayName(), stack.getAmount(), + FormattingUtil.formatNumber2Places(averageDurationforRoll * countPerSec))); + } else { + textList.add(Component.translatable("gtceu.multiblock.output_line.1", + stack.getDisplayName(), stack.getAmount(), countPerSec)); + } + } + } + } return this; } @@ -318,8 +386,8 @@ public Builder addProgressLine(double progressPercent) { // todo *
* Added if structure is formed and the number of parallels is greater than one. */ - public Builder addMachineModeLine(GTRecipeType recipeType) { - if (!isStructureFormed) + public Builder addMachineModeLine(GTRecipeType recipeType, boolean hasMultipleModes) { + if (!isStructureFormed || !hasMultipleModes) return this; textList.add(Component .translatable("gtceu.gui.machinemode", diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableElectricMultiblockMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableElectricMultiblockMachine.java index baaf9961fb..60893a4928 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableElectricMultiblockMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableElectricMultiblockMachine.java @@ -88,10 +88,12 @@ public void addDisplayText(List textList) { .setWorkingStatus(recipeLogic.isWorkingEnabled(), recipeLogic.isActive()) .addEnergyUsageLine(energyContainer) .addEnergyTierLine(GTUtil.getTierByVoltage(getMaxVoltage())) - .addMachineModeLine(getRecipeType()) + .addMachineModeLine(getRecipeType(), getRecipeTypes().length > 1) .addParallelsLine(numParallels) .addWorkingStatusLine() - .addProgressLine(recipeLogic.getProgressPercent()); + .addProgressLine(recipeLogic.getProgress(), recipeLogic.getMaxProgress(), + recipeLogic.getProgressPercent()) + .addOutputLines(recipeLogic.getLastRecipe()); getDefinition().getAdditionalDisplay().accept(this, textList); IDisplayUIMachine.super.addDisplayText(textList); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/lang/LangHandler.java b/src/main/java/com/gregtechceu/gtceu/data/lang/LangHandler.java index b24e9d8a46..adbe3ce4f3 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/lang/LangHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/lang/LangHandler.java @@ -1059,7 +1059,11 @@ public static void init(RegistrateLangProvider provider) { 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."); - provider.add("gtceu.multiblock.progress", "Progress: %s%%"); + provider.add("gtceu.multiblock.progress", "Progress: %ss / %ss (%s%%)"); + provider.add("gtceu.multiblock.output_line.0", "%s x §e%s§r (%ss/ea)"); + provider.add("gtceu.multiblock.output_line.1", "%s x §e%s§r (%s/s)"); + provider.add("gtceu.multiblock.output_line.2", "%s ≈ §e%s§r (%ss/ea)"); + provider.add("gtceu.multiblock.output_line.3", "%s ≈ §e%s§r (%s/s)"); provider.add("gtceu.multiblock.invalid_structure", "Invalid structure."); provider.add("gtceu.multiblock.invalid_structure.tooltip", "This block is a controller of the multiblock structure. For building help, see structure template in JEI."); diff --git a/src/main/java/com/gregtechceu/gtceu/utils/FormattingUtil.java b/src/main/java/com/gregtechceu/gtceu/utils/FormattingUtil.java index 95d3974d75..3d4320f6d7 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/FormattingUtil.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/FormattingUtil.java @@ -179,6 +179,11 @@ public static String formatNumber2Places(float number) { return DECIMAL_FORMAT_2F.format(number); } + @NotNull + public static String formatNumber2Places(double number) { + return DECIMAL_FORMAT_2F.format(number); + } + public static Component formatPercentage2Places(String langKey, float percentage) { return Component.translatable(langKey, formatNumber2Places(percentage)).withStyle(YELLOW); } From b73e9f01ca92c72330c2ce2cb2a2d7b817202861 Mon Sep 17 00:00:00 2001 From: YoungOnion <39562198+YoungOnionMC@users.noreply.github.com> Date: Tue, 20 Aug 2024 21:04:47 -0600 Subject: [PATCH 2/6] 2 digit formatting for fluids --- .../gtceu/api/machine/multiblock/MultiblockDisplayText.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java index 2c9107d86e..390c2bcf42 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java @@ -362,7 +362,7 @@ public Builder addOutputLines(GTRecipe recipe) { FormattingUtil.formatNumber2Places(averageDurationforRoll * maxDurationSec))); } else { textList.add(Component.translatable("gtceu.multiblock.output_line.0", - stack.getDisplayName(), stack.getAmount(), maxDurationSec)); + stack.getDisplayName(), stack.getAmount(), FormattingUtil.formatNumber2Places(maxDurationSec))); } } else { double countPerSec = (double) stack.getAmount() / maxDurationSec; @@ -373,7 +373,8 @@ public Builder addOutputLines(GTRecipe recipe) { FormattingUtil.formatNumber2Places(averageDurationforRoll * countPerSec))); } else { textList.add(Component.translatable("gtceu.multiblock.output_line.1", - stack.getDisplayName(), stack.getAmount(), countPerSec)); + stack.getDisplayName(), stack.getAmount(), + FormattingUtil.formatNumber2Places(countPerSec))); } } } From b03adafe6ed6872129c46693c44ef4d41ca4c0cb Mon Sep 17 00:00:00 2001 From: YoungOnion <39562198+YoungOnionMC@users.noreply.github.com> Date: Fri, 27 Sep 2024 15:58:07 -0600 Subject: [PATCH 3/6] fix fluid chances --- .../gtceu/api/machine/feature/multiblock/IDisplayUIMachine.java | 2 +- .../gtceu/api/machine/multiblock/MultiblockDisplayText.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IDisplayUIMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IDisplayUIMachine.java index 4ea74e60c9..365106eca2 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IDisplayUIMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IDisplayUIMachine.java @@ -42,7 +42,7 @@ default ModularUI createUI(Player entityPlayer) { screen.addWidget(new ComponentPanelWidget(4, 17, this::addDisplayText) .textSupplier(this.self().getLevel().isClientSide ? null : this::addDisplayText) .setMaxWidthLimit(150) - .clickHandler(this::handleDisplayClick)); + .clickHandler(this::handleDisplayClick)).setSizeHeight(8); return new ModularUI(176, 216, this, entityPlayer) .background(GuiTextures.BACKGROUND) .widget(screen) diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java index 390c2bcf42..2a99ec4957 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java @@ -368,7 +368,7 @@ public Builder addOutputLines(GTRecipe recipe) { double countPerSec = (double) stack.getAmount() / maxDurationSec; if (fluid.chance < fluid.maxChance) { double averageDurationforRoll = (double) fluid.maxChance / (double) fluid.chance; - textList.add(Component.translatable("gtceu.multiblock.output_line.1", + textList.add(Component.translatable("gtceu.multiblock.output_line.3", stack.getDisplayName(), stack.getAmount(), FormattingUtil.formatNumber2Places(averageDurationforRoll * countPerSec))); } else { From ab00cc9db1ca0ae7bafcc89fb7f9a6cb8638b88f Mon Sep 17 00:00:00 2001 From: YoungOnion <39562198+YoungOnionMC@users.noreply.github.com> Date: Sat, 28 Sep 2024 22:40:12 -0600 Subject: [PATCH 4/6] correct chance values for output averages --- .../multiblock/MultiblockDisplayText.java | 22 ++++++++++++++----- .../WorkableElectricMultiblockMachine.java | 4 ++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java index 2a99ec4957..0ea7b8843b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java @@ -3,9 +3,11 @@ import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.IEnergyContainer; import com.gregtechceu.gtceu.api.capability.recipe.FluidRecipeCapability; +import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; +import com.gregtechceu.gtceu.api.recipe.RecipeHelper; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.utils.FormattingUtil; import com.gregtechceu.gtceu.utils.GTUtil; @@ -320,18 +322,22 @@ public Builder addProgressLine(double currentDuration, double maxDuration, doubl return this; } - public Builder addOutputLines(GTRecipe recipe) { + public Builder addOutputLines(GTRecipe recipe, int chanceTier) { if (!isStructureFormed || !isActive) return this; if (recipe != null) { + var function = recipe.getType().getChanceFunction(); + var logic = recipe.getChanceLogicForCapability(ItemRecipeCapability.CAP, IO.OUT, false); double maxDurationSec = (double) recipe.duration / 20.0; var itemOutputs = recipe.getOutputContents(ItemRecipeCapability.CAP); var fluidOutputs = recipe.getOutputContents(FluidRecipeCapability.CAP); + for (var item : itemOutputs) { var stack = (ItemRecipeCapability.CAP.of(item.content).getItems()[0]); if (stack.getCount() < maxDurationSec) { if (item.chance < item.maxChance) { - double averageDurationforRoll = (double) item.maxChance / (double) item.chance; + double averageDurationforRoll = (double) item.maxChance / (double) function + .getBoostedChance(item, RecipeHelper.getPreOCRecipeEuTier(recipe), chanceTier); textList.add(Component.translatable("gtceu.multiblock.output_line.2", stack.getHoverName(), stack.getCount(), FormattingUtil.formatNumber2Places(averageDurationforRoll * maxDurationSec))); @@ -342,7 +348,8 @@ public Builder addOutputLines(GTRecipe recipe) { } else { double countPerSec = (double) stack.getCount() / maxDurationSec; if (item.chance < item.maxChance) { - double averageDurationforRoll = (double) item.maxChance / (double) item.chance; + double averageDurationforRoll = (double) item.maxChance / (double) function + .getBoostedChance(item, RecipeHelper.getPreOCRecipeEuTier(recipe), chanceTier); textList.add(Component.translatable("gtceu.multiblock.output_line.3", stack.getHoverName(), stack.getCount(), FormattingUtil.formatNumber2Places(averageDurationforRoll * countPerSec))); @@ -356,18 +363,21 @@ public Builder addOutputLines(GTRecipe recipe) { var stack = (FluidRecipeCapability.CAP.of(fluid.content).getStacks()[0]); if (stack.getAmount() < maxDurationSec) { if (fluid.chance < fluid.maxChance) { - double averageDurationforRoll = (double) fluid.maxChance / (double) fluid.chance; + double averageDurationforRoll = (double) fluid.maxChance / (double) function + .getBoostedChance(fluid, RecipeHelper.getPreOCRecipeEuTier(recipe), chanceTier); textList.add(Component.translatable("gtceu.multiblock.output_line.2", stack.getDisplayName(), stack.getAmount(), FormattingUtil.formatNumber2Places(averageDurationforRoll * maxDurationSec))); } else { textList.add(Component.translatable("gtceu.multiblock.output_line.0", - stack.getDisplayName(), stack.getAmount(), FormattingUtil.formatNumber2Places(maxDurationSec))); + stack.getDisplayName(), stack.getAmount(), + FormattingUtil.formatNumber2Places(maxDurationSec))); } } else { double countPerSec = (double) stack.getAmount() / maxDurationSec; if (fluid.chance < fluid.maxChance) { - double averageDurationforRoll = (double) fluid.maxChance / (double) fluid.chance; + double averageDurationforRoll = (double) fluid.maxChance / (double) function + .getBoostedChance(fluid, RecipeHelper.getPreOCRecipeEuTier(recipe), chanceTier); textList.add(Component.translatable("gtceu.multiblock.output_line.3", stack.getDisplayName(), stack.getAmount(), FormattingUtil.formatNumber2Places(averageDurationforRoll * countPerSec))); diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableElectricMultiblockMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableElectricMultiblockMachine.java index 4937a1c347..3462a2b0b7 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableElectricMultiblockMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableElectricMultiblockMachine.java @@ -100,7 +100,7 @@ public void addDisplayText(List textList) { .addWorkingStatusLine() .addProgressLine(recipeLogic.getProgress(), recipeLogic.getMaxProgress(), recipeLogic.getProgressPercent()) - .addOutputLines(recipeLogic.getLastRecipe()); + .addOutputLines(recipeLogic.getLastRecipe(), this.getChanceTier()); getDefinition().getAdditionalDisplay().accept(this, textList); IDisplayUIMachine.super.addDisplayText(textList); } @@ -112,7 +112,7 @@ public Widget createUIWidget() { .addWidget(new LabelWidget(4, 5, self().getBlockState().getBlock().getDescriptionId())) .addWidget(new ComponentPanelWidget(4, 17, this::addDisplayText) .textSupplier(this.getLevel().isClientSide ? null : this::addDisplayText) - .setMaxWidthLimit(150) + .setMaxWidthLimit(200) .clickHandler(this::handleDisplayClick))); group.setBackground(GuiTextures.BACKGROUND_INVERSE); return group; From 3f53f891ad5735a32153d4ff2cdf0e2db33b72dd Mon Sep 17 00:00:00 2001 From: YoungOnion <39562198+YoungOnionMC@users.noreply.github.com> Date: Sun, 29 Sep 2024 17:20:37 -0600 Subject: [PATCH 5/6] requested changes --- .../api/machine/multiblock/MultiblockDisplayText.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java index 0ea7b8843b..c692b143ab 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java @@ -3,7 +3,6 @@ import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.IEnergyContainer; import com.gregtechceu.gtceu.api.capability.recipe.FluidRecipeCapability; -import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; @@ -304,13 +303,15 @@ public Builder addIdlingLine(boolean checkState) { } /** - * Adds a simple progress line that displays progress as a percentage. + * Adds a simple progress line that displays the current time of a recipe and its progress as a percentage. *
* Added if structure is formed and the machine is active. * + * @param currentDuration The current duration of the recipe in ticks + * @param maxDuration The max duration of the recipe in ticks * @param progressPercent Progress formatted as a range of [0,1] representing the progress of the recipe. */ - public Builder addProgressLine(double currentDuration, double maxDuration, double progressPercent) { // todo + public Builder addProgressLine(double currentDuration, double maxDuration, double progressPercent) { if (!isStructureFormed || !isActive) return this; int currentProgress = (int) (progressPercent * 100); @@ -327,7 +328,6 @@ public Builder addOutputLines(GTRecipe recipe, int chanceTier) { return this; if (recipe != null) { var function = recipe.getType().getChanceFunction(); - var logic = recipe.getChanceLogicForCapability(ItemRecipeCapability.CAP, IO.OUT, false); double maxDurationSec = (double) recipe.duration / 20.0; var itemOutputs = recipe.getOutputContents(ItemRecipeCapability.CAP); var fluidOutputs = recipe.getOutputContents(FluidRecipeCapability.CAP); From e419b3230252d42aec8cce3a94a8f6ce1e2792a8 Mon Sep 17 00:00:00 2001 From: YoungOnion <39562198+YoungOnionMC@users.noreply.github.com> Date: Mon, 30 Sep 2024 01:10:08 -0600 Subject: [PATCH 6/6] formatting error occurred --- .../gtceu/api/machine/multiblock/MultiblockDisplayText.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java index c692b143ab..cd2637cb83 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java @@ -393,9 +393,7 @@ public Builder addOutputLines(GTRecipe recipe, int chanceTier) { } /** - * Adds a line indicating how many parallels this multi can potentially perform. - *
- * Added if structure is formed and the number of parallels is greater than one. + * Adds a line indicating the current mode of the multi */ public Builder addMachineModeLine(GTRecipeType recipeType, boolean hasMultipleModes) { if (!isStructureFormed || !hasMultipleModes)