修复jei回来后,样板供应器的倍增按钮消失问题

This commit is contained in:
GaLi 2025-08-22 22:58:02 +08:00
parent 94e069a2b6
commit bbf78096a7
3 changed files with 26 additions and 3 deletions

View File

@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G
loom.platform = forge
# Mod properties
mod_version = 1.3.2-fix1
mod_version = 1.3.3
maven_group = com.extendedae_plus
archives_name = extendedae_plus

View File

@ -66,8 +66,8 @@ public abstract class PatternProviderScreenMixin<C extends PatternProviderMenu>
boolean enabled = eap$AdvancedBlockingEnabled;
var title = net.minecraft.network.chat.Component.literal("智能阻挡");
var line = enabled
? net.minecraft.network.chat.Component.literal("已启用:YES")
: net.minecraft.network.chat.Component.literal("已禁用:NO");
? net.minecraft.network.chat.Component.literal("已启用:对于同一种配方将不再阻挡")
: net.minecraft.network.chat.Component.literal("已禁用:这么好的功能为什么不打开呢");
return java.util.List.of(title, line);
}
};

View File

@ -273,6 +273,29 @@ public abstract class GuiExPatternProviderMixin extends PatternProviderScreen<Co
this.x5Button.setVisibility(true);
}
// 若从 JEI 配方界面返回后Screen renderables/children 可能被清空导致按钮丢失
// 这里在每帧保证这些按钮存在于渲染列表中不存在则重新注册
try {
if (this.divideBy2Button != null && !this.renderables.contains(this.divideBy2Button)) {
this.addRenderableWidget(this.divideBy2Button);
}
if (this.x2Button != null && !this.renderables.contains(this.x2Button)) {
this.addRenderableWidget(this.x2Button);
}
if (this.divideBy5Button != null && !this.renderables.contains(this.divideBy5Button)) {
this.addRenderableWidget(this.divideBy5Button);
}
if (this.x5Button != null && !this.renderables.contains(this.x5Button)) {
this.addRenderableWidget(this.x5Button);
}
if (this.divideBy10Button != null && !this.renderables.contains(this.divideBy10Button)) {
this.addRenderableWidget(this.divideBy10Button);
}
if (this.x10Button != null && !this.renderables.contains(this.x10Button)) {
this.addRenderableWidget(this.x10Button);
}
} catch (Throwable ignored) {}
// 如果屏幕尺寸发生变化窗口/GUI缩放重新注册右侧外列的自定义按钮翻页按钮由左侧工具栏托管
if (this.width != eap$lastScreenWidth || this.height != eap$lastScreenHeight) {
eap$lastScreenWidth = this.width;