This commit is contained in:
GaLi 2026-05-25 11:59:33 +08:00
parent 5c1f44c4ac
commit ebbc0f2464
6 changed files with 60 additions and 12 deletions

View File

@ -1,5 +1,11 @@
# Changelog # Changelog
## [1.5.4.1]
### Added / 新增
- 样板终端按钮显示新增开关控制按钮
- Added a toggle button to control Pattern Terminal button visibility.
## [1.5.4] ## [1.5.4]
### Added / 新增 ### Added / 新增

View File

@ -48,8 +48,10 @@ public class ProviderSelectScreen extends Screen {
private static final Set<String> pinnedProviders = new HashSet<>(); private static final Set<String> pinnedProviders = new HashSet<>();
private static final String PINNED_CONFIG_PATH = "extendedae_plus/pinned_providers.json"; private static final String PINNED_CONFIG_PATH = "extendedae_plus/pinned_providers.json";
private static final String AUTO_UPLOAD_UNIQUE_MATCH_KEY = "auto_upload_unique_match"; private static final String AUTO_UPLOAD_UNIQUE_MATCH_KEY = "auto_upload_unique_match";
private static final String SHOW_PROCESSING_BUTTONS_KEY = "show_processing_buttons";
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create(); private static final Gson GSON = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create();
private static boolean autoUploadUniqueMatchEnabled = true; private static boolean autoUploadUniqueMatchEnabled = true;
private static boolean showProcessingButtonsEnabled = true;
// 静态初始化块加载置顶配置 // 静态初始化块加载置顶配置
static { static {
@ -64,6 +66,7 @@ public class ProviderSelectScreen extends Screen {
private EditBox searchBox; private EditBox searchBox;
// 中文名输入框用于添加映射 // 中文名输入框用于添加映射
private EditBox cnInput; private EditBox cnInput;
private Button processingButtonsToggleButton;
private Button autoUploadToggleButton; private Button autoUploadToggleButton;
private String query = ""; private String query = "";
// 翻页按钮 // 翻页按钮
@ -171,8 +174,16 @@ public class ProviderSelectScreen extends Screen {
int totalWidth = btnWidth2 + btnGap + inputWidth + btnGap + btnWidth2 * 2 + btnGap + btnWidth2; int totalWidth = btnWidth2 + btnGap + inputWidth + btnGap + btnWidth2 * 2 + btnGap + btnWidth2;
int startX = centerX - totalWidth / 2; int startX = centerX - totalWidth / 2;
int toggleX = startX + btnWidth2 + btnGap + inputWidth + btnGap + btnWidth2 + btnGap;
int toggleY = navY + 30;
this.processingButtonsToggleButton = Button.builder(buildProcessingButtonsToggleLabel(), b -> toggleProcessingButtons())
.bounds(toggleX, toggleY, btnWidth2, 20)
.build();
this.addRenderableWidget(this.processingButtonsToggleButton);
this.autoUploadToggleButton = Button.builder(buildAutoUploadToggleLabel(), b -> toggleAutoUploadUniqueMatch()) this.autoUploadToggleButton = Button.builder(buildAutoUploadToggleLabel(), b -> toggleAutoUploadUniqueMatch())
.bounds(startX + btnWidth2 + btnGap + inputWidth + btnGap + btnWidth2 + btnGap, navY + 30, btnWidth2 * 2 + btnGap, 20) .bounds(toggleX + btnWidth2 + btnGap, toggleY, btnWidth2, 20)
.build(); .build();
this.addRenderableWidget(this.autoUploadToggleButton); this.addRenderableWidget(this.autoUploadToggleButton);
@ -260,6 +271,26 @@ public class ProviderSelectScreen extends Screen {
Component.translatable(stateKey)); Component.translatable(stateKey));
} }
private Component buildProcessingButtonsToggleLabel() {
String stateKey = showProcessingButtonsEnabled
? "config.extendedae_plus.option.state_on"
: "config.extendedae_plus.option.state_off";
return Component.translatable("extendedae_plus.screen.show_processing_buttons",
Component.translatable(stateKey));
}
public static boolean isProcessingButtonsEnabled() {
return showProcessingButtonsEnabled;
}
private void toggleProcessingButtons() {
showProcessingButtonsEnabled = !showProcessingButtonsEnabled;
savePinnedProviders();
if (this.processingButtonsToggleButton != null) {
this.processingButtonsToggleButton.setMessage(buildProcessingButtonsToggleLabel());
}
}
private void toggleAutoUploadUniqueMatch() { private void toggleAutoUploadUniqueMatch() {
autoUploadUniqueMatchEnabled = !autoUploadUniqueMatchEnabled; autoUploadUniqueMatchEnabled = !autoUploadUniqueMatchEnabled;
savePinnedProviders(); savePinnedProviders();
@ -665,6 +696,11 @@ public class ProviderSelectScreen extends Screen {
if (autoUploadElement != null && autoUploadElement.isJsonPrimitive()) { if (autoUploadElement != null && autoUploadElement.isJsonPrimitive()) {
autoUploadUniqueMatchEnabled = autoUploadElement.getAsBoolean(); autoUploadUniqueMatchEnabled = autoUploadElement.getAsBoolean();
} }
JsonElement showProcessingButtonsElement = obj.get(SHOW_PROCESSING_BUTTONS_KEY);
if (showProcessingButtonsElement != null && showProcessingButtonsElement.isJsonPrimitive()) {
showProcessingButtonsEnabled = showProcessingButtonsElement.getAsBoolean();
}
} catch (IOException | JsonSyntaxException e) { } catch (IOException | JsonSyntaxException e) {
// 加载失败时静默处理 // 加载失败时静默处理
} }
@ -685,6 +721,7 @@ public class ProviderSelectScreen extends Screen {
} }
obj.add("pinned", arr); obj.add("pinned", arr);
obj.addProperty(AUTO_UPLOAD_UNIQUE_MATCH_KEY, autoUploadUniqueMatchEnabled); obj.addProperty(AUTO_UPLOAD_UNIQUE_MATCH_KEY, autoUploadUniqueMatchEnabled);
obj.addProperty(SHOW_PROCESSING_BUTTONS_KEY, showProcessingButtonsEnabled);
Files.writeString(cfgPath, GSON.toJson(obj)); Files.writeString(cfgPath, GSON.toJson(obj));
} catch (IOException e) { } catch (IOException e) {

View File

@ -6,6 +6,7 @@ import appeng.client.gui.me.items.PatternEncodingTermScreen;
import appeng.client.gui.me.items.ProcessingEncodingPanel; import appeng.client.gui.me.items.ProcessingEncodingPanel;
import appeng.client.gui.widgets.ActionButton; import appeng.client.gui.widgets.ActionButton;
import com.extendedae_plus.ExtendedAEPlus; import com.extendedae_plus.ExtendedAEPlus;
import com.extendedae_plus.client.screen.ProviderSelectScreen;
import com.extendedae_plus.client.gui.widgets.ScaledTextureButton; import com.extendedae_plus.client.gui.widgets.ScaledTextureButton;
import com.extendedae_plus.init.ModNetwork; import com.extendedae_plus.init.ModNetwork;
import com.extendedae_plus.mixin.minecraft.accessor.AbstractContainerScreenAccessor; import com.extendedae_plus.mixin.minecraft.accessor.AbstractContainerScreenAccessor;
@ -126,7 +127,8 @@ public abstract class ProcessingEncodingPanelMixin extends EncodingModePanel {
@Inject(method = "setVisible", at = @At("TAIL"), remap = false) @Inject(method = "setVisible", at = @At("TAIL"), remap = false)
private void eap$updateInjectedButtons(boolean visible, CallbackInfo ci) { private void eap$updateInjectedButtons(boolean visible, CallbackInfo ci) {
this.cycleOutputBtn.setVisibility(false); boolean showInjectedButtons = visible && ProviderSelectScreen.isProcessingButtonsEnabled();
this.cycleOutputBtn.setVisibility(visible && !showInjectedButtons);
if (this.eap$mul2Button == null) { if (this.eap$mul2Button == null) {
return; return;
@ -141,16 +143,16 @@ public abstract class ProcessingEncodingPanelMixin extends EncodingModePanel {
eap$ensureAdded(this.eap$swapOutputsButton); eap$ensureAdded(this.eap$swapOutputsButton);
eap$ensureAdded(this.eap$restoreRatioButton); eap$ensureAdded(this.eap$restoreRatioButton);
this.eap$mul2Button.setVisibility(visible); this.eap$mul2Button.setVisibility(showInjectedButtons);
this.eap$mul3Button.setVisibility(visible); this.eap$mul3Button.setVisibility(showInjectedButtons);
this.eap$mul5Button.setVisibility(visible); this.eap$mul5Button.setVisibility(showInjectedButtons);
this.eap$div2Button.setVisibility(visible); this.eap$div2Button.setVisibility(showInjectedButtons);
this.eap$div3Button.setVisibility(visible); this.eap$div3Button.setVisibility(showInjectedButtons);
this.eap$div5Button.setVisibility(visible); this.eap$div5Button.setVisibility(showInjectedButtons);
this.eap$swapOutputsButton.setVisibility(visible); this.eap$swapOutputsButton.setVisibility(showInjectedButtons);
this.eap$restoreRatioButton.setVisibility(visible); this.eap$restoreRatioButton.setVisibility(showInjectedButtons);
if (!visible) { if (!showInjectedButtons) {
return; return;
} }

View File

@ -124,6 +124,7 @@
"extendedae_plus.screen.reload_mapping_fail": "Overloading mapping failed: %s", "extendedae_plus.screen.reload_mapping_fail": "Overloading mapping failed: %s",
"extendedae_plus.screen.add_mapping": "Add Mapping", "extendedae_plus.screen.add_mapping": "Add Mapping",
"extendedae_plus.screen.delete_mapping": "Delete Mapping", "extendedae_plus.screen.delete_mapping": "Delete Mapping",
"extendedae_plus.screen.show_processing_buttons": "Pattern Terminal Button Display: %s",
"extendedae_plus.screen.auto_upload_unique_match": "Auto Upload on Unique Match: %s", "extendedae_plus.screen.auto_upload_unique_match": "Auto Upload on Unique Match: %s",
"extendedae_plus.screen.upload.enter_search_key": "Please enter a search keyword before adding a mapping", "extendedae_plus.screen.upload.enter_search_key": "Please enter a search keyword before adding a mapping",
"extendedae_plus.screen.upload.enter_name": "Please enter a name", "extendedae_plus.screen.upload.enter_name": "Please enter a name",

View File

@ -123,6 +123,7 @@
"extendedae_plus.screen.reload_mapping_fail": "重载映射失败: %s", "extendedae_plus.screen.reload_mapping_fail": "重载映射失败: %s",
"extendedae_plus.screen.add_mapping": "增加映射", "extendedae_plus.screen.add_mapping": "增加映射",
"extendedae_plus.screen.delete_mapping": "删除映射", "extendedae_plus.screen.delete_mapping": "删除映射",
"extendedae_plus.screen.show_processing_buttons": "样板终端按钮显示: %s",
"extendedae_plus.screen.auto_upload_unique_match": "唯一匹配时自动上传: %s", "extendedae_plus.screen.auto_upload_unique_match": "唯一匹配时自动上传: %s",
"extendedae_plus.screen.upload.enter_search_key": "请输入搜索关键字后再添加映射", "extendedae_plus.screen.upload.enter_search_key": "请输入搜索关键字后再添加映射",
"extendedae_plus.screen.upload.enter_name": "请输入名称", "extendedae_plus.screen.upload.enter_name": "请输入名称",

View File

@ -122,6 +122,7 @@
"extendedae_plus.screen.reload_mapping_fail": "重新載入對映失敗: %s", "extendedae_plus.screen.reload_mapping_fail": "重新載入對映失敗: %s",
"extendedae_plus.screen.add_mapping": "增加對映", "extendedae_plus.screen.add_mapping": "增加對映",
"extendedae_plus.screen.delete_mapping": "刪除對映", "extendedae_plus.screen.delete_mapping": "刪除對映",
"extendedae_plus.screen.show_processing_buttons": "樣板終端按鈕顯示: %s",
"extendedae_plus.screen.auto_upload_unique_match": "唯一匹配時自動上傳: %s", "extendedae_plus.screen.auto_upload_unique_match": "唯一匹配時自動上傳: %s",
"extendedae_plus.screen.upload.enter_search_key": "請輸入搜尋關鍵字後再新增對映", "extendedae_plus.screen.upload.enter_search_key": "請輸入搜尋關鍵字後再新增對映",
"extendedae_plus.screen.upload.enter_name": "請輸入名稱", "extendedae_plus.screen.upload.enter_name": "請輸入名稱",