增加默认显示/隐藏管理终端样板槽位的配置
This commit is contained in:
parent
ae832db7d3
commit
5e88420108
|
|
@ -18,6 +18,7 @@ public class ModConfigScreen extends Screen {
|
|||
private CycleButton<Boolean> crossDimToggle;
|
||||
private CycleButton<Boolean> providerRoundRobinToggle;
|
||||
private CycleButton<Boolean> showEncoderToggle;
|
||||
private CycleButton<Boolean> patternTerminalShowSlotsToggle;
|
||||
|
||||
public ModConfigScreen(Screen parent) {
|
||||
super(Component.translatable("screen.extendedae_plus.title"));
|
||||
|
|
@ -61,6 +62,10 @@ public class ModConfigScreen extends Screen {
|
|||
showEncoderToggle = this.addRenderableWidget(createToggle(rightX, y + row * rowHeight, boxWidth, 20, ModConfigs.SHOW_ENCOD_PATTERN_PLAYER.get()));
|
||||
row++;
|
||||
|
||||
// pattern terminal show slots default toggle
|
||||
patternTerminalShowSlotsToggle = this.addRenderableWidget(createToggle(rightX, y + row * rowHeight, boxWidth, 20, ModConfigs.PATTERN_TERMINAL_SHOW_SLOTS_DEFAULT.get()));
|
||||
row++;
|
||||
|
||||
// 按钮:保存、返回
|
||||
int btnW = 100;
|
||||
int gap = 8;
|
||||
|
|
@ -82,6 +87,7 @@ public class ModConfigScreen extends Screen {
|
|||
boolean crossDim = crossDimToggle.getValue();
|
||||
boolean providerRoundRobin = providerRoundRobinToggle.getValue();
|
||||
boolean showEncoder = showEncoderToggle.getValue();
|
||||
boolean patternShowSlots = patternTerminalShowSlotsToggle.getValue();
|
||||
|
||||
// 应用到 Forge 配置值
|
||||
ModConfigs.PAGE_MULTIPLIER.set(pageMul);
|
||||
|
|
@ -89,6 +95,7 @@ public class ModConfigScreen extends Screen {
|
|||
ModConfigs.WIRELESS_CROSS_DIM_ENABLE.set(crossDim);
|
||||
ModConfigs.PROVIDER_ROUND_ROBIN_ENABLE.set(providerRoundRobin);
|
||||
ModConfigs.SHOW_ENCOD_PATTERN_PLAYER.set(showEncoder);
|
||||
ModConfigs.PATTERN_TERMINAL_SHOW_SLOTS_DEFAULT.set(patternShowSlots);
|
||||
|
||||
// Forge 会在合适的时机写回到配置文件;部分改动可能需要重启游戏或世界才完全生效
|
||||
onClose();
|
||||
|
|
@ -127,6 +134,7 @@ 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.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);
|
||||
}
|
||||
|
||||
private static int parseIntOrDefault(String s, int def) {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ public final class ModConfigs {
|
|||
public static final ForgeConfigSpec.BooleanValue WIRELESS_CROSS_DIM_ENABLE;
|
||||
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;
|
||||
|
||||
static {
|
||||
ForgeConfigSpec.Builder builder = new ForgeConfigSpec.Builder();
|
||||
|
|
@ -50,6 +51,15 @@ public final class ModConfigs {
|
|||
"注意:所有相关供应器需开启智能倍增,否则可能失效",
|
||||
"默认: true")
|
||||
.define("providerRoundRobinEnable", true);
|
||||
|
||||
// 模式访问终端(ExtendedAE 图样终端)默认是否显示槽位渲染(SlotsRow)。
|
||||
// true: 默认显示(可通过界面按钮临时隐藏);false: 默认隐藏(可通过按钮显示)
|
||||
PATTERN_TERMINAL_SHOW_SLOTS_DEFAULT = builder
|
||||
.comment(
|
||||
"样板终端默认是否显示槽位",
|
||||
"影响进入界面时SlotsRow的默认可见性,仅影响客户端显示"
|
||||
)
|
||||
.define("patternTerminalShowSlotsDefault", true);
|
||||
builder.pop();
|
||||
COMMON_SPEC = builder.build();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import appeng.client.gui.style.ScreenStyle;
|
|||
import appeng.client.gui.widgets.AETextField;
|
||||
import appeng.client.gui.widgets.IconButton;
|
||||
import appeng.menu.AEBaseMenu;
|
||||
import com.extendedae_plus.config.ModConfigs;
|
||||
import com.extendedae_plus.mixin.extendedae.accessor.GuiExPatternTerminalAccessor;
|
||||
import com.extendedae_plus.network.ModNetwork;
|
||||
import com.extendedae_plus.network.OpenProviderUiC2SPacket;
|
||||
|
|
@ -55,7 +56,7 @@ public abstract class GuiExPatternTerminalMixin extends AEBaseScreen<AEBaseMenu>
|
|||
@Unique
|
||||
private IconButton eap$toggleSlotsButton;
|
||||
@Unique
|
||||
private boolean eap$showSlots = false; // 默认显示槽位
|
||||
private boolean eap$showSlots = false; // 默认由配置初始化
|
||||
@Unique
|
||||
private long eap$currentlyChoicePatterProvider = -1; // 当前选择的样板供应器ID
|
||||
@Unique
|
||||
|
|
@ -291,6 +292,11 @@ public abstract class GuiExPatternTerminalMixin extends AEBaseScreen<AEBaseMenu>
|
|||
|
||||
@Inject(method = "<init>", at = @At("TAIL"), remap = false)
|
||||
private void injectConstructor(CallbackInfo ci) {
|
||||
// 根据配置初始化默认显示/隐藏状态
|
||||
try {
|
||||
this.eap$showSlots = ModConfigs.PATTERN_TERMINAL_SHOW_SLOTS_DEFAULT.get();
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
// 创建切换槽位显示的按钮
|
||||
this.eap$toggleSlotsButton = new IconButton((b) -> {
|
||||
this.eap$showSlots = !this.eap$showSlots; // 开关状态
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@
|
|||
"config.extendedae_plus.state_on": "开",
|
||||
"config.extendedae_plus.state_off": "关",
|
||||
"config.extendedae_plus.showEncoderPatternPlayer": "显示样板编码玩家",
|
||||
"config.extendedae_plus.patternTerminalShowSlotsDefault": "样板终端默认显示槽位",
|
||||
"block.extendedae_plus.network_pattern_controller": "样板供应器状态控制器",
|
||||
"item.extendedae_plus.network_pattern_controller": "样板供应器状态控制器",
|
||||
"gui.extendedae_plus.global.toggle_blocking": "切换阻挡模式",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user