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

Godforge Rehab #3712

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
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 @@ -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,
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -2474,6 +2488,9 @@ private void openCustomStarColorWindowFresh(Widget widget, @Nullable ForgeOfGods
}
}

private int previewFactor = 0;
private final List<String> infoTexts = Arrays.asList(new String[28]);

protected ModularWindow createStatisticsWindow(final EntityPlayer player) {
final int WIDTH = 300;
final int HEIGHT = 300;
Expand Down Expand Up @@ -2537,6 +2554,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)
Expand Down Expand Up @@ -2566,12 +2591,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)
Expand All @@ -2590,60 +2615,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))
Expand All @@ -2657,18 +2641,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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)) {
Expand All @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)) {
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/assets/tectech/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,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
Expand Down Expand Up @@ -1164,6 +1167,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
Expand Down
Loading