Skip to content

Commit

Permalink
Merge pull request #748 from Taskeren/chore-9in1
Browse files Browse the repository at this point in the history
Add config opts for ManufacturingCenter and adjusted the Eu Reduction
  • Loading branch information
Nxer authored Jan 23, 2025
2 parents 9494aee + 8e75bd4 commit f81392f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;

import org.intellij.lang.annotations.MagicConstant;
import org.jetbrains.annotations.NotNull;

import com.Nxer.TwistSpaceTechnology.common.block.blockClass.Casings.multiuse.BlockMultiUseCore;
import com.Nxer.TwistSpaceTechnology.config.Config;
import com.Nxer.TwistSpaceTechnology.util.TextEnums;
import com.Nxer.TwistSpaceTechnology.util.TextWithColor;
import com.google.common.collect.BiMap;
Expand Down Expand Up @@ -56,15 +58,15 @@
public class TST_ManufacturingCenter extends GTPPMultiBlockBase<TST_ManufacturingCenter>
implements ISurvivalConstructable {

private static final int LOWEST_CORE_TIER = 5;
@MagicConstant(valuesFromClass = VoltageIndex.class)
private static final int LOWEST_CORE_TIER = VoltageIndex.IV;

private static final double SPEED_BONUS_BASE = 0.2F;
private static final double SPEED_BONUS_FOR_CORE_TIER = 0.5F;
private static final double SPEED_BONUS_BASE = Config.ManufacturingCenter_SpeedBonus_Base;
private static final double SPEED_BONUS_FOR_CORE_TIER = Config.ManufacturingCenter_SpeedBonus_Tier;

// for core tier at ZPM and UV
private static final double EU_REDUCTION_FOR_CORE_TIER = 0.2F;
private static final double EU_REDUCTION_FOR_CORE_TIER = Config.ManufacturingCenter_PowerReduction;

private static final int MAX_PARALLEL_MODIFIER = 2;
private static final int MAX_PARALLEL_MODIFIER = Config.ManufacturingCenter_MaxParallelModifier;

public int coreTier = -1;
public int casingCount = 0;
Expand Down Expand Up @@ -181,7 +183,7 @@ private double getSpeedBonusAtCurrentCore() {
}

private double getEuModifierAtCurrentCore() {
return 1.0 - (EU_REDUCTION_FOR_CORE_TIER * Math.max(0, coreTier - LOWEST_CORE_TIER - 2));
return 1.0 - (EU_REDUCTION_FOR_CORE_TIER * Math.max(0, coreTier - LOWEST_CORE_TIER));
}

// endregion
Expand Down Expand Up @@ -265,15 +267,15 @@ protected MultiblockTooltipBuilder createTooltip() {
.addInfo(
TextEnums.tr(
"ManufacturingCenter_Tooltips_5",
TextWithColor.getTierName(VoltageIndex.IV),
TextWithColor.getTierName(LOWEST_CORE_TIER),
TextWithColor.percentage(SPEED_BONUS_FOR_CORE_TIER * 100)))
// #tr ManufacturingCenter_Tooltips_6
// # Each Core Tier over %s gains §b%s§7 EU/t Reduction.
// #zh_CN 每级超过%s的核心等级获得§b%s§7的能量减免。
.addInfo(
TextEnums.tr(
"ManufacturingCenter_Tooltips_6",
TextWithColor.getTierName(VoltageIndex.LuV),
TextWithColor.getTierName(LOWEST_CORE_TIER),
TextWithColor.percentage(EU_REDUCTION_FOR_CORE_TIER * 100)))
// #tr ManufacturingCenter_Tooltips_7
// # Max parallel is §b%s§7 max voltage tier.
Expand Down
16 changes: 15 additions & 1 deletion src/main/java/com/Nxer/TwistSpaceTechnology/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public class Config {
public static boolean Enable_BallLightning = true;
public static int WirelessModeExtraEuCost_BallLightning = 64;
public static int WirelessModeTickEveryProcess_BallLightning = 64;
// end region
// endregion

// region StarcoreMiner
public static boolean Enable_StarcoreMiner = true;
Expand Down Expand Up @@ -453,6 +453,13 @@ public class Config {
public static boolean Enable_IndustrialAlchemyTower = true;
// endregion

// region ManufacturingCenter
public static float ManufacturingCenter_SpeedBonus_Base = 0.2F;
public static float ManufacturingCenter_SpeedBonus_Tier = 0.5F;
public static float ManufacturingCenter_PowerReduction = 0.15F;
public static int ManufacturingCenter_MaxParallelModifier = 2;
// endregion

public static void synchronizeConfiguration(File configFile) {
Configuration configuration = new Configuration(configFile);

Expand Down Expand Up @@ -795,6 +802,13 @@ public static void synchronizeConfiguration(File configFile) {
Enable_IndustrialAlchemyTower = configuration.getBoolean("Enable Industrial Alchemy Tower",IndustrialAlchemyTower,Enable_IndustrialAlchemyTower,"Enable Industrial Alchemy Tower");
// endregion

// region ManufacturingCenter
ManufacturingCenter_SpeedBonus_Base = configuration.getFloat("Speed Bonus Base", "ManufacturingCenter", ManufacturingCenter_SpeedBonus_Base, 0.0F, Float.MAX_VALUE, "The Base Speed Bonus");
ManufacturingCenter_SpeedBonus_Tier = configuration.getFloat("Speed Bonus Tier", "ManufacturingCenter", ManufacturingCenter_SpeedBonus_Tier, 0.0F, Float.MAX_VALUE, "The Speed Bonus for each tier over the lowest tier (not included)");
ManufacturingCenter_PowerReduction = configuration.getFloat("Power Reduction", "ManufacturingCenter", ManufacturingCenter_PowerReduction, 0.0F, Float.MAX_VALUE, "The Power Reduction for each tier over the lowest tier (not included)");
ManufacturingCenter_MaxParallelModifier = configuration.getInt("Max Parallel Modifier", "ManufacturingCenter", ManufacturingCenter_MaxParallelModifier, 1, Integer.MAX_VALUE, "The maximum parallel modifier");
// endregion

TST_CleanRoom.loadConfig(configuration);
if (configuration.hasChanged()) {
configuration.save();
Expand Down

0 comments on commit f81392f

Please sign in to comment.