forked from CaffeineMC/sodium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7349029
commit 90cc383
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
src/main/java/me/jellysquid/mods/sodium/client/gui/pojavlauncherWarnScreen.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package me.jellysquid.mods.sodium.client.gui; | ||
|
||
import me.jellysquid.mods.sodium.client.SodiumClientMod; | ||
import net.minecraft.client.font.MultilineText; | ||
import net.minecraft.client.gui.screen.Screen; | ||
import net.minecraft.client.gui.screen.ScreenTexts; | ||
import net.minecraft.client.gui.widget.ButtonWidget; | ||
import net.minecraft.client.gui.widget.CheckboxWidget; | ||
import net.minecraft.client.util.math.MatrixStack; | ||
import net.minecraft.text.LiteralText; | ||
import net.minecraft.text.Text; | ||
import net.minecraft.text.TranslatableText; | ||
import net.minecraft.util.Formatting; | ||
import net.minecraft.util.Util; | ||
|
||
public class pojavlauncherWarnScreen extends Screen { | ||
|
||
private static final Text HEADER = new TranslatableText("sodium.console.pojav_launcher").formatted(Formatting.BOLD); | ||
private static final Text MESSAGE = new TranslatableText("sodium.console.pojav_launcher"); | ||
private static final Text CHECK_MESSAGE = new TranslatableText("multiplayerWarning.check"); | ||
private final Screen prevScreen; | ||
private CheckboxWidget checkbox; | ||
private MultilineText lines = MultilineText.EMPTY; | ||
|
||
public pojavlauncherWarnScreen(Screen prevScreen) { | ||
super(new LiteralText("BianXiao Edit Sodium Warning")); | ||
this.prevScreen = prevScreen; | ||
} | ||
|
||
@Override | ||
protected void init() { | ||
super.init(); | ||
this.lines = MultilineText.create(this.textRenderer, MESSAGE, this.width - 50); | ||
int i = (this.lines.count() + 1) * this.textRenderer.fontHeight * 2; | ||
this.addDrawableChild(new ButtonWidget(this.width / 2 - 155, 100 + i, 150, 20, ScreenTexts.PROCEED, buttonWidget -> { | ||
if (this.checkbox.isChecked()) { | ||
SodiumExtraClientMod.options().notificationSettings.hideRSORecommendation = true; | ||
SodiumExtraClientMod.options().writeChanges(); | ||
} | ||
this.client.setScreen(this.prevScreen); | ||
})); | ||
this.addDrawableChild(new ButtonWidget(this.width / 2 - 155 + 160, 100 + i, 150, 20, new TranslatableText("menu.quit"), buttonWidget -> this.client.scheduleStop())); | ||
this.checkbox = new CheckboxWidget(this.width / 2 - 155 + 80, 76 + i, 150, 20, CHECK_MESSAGE, false); | ||
this.addDrawableChild(this.checkbox); | ||
} | ||
|
||
@Override | ||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { | ||
this.renderBackgroundTexture(0); | ||
drawTextWithShadow(matrices, this.textRenderer, HEADER, 25, 30, 0xFFFFFF); | ||
this.lines.drawWithShadow(matrices, 25, 70, this.textRenderer.fontHeight * 2, 0xFFFFFF); | ||
super.render(matrices, mouseX, mouseY, delta); | ||
} | ||
} |