From 4a2b9b4bec0e4f946bc52aac0099af87c7fc3948 Mon Sep 17 00:00:00 2001 From: GDCloud Date: Thu, 26 Dec 2024 02:11:24 +0100 Subject: [PATCH 1/4] add fuel factor preview and voltage info in statistics screen --- .../loaders/postload/chains/NaniteChain.java | 9 + .../multi/godforge/MTEForgeOfGods.java | 176 +++++++++++++----- .../multi/godforge/util/GodforgeMath.java | 22 ++- .../resources/assets/tectech/lang/en_US.lang | 5 + 4 files changed, 157 insertions(+), 55 deletions(-) diff --git a/src/main/java/gregtech/loaders/postload/chains/NaniteChain.java b/src/main/java/gregtech/loaders/postload/chains/NaniteChain.java index eb51d852809..6290e269c7a 100644 --- a/src/main/java/gregtech/loaders/postload/chains/NaniteChain.java +++ b/src/main/java/gregtech/loaders/postload/chains/NaniteChain.java @@ -281,5 +281,14 @@ public static void run() { .duration(16 * MINUTES + 40 * SECONDS) .eut(TierEU.RECIPE_MAX) .addTo(nanoForgeRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(MaterialsUEVplus.Eternity.getIngots(1), Materials.Iron.getIngots(1)) + .fluidInputs(Materials.Water.getFluid(1000)) + .itemOutputs(Materials.Iron.getNanite(1)) + .metadata(NANO_FORGE_TIER, 4) + .duration(16 * MINUTES + 40 * SECONDS) + .eut(TierEU.RECIPE_MAX) + .addTo(nanoForgeRecipes); } } diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEForgeOfGods.java b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEForgeOfGods.java index 314cf9919c9..05222da2f97 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEForgeOfGods.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEForgeOfGods.java @@ -2474,6 +2474,9 @@ private void openCustomStarColorWindowFresh(Widget widget, @Nullable ForgeOfGods } } + private int previewFactor = 0; + private final List infoTexts = Arrays.asList(new String[28]); + protected ModularWindow createStatisticsWindow(final EntityPlayer player) { final int WIDTH = 300; final int HEIGHT = 300; @@ -2537,6 +2540,14 @@ protected ModularWindow createStatisticsWindow(final EntityPlayer player) { .setSize(69, 30) .addTooltip(translateToLocal("fog.text.tooltip.ocdivisor")) .setTooltipShowUpDelay(TOOLTIP_DELAY)) + .widget( + new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.processingvoltage")).setScale(0.8f) + .setDefaultColor(EnumChatFormatting.GOLD) + .setTextAlignment(Alignment.Center) + .setPos(12, 236) + .setSize(69, 30) + .addTooltip(translateToLocal("fog.text.tooltip.processingvoltage")) + .setTooltipShowUpDelay(TOOLTIP_DELAY)) .widget( new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.powerforge")).setScale(0.8f) .setDefaultColor(EnumChatFormatting.GOLD) @@ -2566,12 +2577,12 @@ protected ModularWindow createStatisticsWindow(final EntityPlayer player) { for (int i = 0; i < 4; i++) { builder.widget( new DrawableWidget().setDrawable(new Rectangle().setColor(Color.rgb(190, 200, 0))) - .setSize(1, 197) + .setSize(1, 227) .setPos(81 + 53 * i, 38)); } // Horizontal grid lines - for (int i = 0; i < 7; i++) { + for (int i = 0; i < 8; i++) { builder.widget( new DrawableWidget().setDrawable(new Rectangle().setColor(Color.rgb(0, 170, 170))) .setSize(276, 1) @@ -2590,60 +2601,19 @@ protected ModularWindow createStatisticsWindow(final EntityPlayer player) { .clamp_int(val, 0, MilestoneFormatter.VALUES.length - 1)])); builder .widget(new FakeSyncWidget.IntegerSyncer(() -> fuelConsumptionFactor, val -> fuelConsumptionFactor = val)); + builder.widget(new FakeSyncWidget.IntegerSyncer(() -> previewFactor, val -> previewFactor = val)); builder.widget(upgrades.getFullSyncer()); - for (int i = 0; i < 24; i++) { - MTEBaseModule module; - switch (i % 4) { - case 1 -> { - module = molten; - } - case 2 -> { - module = plasma; - } - case 3 -> { - module = exotic; - } - default -> { - module = smelting; - } - } - - int cleanDiv4 = i / 4; - String relevantInfo; - switch (cleanDiv4) { - case 1 -> { - calculateMaxHeatForModules(module, this); - relevantInfo = String.valueOf(formattingMode.format(module.getHeatForOC())); - } - case 2 -> { - calculateMaxParallelForModules(module, this); - relevantInfo = String.valueOf(formattingMode.format(module.getMaxParallel())); - } - case 3 -> { - calculateSpeedBonusForModules(module, this); - relevantInfo = String.valueOf(formatNumbers(module.getSpeedBonus())); - } - case 4 -> { - calculateEnergyDiscountForModules(module, this); - relevantInfo = String.valueOf(formatNumbers(module.getEnergyDiscount())); - } - case 5 -> { - setMiscModuleParameters(module, this); - relevantInfo = String.valueOf(formatNumbers(module.getOverclockTimeFactor())); - } - default -> { - calculateMaxHeatForModules(module, this); - relevantInfo = String.valueOf(formattingMode.format(module.getHeat())); - } - } + for (int i = 0; i < 28; i++) { + calculateRelevantStatInfo(i, smelting, molten, plasma, exotic, fuelConsumptionFactor); + int finalI = i; builder.widget( new MultiChildWidget().addChild( new ButtonWidget().setOnClick((clickData, widget) -> {}) .setSize(53, 30)) .addChild( - new DynamicTextWidget(() -> new Text(relevantInfo)).setScale(1f) + new DynamicTextWidget(() -> new Text(infoTexts.get(finalI))).setScale(1f) .setDefaultColor(EnumChatFormatting.GREEN) .setTextAlignment(Alignment.Center) .setSize(53, 30)) @@ -2657,18 +2627,124 @@ protected ModularWindow createStatisticsWindow(final EntityPlayer player) { TecTech.proxy.playSound(getBaseMetaTileEntity(), "fx_click"); if (clickData.mouseButton == 0) { formattingMode = formattingMode.cycle(); - ForgeOfGodsUI.reopenWindow(widget, STATISTICS_WINDOW_ID); + for (int i = 0; i < 28; i++) { + calculateRelevantStatInfo( + i, + smelting, + molten, + plasma, + exotic, + previewFactor == fuelConsumptionFactor ? fuelConsumptionFactor : previewFactor); + } } }) .setSize(20, 20) .addTooltip(translateToLocal("fog.button.formatting.tooltip")) .setBackground(TecTechUITextures.OVERLAY_CYCLIC_BLUE) .setPos(8, 272) - .setTooltipShowUpDelay(TOOLTIP_DELAY)); + .setTooltipShowUpDelay(TOOLTIP_DELAY)) + .widget( + new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.factorpreview")).setScale(0.9f) + .setDefaultColor(EnumChatFormatting.GOLD) + .setSize(100, 18) + .setPos(80, 270)) + .widget( + new NumericWidget().setSetter(val -> previewFactor = (int) val) + .setGetter(() -> previewFactor) + .setBounds(1, Integer.MAX_VALUE) + .setDefaultValue(fuelConsumptionFactor) + .setScrollValues(1, 4, 64) + .setTextAlignment(Alignment.Center) + .setTextColor(Color.WHITE.normal) + .addTooltip(translateToLocal("fog.text.tooltip.factorpreview")) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setSize(70, 18) + .setPos(180, 270) + .setBackground(GTUITextures.BACKGROUND_TEXT_FIELD)) + .widget(new MultiChildWidget().addChild(new ButtonWidget().setOnClick((clickData, widget) -> { + TecTech.proxy.playSound(getBaseMetaTileEntity(), "fx_click"); + if (clickData.mouseButton == 0) { + for (int i = 0; i < 28; i++) { + calculateRelevantStatInfo( + i, + smelting, + molten, + plasma, + exotic, + previewFactor == fuelConsumptionFactor ? fuelConsumptionFactor : previewFactor); + } + } + }) + .addTooltip(translateToLocal("fog.text.tooltip.applysimulationchanges")) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setSize(35, 18) + .setBackground(GTUITextures.BUTTON_STANDARD) + .setPos(0, 0)) + .addChild( + new TextWidget(translateToLocal("fog.cosmetics.applycolor")).setScale(1f) + .setTextAlignment(Alignment.Center) + .setSize(35, 18) + .setPos(0, 0)) + .setPos(253, 270) + .setSize(35, 18)); return builder.build(); } + private void calculateRelevantStatInfo(int index, MTESmeltingModule smelting, MTEMoltenModule molten, + MTEPlasmaModule plasma, MTEExoticModule exotic, int fuelFactor) { + MTEBaseModule module; + switch (index % 4) { + case 1 -> { + module = molten; + } + case 2 -> { + module = plasma; + } + case 3 -> { + module = exotic; + } + default -> { + module = smelting; + } + } + + int cleanDiv4 = index / 4; + String relevantInfo; + switch (cleanDiv4) { + case 1 -> { + calculateMaxHeatForModules(module, this, fuelFactor); + relevantInfo = String.valueOf(formattingMode.format(module.getHeatForOC())); + } + case 2 -> { + calculateMaxParallelForModules(module, this, fuelFactor); + relevantInfo = String.valueOf(formattingMode.format(module.getMaxParallel())); + } + case 3 -> { + calculateSpeedBonusForModules(module, this); + relevantInfo = String.valueOf(formatNumbers(module.getSpeedBonus())); + } + case 4 -> { + calculateEnergyDiscountForModules(module, this); + relevantInfo = String.valueOf(formatNumbers(module.getEnergyDiscount())); + } + case 5 -> { + setMiscModuleParameters(module, this); + relevantInfo = String.valueOf(formatNumbers(module.getOverclockTimeFactor())); + } + case 6 -> { + calculateProcessingVoltageForModules(module, this, fuelFactor); + relevantInfo = String.valueOf(MilestoneFormatter.EXPONENT.format((module.getProcessingVoltage()))); + } + default -> { + calculateMaxHeatForModules(module, this, fuelFactor); + relevantInfo = String.valueOf(formattingMode.format(module.getHeat())); + } + } + + infoTexts.set(index, relevantInfo); + } + @Override public MultiblockTooltipBuilder createTooltip() { final MultiblockTooltipBuilder tt = new MultiblockTooltipBuilder(); diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/util/GodforgeMath.java b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/util/GodforgeMath.java index e0f059167ba..f36645f8503 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/util/GodforgeMath.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/util/GodforgeMath.java @@ -49,8 +49,7 @@ public static int calculateMaxFuelFactor(MTEForgeOfGods godforge) { return Math.max(fuelCap, 1); } - public static int calculateEffectiveFuelFactor(MTEForgeOfGods godforge) { - int fuelFactor = godforge.getFuelFactor(); + public static int calculateEffectiveFuelFactor(int fuelFactor) { if (fuelFactor <= 43) { return fuelFactor; } else { @@ -59,6 +58,10 @@ public static int calculateEffectiveFuelFactor(MTEForgeOfGods godforge) { } public static void calculateMaxHeatForModules(MTEBaseModule module, MTEForgeOfGods godforge) { + calculateMaxHeatForModules(module, godforge, godforge.getFuelFactor()); + } + + public static void calculateMaxHeatForModules(MTEBaseModule module, MTEForgeOfGods godforge, int fuelFactor) { double logBase = 1.5; int baseHeat = 12601; if (godforge.isUpgradeActive(SEFCP)) { @@ -68,7 +71,7 @@ public static void calculateMaxHeatForModules(MTEBaseModule module, MTEForgeOfGo logBase = 1.18; } } - int recipeHeat = baseHeat + (int) (Math.log(godforge.getFuelFactor()) / Math.log(logBase) * 1000); + int recipeHeat = baseHeat + (int) (Math.log(fuelFactor) / Math.log(logBase) * 1000); module.setHeatForOC(calculateOverclockHeat(module, godforge, recipeHeat)); module.setHeat(recipeHeat); } @@ -122,6 +125,10 @@ public static void calculateSpeedBonusForModules(MTEBaseModule module, MTEForgeO } public static void calculateMaxParallelForModules(MTEBaseModule module, MTEForgeOfGods godforge) { + calculateMaxParallelForModules(module, godforge, godforge.getFuelFactor()); + } + + public static void calculateMaxParallelForModules(MTEBaseModule module, MTEForgeOfGods godforge, int fuelFactor) { int baseParallel = 0; float fuelFactorMultiplier = 1; float heatMultiplier = 1; @@ -152,7 +159,7 @@ public static void calculateMaxParallelForModules(MTEBaseModule module, MTEForge } if (godforge.isUpgradeActive(SA)) { - fuelFactorMultiplier = 1 + calculateEffectiveFuelFactor(godforge) / 15f; + fuelFactorMultiplier = 1 + calculateEffectiveFuelFactor(fuelFactor) / 15f; if (godforge.isUpgradeActive(TCT)) { if (isMoltenOrSmeltingWithUpgrade) { fuelFactorMultiplier *= 3; @@ -225,10 +232,15 @@ public static void calculateEnergyDiscountForModules(MTEBaseModule module, MTEFo } public static void calculateProcessingVoltageForModules(MTEBaseModule module, MTEForgeOfGods godforge) { + calculateProcessingVoltageForModules(module, godforge, godforge.getFuelFactor()); + } + + public static void calculateProcessingVoltageForModules(MTEBaseModule module, MTEForgeOfGods godforge, + int fuelFactor) { long voltage = 2_000_000_000; if (godforge.isUpgradeActive(GISS)) { - voltage += calculateEffectiveFuelFactor(godforge) * 100_000_000L; + voltage += calculateEffectiveFuelFactor(fuelFactor) * 100_000_000L; } if (godforge.isUpgradeActive(NGMS)) { diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index 34d60bf04ce..e722f542275 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -1058,6 +1058,9 @@ fog.text.tooltip.parallel=Maximum parallel amount fog.text.tooltip.speedbonus=Multiplier for base recipe time, making it shorter fog.text.tooltip.energydiscount=Multiplier for base energy usage, reducing it fog.text.tooltip.ocdivisor=Divisor for recipe time reduction per overclock (does not affect perfect OCs) +fog.text.tooltip.processingvoltage=Base processing voltage for recipes +fog.text.tooltip.factorpreview=Enter fuel factor to simulate calculations with +fog.text.tooltip.applysimulationchanges=Simulate new values achievement.gt.blockmachines.multimachine.em.forge_of_gods=Forge of the Gods @@ -1150,6 +1153,8 @@ gt.blockmachines.multimachine.FOG.effectiveheat=Effective Heat gt.blockmachines.multimachine.FOG.speedbonus=Speed Bonus gt.blockmachines.multimachine.FOG.energydiscount=Energy Discount gt.blockmachines.multimachine.FOG.ocdivisor=OC Divisor +gt.blockmachines.multimachine.FOG.processingvoltage=Processing Voltage +gt.blockmachines.multimachine.FOG.factorpreview=Preview Fuel Factor: gt.blockmachines.multimachine.FOG.clickstat=Click to view value breakdown gt.blockmachines.multimachine.FOG.hint.0=1 - Classic Hatches or Transcendentally Amplified Magnetic Confinement Casing From e31f196c824fec90f30fc224c8414247596f8a23 Mon Sep 17 00:00:00 2001 From: GDCloud Date: Thu, 26 Dec 2024 02:13:15 +0100 Subject: [PATCH 2/4] this was not meant to be here --- .../gregtech/loaders/postload/chains/NaniteChain.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/main/java/gregtech/loaders/postload/chains/NaniteChain.java b/src/main/java/gregtech/loaders/postload/chains/NaniteChain.java index 6290e269c7a..eb51d852809 100644 --- a/src/main/java/gregtech/loaders/postload/chains/NaniteChain.java +++ b/src/main/java/gregtech/loaders/postload/chains/NaniteChain.java @@ -281,14 +281,5 @@ public static void run() { .duration(16 * MINUTES + 40 * SECONDS) .eut(TierEU.RECIPE_MAX) .addTo(nanoForgeRecipes); - - GTValues.RA.stdBuilder() - .itemInputs(MaterialsUEVplus.Eternity.getIngots(1), Materials.Iron.getIngots(1)) - .fluidInputs(Materials.Water.getFluid(1000)) - .itemOutputs(Materials.Iron.getNanite(1)) - .metadata(NANO_FORGE_TIER, 4) - .duration(16 * MINUTES + 40 * SECONDS) - .eut(TierEU.RECIPE_MAX) - .addTo(nanoForgeRecipes); } } From c0a58c33252be816f356fd1186ddcb1180e71b98 Mon Sep 17 00:00:00 2001 From: Maya <10861407+serenibyss@users.noreply.github.com> Date: Wed, 25 Dec 2024 20:11:01 -0600 Subject: [PATCH 3/4] prevent flip + rotate when rings are rendering --- .../multi/godforge/MTEForgeOfGods.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEForgeOfGods.java b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEForgeOfGods.java index 05222da2f97..cc54e671277 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEForgeOfGods.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEForgeOfGods.java @@ -798,6 +798,20 @@ public final void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPla new ChatComponentText("Animations are now " + (isRendererDisabled ? "disabled" : "enabled") + ".")); } + @Override + public boolean isFlipChangeAllowed() { + // If the machine is formed, or if rings are taken into the controller + if (mMachine || isRenderActive) return false; + return super.isFlipChangeAllowed(); + } + + @Override + public boolean isRotationChangeAllowed() { + // If the machine is formed, or if rings are taken into the controller + if (mMachine || isRenderActive) return false; + return super.isRotationChangeAllowed(); + } + @Override public void onBlockDestroyed() { super.onBlockDestroyed(); From fbb3f430e4bd62eb7c312f006947cd48faf9d34a Mon Sep 17 00:00:00 2001 From: GDCloud Date: Tue, 31 Dec 2024 02:09:02 +0100 Subject: [PATCH 4/4] fix autobuild placing first ring after its been absorbed --- .../thing/metaTileEntity/multi/godforge/MTEForgeOfGods.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEForgeOfGods.java b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEForgeOfGods.java index cc54e671277..716e9b44d95 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEForgeOfGods.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEForgeOfGods.java @@ -269,7 +269,7 @@ public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBu survivialBuildPiece(STRUCTURE_PIECE_SHAFT, stackSize, 63, 14, 1, realBudget, env, false, true); - if (stackSize.stackSize > 0) { + if ((stackSize.stackSize > 0 && !isRenderActive)) { built += survivialBuildPiece( STRUCTURE_PIECE_FIRST_RING, stackSize,