不再强制勾选不再显示警告复选框

This commit is contained in:
Light_Quanta 2025-02-27 16:10:36 +08:00
parent d610b2b60a
commit 5ac4270c17
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959

View file

@ -63,7 +63,6 @@ public class ModSellWarningScreen extends WarningScreen {
} }
private final Screen lastScreen; private final Screen lastScreen;
private AbstractButton proceedButton;
public ModSellWarningScreen(Screen lastScreen) { public ModSellWarningScreen(Screen lastScreen) {
super( super(
@ -77,8 +76,8 @@ public class ModSellWarningScreen extends WarningScreen {
@Override @Override
protected void initButtons(int pYOffset) { protected void initButtons(int pYOffset) {
this.proceedButton = this.createProceedButton(pYOffset); AbstractButton proceedButton = this.createProceedButton(pYOffset);
this.addRenderableWidget(this.proceedButton); this.addRenderableWidget(proceedButton);
this.addRenderableWidget( this.addRenderableWidget(
Button.builder(CommonComponents.GUI_BACK, button -> Minecraft.getInstance().setScreen(this.lastScreen)) Button.builder(CommonComponents.GUI_BACK, button -> Minecraft.getInstance().setScreen(this.lastScreen))
@ -88,21 +87,13 @@ public class ModSellWarningScreen extends WarningScreen {
} }
private AbstractButton createProceedButton(int pYOffset) { private AbstractButton createProceedButton(int pYOffset) {
var proceedButton = Button.builder(CommonComponents.GUI_PROCEED, button -> { return Button.builder(CommonComponents.GUI_PROCEED, button -> {
if (this.stopShowing != null && this.stopShowing.selected()) { if (this.stopShowing != null && this.stopShowing.selected()) {
ModSellWarningConfig.ENVIRONMENT_CHECKSUM.set(ENVIRONMENT_CHECKSUM); ModSellWarningConfig.ENVIRONMENT_CHECKSUM.set(ENVIRONMENT_CHECKSUM);
ModSellWarningConfig.ENVIRONMENT_CHECKSUM.save(); ModSellWarningConfig.ENVIRONMENT_CHECKSUM.save();
} }
Minecraft.getInstance().setScreen(new JoinMultiplayerScreen(this.lastScreen)); Minecraft.getInstance().setScreen(new JoinMultiplayerScreen(this.lastScreen));
}).bounds(this.width / 2 - 155, 100 + pYOffset, 150, 20).build(); }).bounds(this.width / 2 - 155, 100 + pYOffset, 150, 20).build();
proceedButton.active = false;
return proceedButton;
}
@Override
public void tick() {
super.tick();
this.proceedButton.active = this.stopShowing != null && this.stopShowing.selected();
} }
@SubscribeEvent(priority = EventPriority.HIGH) @SubscribeEvent(priority = EventPriority.HIGH)