添加智能倍增最大限制倍数配置
This commit is contained in:
parent
247081939f
commit
ba775df9b9
|
|
@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G
|
|||
loom.platform = forge
|
||||
|
||||
# Mod properties
|
||||
mod_version = 1.4.0-fix
|
||||
mod_version = 1.4.1.beta
|
||||
maven_group = com.extendedae_plus
|
||||
archives_name = extendedae_plus
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ public class ModConfigScreen extends Screen {
|
|||
private EditBox wirelessMaxRangeBox;
|
||||
private CycleButton<Boolean> crossDimToggle;
|
||||
private CycleButton<Boolean> providerRoundRobinToggle;
|
||||
private EditBox smartScalingMaxMulBox;
|
||||
private CycleButton<Boolean> showEncoderToggle;
|
||||
private CycleButton<Boolean> patternTerminalShowSlotsToggle;
|
||||
|
||||
|
|
@ -58,6 +59,13 @@ public class ModConfigScreen extends Screen {
|
|||
providerRoundRobinToggle = this.addRenderableWidget(createToggle(rightX, y + row * rowHeight, boxWidth, 20, ModConfigs.PROVIDER_ROUND_ROBIN_ENABLE.get()));
|
||||
row++;
|
||||
|
||||
// smartScalingMaxMultiplier: Int 0-1048576 (0 means unlimited)
|
||||
smartScalingMaxMulBox = new EditBox(this.font, rightX, y + row * rowHeight, boxWidth, 20, Component.translatable("config.extendedae_plus.smartScalingMaxMultiplier"));
|
||||
smartScalingMaxMulBox.setValue(String.valueOf(ModConfigs.SMART_SCALING_MAX_MULTIPLIER.get()));
|
||||
smartScalingMaxMulBox.setFilter(s -> s.matches("\\d*") && parseIntOrDefault(s, 0) >= 0 && parseIntOrDefault(s, 1048576) <= 1048576);
|
||||
this.addRenderableWidget(smartScalingMaxMulBox);
|
||||
row++;
|
||||
|
||||
// show encoder pattern player toggle
|
||||
showEncoderToggle = this.addRenderableWidget(createToggle(rightX, y + row * rowHeight, boxWidth, 20, ModConfigs.SHOW_ENCOD_PATTERN_PLAYER.get()));
|
||||
row++;
|
||||
|
|
@ -86,6 +94,7 @@ public class ModConfigScreen extends Screen {
|
|||
double maxRange = clamp(parseDoubleOrDefault(wirelessMaxRangeBox.getValue(), ModConfigs.WIRELESS_MAX_RANGE.get()), 1.0, 4096.0);
|
||||
boolean crossDim = crossDimToggle.getValue();
|
||||
boolean providerRoundRobin = providerRoundRobinToggle.getValue();
|
||||
int smartMaxMul = clamp(parseIntOrDefault(smartScalingMaxMulBox.getValue(), ModConfigs.SMART_SCALING_MAX_MULTIPLIER.get()), 0, 1048576);
|
||||
boolean showEncoder = showEncoderToggle.getValue();
|
||||
boolean patternShowSlots = patternTerminalShowSlotsToggle.getValue();
|
||||
|
||||
|
|
@ -94,6 +103,7 @@ public class ModConfigScreen extends Screen {
|
|||
ModConfigs.WIRELESS_MAX_RANGE.set(maxRange);
|
||||
ModConfigs.WIRELESS_CROSS_DIM_ENABLE.set(crossDim);
|
||||
ModConfigs.PROVIDER_ROUND_ROBIN_ENABLE.set(providerRoundRobin);
|
||||
ModConfigs.SMART_SCALING_MAX_MULTIPLIER.set(smartMaxMul);
|
||||
ModConfigs.SHOW_ENCOD_PATTERN_PLAYER.set(showEncoder);
|
||||
ModConfigs.PATTERN_TERMINAL_SHOW_SLOTS_DEFAULT.set(patternShowSlots);
|
||||
|
||||
|
|
@ -133,8 +143,9 @@ public class ModConfigScreen extends Screen {
|
|||
g.drawString(this.font, Component.translatable("config.extendedae_plus.wirelessMaxRange_with_range"), leftX, y + 1 * 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.showEncoderPatternPlayer"), leftX, y + 4 * rowHeight + 6, labelColor, false);
|
||||
g.drawString(this.font, Component.translatable("config.extendedae_plus.patternTerminalShowSlotsDefault"), leftX, y + 5 * 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.patternTerminalShowSlotsDefault"), leftX, y + 6 * rowHeight + 6, labelColor, false);
|
||||
}
|
||||
|
||||
private static int parseIntOrDefault(String s, int def) {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ public final class ModConfigs {
|
|||
public static final ForgeConfigSpec.BooleanValue SHOW_ENCOD_PATTERN_PLAYER;
|
||||
public static final ForgeConfigSpec.BooleanValue PROVIDER_ROUND_ROBIN_ENABLE;
|
||||
public static final ForgeConfigSpec.BooleanValue PATTERN_TERMINAL_SHOW_SLOTS_DEFAULT;
|
||||
public static final ForgeConfigSpec.IntValue SMART_SCALING_MAX_MULTIPLIER;
|
||||
|
||||
static {
|
||||
ForgeConfigSpec.Builder builder = new ForgeConfigSpec.Builder();
|
||||
|
|
@ -52,6 +53,14 @@ public final class ModConfigs {
|
|||
"默认: true")
|
||||
.define("providerRoundRobinEnable", true);
|
||||
|
||||
// 智能倍增的最大倍数(以单次样板产出为单位)。
|
||||
// 0 表示不限制;>0 表示最大倍增倍数上限,例如 64 表示最多放大到 64 倍。
|
||||
SMART_SCALING_MAX_MULTIPLIER = builder
|
||||
.comment(
|
||||
"智能倍增的最大倍数(0 表示不限制)",
|
||||
"此倍数是针对单次样板产出的放大倍数上限,用于限制一次推送中按倍增缩放的规模")
|
||||
.defineInRange("smartScalingMaxMultiplier", 0, 0, 1048576);
|
||||
|
||||
// 模式访问终端(ExtendedAE 图样终端)默认是否显示槽位渲染(SlotsRow)。
|
||||
// true: 默认显示(可通过界面按钮临时隐藏);false: 默认隐藏(可通过按钮显示)
|
||||
PATTERN_TERMINAL_SHOW_SLOTS_DEFAULT = builder
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import appeng.api.stacks.GenericStack;
|
|||
import appeng.crafting.pattern.AEProcessingPattern;
|
||||
import com.extendedae_plus.content.ScaledProcessingPattern;
|
||||
import com.extendedae_plus.api.SmartDoublingAwarePattern;
|
||||
import com.extendedae_plus.config.ModConfigs;
|
||||
|
||||
|
||||
import static com.extendedae_plus.util.ExtendedAELogger.LOGGER;
|
||||
|
|
@ -60,6 +61,15 @@ public final class PatternScaler {
|
|||
long needed = requestedAmount / perOperationTarget + ((requestedAmount % perOperationTarget) == 0 ? 0 : 1);
|
||||
multiplier = needed <= 1L ? 1L : needed;
|
||||
}
|
||||
// 应用配置的最大倍数上限(0 表示不限制)
|
||||
try {
|
||||
int maxMul = ModConfigs.SMART_SCALING_MAX_MULTIPLIER.get();
|
||||
if (maxMul > 0 && multiplier > maxMul) {
|
||||
multiplier = maxMul;
|
||||
}
|
||||
} catch (Throwable ignore) {
|
||||
// 配置读取异常时不施加上限
|
||||
}
|
||||
|
||||
// 构建压缩输入(将每个输入的 multiplier 翻倍,保留每个模板的原始数量)
|
||||
IInput[] scaledInputs = new IInput[baseInputs.length];
|
||||
|
|
|
|||
|
|
@ -34,5 +34,7 @@
|
|||
"config.extendedae_plus.wirelessCrossDimEnable": "Allow Wireless Cross-Dimension",
|
||||
"config.extendedae_plus.providerRoundRobinEnable": "Enable Provider Round-Robin (Smart Doubling)",
|
||||
"config.extendedae_plus.state_on": "On",
|
||||
"config.extendedae_plus.state_off": "Off"
|
||||
"config.extendedae_plus.state_off": "Off",
|
||||
"config.extendedae_plus.smartScalingMaxMultiplier": "Smart Scaling Max Multiplier",
|
||||
"config.extendedae_plus.smartScalingMaxMultiplier_with_range": "Smart Scaling Max Multiplier (0 = Unlimited)"
|
||||
}
|
||||
|
|
@ -56,5 +56,7 @@
|
|||
"gui.extendedae_plus.global.toggle_adv_blocking": "切换高级阻挡",
|
||||
"gui.extendedae_plus.global.toggle_smart_doubling": "切换智能翻倍",
|
||||
"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_with_range": "智能倍增最大倍数 (0为不限制)"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user