|
|
|
@ -22,7 +22,6 @@ import net.minecraft.client.render.GameRenderer;
|
|
|
|
|
import net.minecraft.client.texture.TextureManager;
|
|
|
|
|
import net.minecraft.client.util.math.MatrixStack;
|
|
|
|
|
import net.minecraft.text.Text;
|
|
|
|
|
import net.minecraft.text.TranslatableText;
|
|
|
|
|
import net.minecraft.util.Formatting;
|
|
|
|
|
import net.minecraft.util.Identifier;
|
|
|
|
|
import net.minecraft.util.Util;
|
|
|
|
@ -41,7 +40,7 @@ import java.util.function.Consumer;
|
|
|
|
|
|
|
|
|
|
@Environment(EnvType.CLIENT)
|
|
|
|
|
public class CustomTitleScreen extends Screen {
|
|
|
|
|
public static final Text VERSION_TEXT = new TranslatableText("menu.gmod-title-screen.version", SharedConstants.getGameVersion().getName(), FabricLoader.getInstance().getModContainer("gmod-title-screen").get().getMetadata().getVersion().getFriendlyString());
|
|
|
|
|
public static final Text VERSION_TEXT = Text.translatable("menu.gmod-title-screen.version", SharedConstants.getGameVersion().getName(), FabricLoader.getInstance().getModContainer("gmod-title-screen").get().getMetadata().getVersion().getFriendlyString());
|
|
|
|
|
private static final Identifier ACCESSIBILITY_ICON_TEXTURE = new Identifier("textures/gui/accessibility.png");
|
|
|
|
|
private final boolean isMinceraft;
|
|
|
|
|
@Nullable
|
|
|
|
@ -112,7 +111,7 @@ public class CustomTitleScreen extends Screen {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void openLink(String url) {
|
|
|
|
|
this.client.setScreen(new ConfirmChatLinkScreen(openInBrowser -> {
|
|
|
|
|
this.client.setScreen(new ConfirmLinkScreen(openInBrowser -> {
|
|
|
|
|
if (openInBrowser) {
|
|
|
|
|
Util.getOperatingSystem().open(url);
|
|
|
|
|
}
|
|
|
|
@ -122,7 +121,7 @@ public class CustomTitleScreen extends Screen {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public CustomTitleScreen() {
|
|
|
|
|
super(new TranslatableText("narrator.screen.title"));
|
|
|
|
|
super(Text.translatable("narrator.screen.title"));
|
|
|
|
|
this.isMinceraft = (double)new Random().nextFloat() < 1.0E-4;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -193,7 +192,7 @@ public class CustomTitleScreen extends Screen {
|
|
|
|
|
buttonsY,
|
|
|
|
|
130,
|
|
|
|
|
buttonHeight,
|
|
|
|
|
new TranslatableText("menu.gmod-title-screen.singleplayer"),
|
|
|
|
|
Text.translatable("menu.gmod-title-screen.singleplayer"),
|
|
|
|
|
button -> this.client.setScreen(new SelectWorldScreen(this)),
|
|
|
|
|
this.textRenderer
|
|
|
|
|
));
|
|
|
|
@ -203,7 +202,7 @@ public class CustomTitleScreen extends Screen {
|
|
|
|
|
buttonsY + buttonSpacing * 1,
|
|
|
|
|
130,
|
|
|
|
|
buttonHeight,
|
|
|
|
|
new TranslatableText("menu.gmod-title-screen.multiplayer"),
|
|
|
|
|
Text.translatable("menu.gmod-title-screen.multiplayer"),
|
|
|
|
|
button -> {
|
|
|
|
|
this.client.setScreen(new MultiplayerScreen(this));
|
|
|
|
|
},
|
|
|
|
@ -216,10 +215,10 @@ public class CustomTitleScreen extends Screen {
|
|
|
|
|
buttonsY + buttonSpacing * 2 + buttonSectionSpacing,
|
|
|
|
|
98,
|
|
|
|
|
buttonHeight,
|
|
|
|
|
new TranslatableText("menu.gmod-title-screen.modmenu").formatted(modsButtonActive ? Formatting.RESET : Formatting.GRAY),
|
|
|
|
|
Text.translatable("menu.gmod-title-screen.modmenu").formatted(modsButtonActive ? Formatting.RESET : Formatting.GRAY),
|
|
|
|
|
button -> this.client.setScreen(new ModsScreen(this)),
|
|
|
|
|
textRenderer,
|
|
|
|
|
new DisabledTooltipSupplier(new TranslatableText("menu.gmod-title-screen.modmenu.not-installed"))
|
|
|
|
|
new DisabledTooltipSupplier(Text.translatable("menu.gmod-title-screen.modmenu.not-installed"))
|
|
|
|
|
));
|
|
|
|
|
modsButton.active = modsButtonActive;
|
|
|
|
|
|
|
|
|
@ -228,7 +227,7 @@ public class CustomTitleScreen extends Screen {
|
|
|
|
|
buttonsY + buttonSpacing * 3 + buttonSectionSpacing,
|
|
|
|
|
98,
|
|
|
|
|
buttonHeight,
|
|
|
|
|
new TranslatableText("menu.gmod-title-screen.dupes").formatted(Formatting.GRAY),
|
|
|
|
|
Text.translatable("menu.gmod-title-screen.dupes").formatted(Formatting.GRAY),
|
|
|
|
|
button -> {},
|
|
|
|
|
textRenderer
|
|
|
|
|
)).active = false;
|
|
|
|
@ -237,7 +236,7 @@ public class CustomTitleScreen extends Screen {
|
|
|
|
|
buttonsY + buttonSpacing * 4 + buttonSectionSpacing,
|
|
|
|
|
98,
|
|
|
|
|
buttonHeight,
|
|
|
|
|
new TranslatableText("menu.gmod-title-screen.demos").formatted(Formatting.GRAY),
|
|
|
|
|
Text.translatable("menu.gmod-title-screen.demos").formatted(Formatting.GRAY),
|
|
|
|
|
button -> {},
|
|
|
|
|
textRenderer
|
|
|
|
|
)).active = false;
|
|
|
|
@ -246,7 +245,7 @@ public class CustomTitleScreen extends Screen {
|
|
|
|
|
buttonsY + buttonSpacing * 5 + buttonSectionSpacing,
|
|
|
|
|
98,
|
|
|
|
|
buttonHeight,
|
|
|
|
|
new TranslatableText("menu.gmod-title-screen.saves").formatted(Formatting.GRAY),
|
|
|
|
|
Text.translatable("menu.gmod-title-screen.saves").formatted(Formatting.GRAY),
|
|
|
|
|
button -> {},
|
|
|
|
|
textRenderer
|
|
|
|
|
)).active = false;
|
|
|
|
@ -256,7 +255,7 @@ public class CustomTitleScreen extends Screen {
|
|
|
|
|
buttonsY + buttonSpacing * 6 + buttonSectionSpacing * 2,
|
|
|
|
|
98,
|
|
|
|
|
buttonHeight,
|
|
|
|
|
new TranslatableText("menu.gmod-title-screen.options"),
|
|
|
|
|
Text.translatable("menu.gmod-title-screen.options"),
|
|
|
|
|
button -> this.client.setScreen(new OptionsScreen(this, this.client.options)),
|
|
|
|
|
textRenderer
|
|
|
|
|
));
|
|
|
|
@ -266,7 +265,7 @@ public class CustomTitleScreen extends Screen {
|
|
|
|
|
buttonsY + buttonSpacing * 7 + buttonSectionSpacing * 3,
|
|
|
|
|
98,
|
|
|
|
|
buttonHeight,
|
|
|
|
|
new TranslatableText("menu.gmod-title-screen.quit"),
|
|
|
|
|
Text.translatable("menu.gmod-title-screen.quit"),
|
|
|
|
|
button -> this.client.scheduleStop(),
|
|
|
|
|
textRenderer
|
|
|
|
|
));
|
|
|
|
@ -284,7 +283,7 @@ public class CustomTitleScreen extends Screen {
|
|
|
|
|
256,
|
|
|
|
|
256,
|
|
|
|
|
button -> this.client.setScreen(new LanguageOptionsScreen(this, this.client.options, this.client.getLanguageManager())),
|
|
|
|
|
new TranslatableText("narrator.button.language")
|
|
|
|
|
Text.translatable("narrator.button.language")
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
this.addDrawableChild(new TexturedButtonWidget(
|
|
|
|
@ -299,7 +298,7 @@ public class CustomTitleScreen extends Screen {
|
|
|
|
|
32,
|
|
|
|
|
64,
|
|
|
|
|
button -> this.client.setScreen(new AccessibilityOptionsScreen(this, this.client.options)),
|
|
|
|
|
new TranslatableText("narrator.button.accessibility")
|
|
|
|
|
Text.translatable("narrator.button.accessibility")
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
version = this.addDrawableChild(
|
|
|
|
|