use of net.minecraft.client.gui.screen.SaveLevelScreen in project AutoResetMod by DuncanRuns.
the class OptionsScreenMixin method addStopRunButtonMixin.
@Inject(method = "init", at = @At("TAIL"))
private void addStopRunButtonMixin(CallbackInfo info) {
if (AutoReset.isPlaying) {
// Get menu.stop_resets text or set to default
Text text;
if (Language.getInstance().get("menu.stop_resets").equals("menu.stop_resets")) {
text = new LiteralText("Stop Resets & Quit");
} else {
text = new TranslatableText("menu.stop_resets");
}
// Add button to disable the auto reset and quit
this.addButton(new ButtonWidget(0, this.height - 20, 100, 20, text, (buttonWidget) -> {
AutoReset.isPlaying = false;
buttonWidget.active = false;
this.client.world.disconnect();
this.client.disconnect(new SaveLevelScreen(new TranslatableText("menu.savingLevel")));
this.client.openScreen(new TitleScreen());
}));
}
}
Aggregations