feat: 添加智能倍增最小收益因子配置项

This commit is contained in:
C-H716 2025-09-04 03:10:30 +08:00
parent b717d33f8f
commit 46cbb107df
3 changed files with 16 additions and 3 deletions

View File

@ -18,6 +18,7 @@ public class ModConfigScreen extends Screen {
private CycleButton<Boolean> crossDimToggle; private CycleButton<Boolean> crossDimToggle;
private CycleButton<Boolean> providerRoundRobinToggle; private CycleButton<Boolean> providerRoundRobinToggle;
private EditBox smartScalingMaxMulBox; private EditBox smartScalingMaxMulBox;
private EditBox smartScalingMinBenefitBox;
private CycleButton<Boolean> showEncoderToggle; private CycleButton<Boolean> showEncoderToggle;
private CycleButton<Boolean> patternTerminalShowSlotsToggle; private CycleButton<Boolean> patternTerminalShowSlotsToggle;
@ -66,6 +67,13 @@ public class ModConfigScreen extends Screen {
this.addRenderableWidget(smartScalingMaxMulBox); this.addRenderableWidget(smartScalingMaxMulBox);
row++; row++;
// smartScalingMinBenefitFactor: Int 1-1024
smartScalingMinBenefitBox = new EditBox(this.font, rightX, y + row * rowHeight, boxWidth, 20, Component.translatable("config.extendedae_plus.smartScalingMinBenefitFactor"));
smartScalingMinBenefitBox.setValue(String.valueOf(ModConfigs.SMART_SCALING_MIN_BENEFIT_FACTOR.get()));
smartScalingMinBenefitBox.setFilter(s -> s.matches("\\d*") && parseIntOrDefault(s, 1) >= 1 && parseIntOrDefault(s, 1024) <= 1024);
this.addRenderableWidget(smartScalingMinBenefitBox);
row++;
// show encoder pattern player toggle // show encoder pattern player toggle
showEncoderToggle = this.addRenderableWidget(createToggle(rightX, y + row * rowHeight, boxWidth, 20, ModConfigs.SHOW_ENCOD_PATTERN_PLAYER.get())); showEncoderToggle = this.addRenderableWidget(createToggle(rightX, y + row * rowHeight, boxWidth, 20, ModConfigs.SHOW_ENCOD_PATTERN_PLAYER.get()));
row++; row++;
@ -95,6 +103,7 @@ public class ModConfigScreen extends Screen {
boolean crossDim = crossDimToggle.getValue(); boolean crossDim = crossDimToggle.getValue();
boolean providerRoundRobin = providerRoundRobinToggle.getValue(); boolean providerRoundRobin = providerRoundRobinToggle.getValue();
int smartMaxMul = clamp(parseIntOrDefault(smartScalingMaxMulBox.getValue(), ModConfigs.SMART_SCALING_MAX_MULTIPLIER.get()), 0, 1048576); int smartMaxMul = clamp(parseIntOrDefault(smartScalingMaxMulBox.getValue(), ModConfigs.SMART_SCALING_MAX_MULTIPLIER.get()), 0, 1048576);
int smartMinBenefit = clamp(parseIntOrDefault(smartScalingMinBenefitBox.getValue(), ModConfigs.SMART_SCALING_MIN_BENEFIT_FACTOR.get()), 1, 1024);
boolean showEncoder = showEncoderToggle.getValue(); boolean showEncoder = showEncoderToggle.getValue();
boolean patternShowSlots = patternTerminalShowSlotsToggle.getValue(); boolean patternShowSlots = patternTerminalShowSlotsToggle.getValue();
@ -104,6 +113,7 @@ public class ModConfigScreen extends Screen {
ModConfigs.WIRELESS_CROSS_DIM_ENABLE.set(crossDim); ModConfigs.WIRELESS_CROSS_DIM_ENABLE.set(crossDim);
ModConfigs.PROVIDER_ROUND_ROBIN_ENABLE.set(providerRoundRobin); ModConfigs.PROVIDER_ROUND_ROBIN_ENABLE.set(providerRoundRobin);
ModConfigs.SMART_SCALING_MAX_MULTIPLIER.set(smartMaxMul); ModConfigs.SMART_SCALING_MAX_MULTIPLIER.set(smartMaxMul);
ModConfigs.SMART_SCALING_MIN_BENEFIT_FACTOR.set(smartMinBenefit);
ModConfigs.SHOW_ENCOD_PATTERN_PLAYER.set(showEncoder); ModConfigs.SHOW_ENCOD_PATTERN_PLAYER.set(showEncoder);
ModConfigs.PATTERN_TERMINAL_SHOW_SLOTS_DEFAULT.set(patternShowSlots); ModConfigs.PATTERN_TERMINAL_SHOW_SLOTS_DEFAULT.set(patternShowSlots);
@ -144,8 +154,9 @@ public class ModConfigScreen extends Screen {
g.drawString(this.font, Component.translatable("config.extendedae_plus.wirelessCrossDimEnable"), leftX, y + 2 * rowHeight + 6, labelColor, false); g.drawString(this.font, Component.translatable("config.extendedae_plus.wirelessCrossDimEnable"), leftX, y + 2 * rowHeight + 6, labelColor, false);
g.drawString(this.font, Component.translatable("config.extendedae_plus.providerRoundRobinEnable"), leftX, y + 3 * rowHeight + 6, labelColor, false); g.drawString(this.font, Component.translatable("config.extendedae_plus.providerRoundRobinEnable"), leftX, y + 3 * rowHeight + 6, labelColor, false);
g.drawString(this.font, Component.translatable("config.extendedae_plus.smartScalingMaxMultiplier_with_range"), leftX, y + 4 * rowHeight + 6, labelColor, false); g.drawString(this.font, Component.translatable("config.extendedae_plus.smartScalingMaxMultiplier_with_range"), leftX, y + 4 * rowHeight + 6, labelColor, false);
g.drawString(this.font, Component.translatable("config.extendedae_plus.showEncoderPatternPlayer"), leftX, y + 5 * rowHeight + 6, labelColor, false); g.drawString(this.font, Component.translatable("config.extendedae_plus.smartScalingMinBenefitFactor"), leftX, y + 5 * rowHeight + 6, labelColor, false);
g.drawString(this.font, Component.translatable("config.extendedae_plus.patternTerminalShowSlotsDefault"), leftX, y + 6 * rowHeight + 6, labelColor, false); g.drawString(this.font, Component.translatable("config.extendedae_plus.showEncoderPatternPlayer"), leftX, y + 6 * rowHeight + 6, labelColor, false);
g.drawString(this.font, Component.translatable("config.extendedae_plus.patternTerminalShowSlotsDefault"), leftX, y + 7 * rowHeight + 6, labelColor, false);
} }
private static int parseIntOrDefault(String s, int def) { private static int parseIntOrDefault(String s, int def) {

View File

@ -37,4 +37,5 @@
"config.extendedae_plus.state_off": "Off", "config.extendedae_plus.state_off": "Off",
"config.extendedae_plus.smartScalingMaxMultiplier": "Smart Scaling Max Multiplier", "config.extendedae_plus.smartScalingMaxMultiplier": "Smart Scaling Max Multiplier",
"config.extendedae_plus.smartScalingMaxMultiplier_with_range": "Smart Scaling Max Multiplier (0 = Unlimited)" "config.extendedae_plus.smartScalingMaxMultiplier_with_range": "Smart Scaling Max Multiplier (0 = Unlimited)"
,"config.extendedae_plus.smartScalingMinBenefitFactor": "Smart Scaling Min Benefit Factor (default 4)"
} }

View File

@ -58,5 +58,6 @@
"gui.extendedae_plus.global.all_on": "全部开启", "gui.extendedae_plus.global.all_on": "全部开启",
"gui.extendedae_plus.global.all_off": "全部关闭", "gui.extendedae_plus.global.all_off": "全部关闭",
"config.extendedae_plus.smartScalingMaxMultiplier": "智能倍增最大倍数", "config.extendedae_plus.smartScalingMaxMultiplier": "智能倍增最大倍数",
"config.extendedae_plus.smartScalingMaxMultiplier_with_range": "智能倍增最大倍数 (0为不限制)" "config.extendedae_plus.smartScalingMaxMultiplier_with_range": "智能倍增最大倍数 (0为不限制)",
"config.extendedae_plus.smartScalingMinBenefitFactor": "智能倍增最小收益因子 (默认 4)"
} }