2026-05-04 12:09:37 +02:00
|
|
|
package com.vinlanx.explosionoverhaul.client;
|
|
|
|
|
|
2026-05-07 23:08:09 +02:00
|
|
|
import com.vinlanx.explosionoverhaul.Config;
|
2026-05-04 12:09:37 +02:00
|
|
|
import net.minecraft.client.gui.GuiGraphics;
|
2026-05-07 23:08:09 +02:00
|
|
|
import net.minecraft.client.gui.components.Button;
|
2026-05-04 12:09:37 +02:00
|
|
|
import net.minecraft.client.gui.screens.Screen;
|
|
|
|
|
import net.minecraft.network.chat.Component;
|
2026-05-07 23:08:09 +02:00
|
|
|
import net.minecraft.resources.ResourceLocation;
|
2026-05-04 12:09:37 +02:00
|
|
|
|
2026-05-07 00:14:48 +02:00
|
|
|
public class FirstTimeScreen extends Screen {
|
2026-05-07 23:08:09 +02:00
|
|
|
private static final ResourceLocation REALISTIC = ResourceLocation.fromNamespaceAndPath("explosionoverhaul", "intro_gui/gui_screen_1.png");
|
|
|
|
|
private static final ResourceLocation VANILLA = ResourceLocation.fromNamespaceAndPath("explosionoverhaul", "intro_gui/gui_screen_2.png");
|
|
|
|
|
private static final ResourceLocation REALISTIC_2 = ResourceLocation.fromNamespaceAndPath("explosionoverhaul", "intro_gui/gui_screen_3.png");
|
|
|
|
|
private static final ResourceLocation QUALITY_64 = ResourceLocation.fromNamespaceAndPath("explosionoverhaul", "intro_gui/gui_screen_4.png");
|
|
|
|
|
|
|
|
|
|
private Config.Client.ParticleRenderMode selectedMode = Config.Client.ParticleRenderMode.REALISTIC;
|
|
|
|
|
private Config.Client.GlowTextureQuality selectedQuality = Config.Client.GlowTextureQuality.QUALITY_256;
|
|
|
|
|
private boolean choosingQuality;
|
|
|
|
|
|
2026-05-04 12:09:37 +02:00
|
|
|
public FirstTimeScreen() {
|
2026-05-07 23:08:09 +02:00
|
|
|
super(Component.literal("Explosion Overhaul Setup"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void init() {
|
|
|
|
|
this.rebuildButtons();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void rebuildButtons() {
|
|
|
|
|
this.clearWidgets();
|
|
|
|
|
int cardW = Math.max(160, this.width / 5);
|
|
|
|
|
int cardH = 28;
|
|
|
|
|
int y = this.height - 86;
|
|
|
|
|
if (!this.choosingQuality) {
|
|
|
|
|
int gap = 12;
|
|
|
|
|
int startX = (this.width - cardW * 3 - gap * 2) / 2;
|
|
|
|
|
this.addRenderableWidget(Button.builder(Component.literal("Realistic"), button -> {
|
|
|
|
|
this.selectedMode = Config.Client.ParticleRenderMode.REALISTIC;
|
|
|
|
|
this.choosingQuality = true;
|
|
|
|
|
this.rebuildButtons();
|
|
|
|
|
}).bounds(startX, y, cardW, cardH).build());
|
|
|
|
|
this.addRenderableWidget(Button.builder(Component.literal("Vanilla Performance"), button -> {
|
|
|
|
|
this.selectedMode = Config.Client.ParticleRenderMode.VANILA;
|
|
|
|
|
this.choosingQuality = true;
|
|
|
|
|
this.rebuildButtons();
|
|
|
|
|
}).bounds(startX + cardW + gap, y, cardW, cardH).build());
|
|
|
|
|
this.addRenderableWidget(Button.builder(Component.literal("Realistic 2"), button -> {
|
|
|
|
|
this.selectedMode = Config.Client.ParticleRenderMode.REALISTIC_2;
|
|
|
|
|
this.choosingQuality = true;
|
|
|
|
|
this.rebuildButtons();
|
|
|
|
|
}).bounds(startX + (cardW + gap) * 2, y, cardW, cardH).build());
|
|
|
|
|
} else {
|
|
|
|
|
int gap = 16;
|
|
|
|
|
int startX = (this.width - cardW * 2 - gap) / 2;
|
|
|
|
|
this.addRenderableWidget(Button.builder(Component.literal("256p Quality"), button -> this.finish(Config.Client.GlowTextureQuality.QUALITY_256)).bounds(startX, y, cardW, cardH).build());
|
|
|
|
|
this.addRenderableWidget(Button.builder(Component.literal("64p Performance"), button -> this.finish(Config.Client.GlowTextureQuality.QUALITY_64)).bounds(startX + cardW + gap, y, cardW, cardH).build());
|
|
|
|
|
this.addRenderableWidget(Button.builder(Component.literal("Back"), button -> {
|
|
|
|
|
this.choosingQuality = false;
|
|
|
|
|
this.rebuildButtons();
|
|
|
|
|
}).bounds(16, this.height - 40, 80, 24).build());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void finish(Config.Client.GlowTextureQuality quality) {
|
|
|
|
|
this.selectedQuality = quality;
|
|
|
|
|
Config.CLIENT.particleRenderMode.set(this.selectedMode);
|
|
|
|
|
Config.CLIENT.glowTextureQuality.set(this.selectedQuality);
|
|
|
|
|
Config.CLIENT.firstLaunchComplete.set(true);
|
|
|
|
|
Config.CLIENT.introSetupComplete.set(true);
|
|
|
|
|
Config.CLIENT_SPEC.save();
|
|
|
|
|
this.onClose();
|
2026-05-04 12:09:37 +02:00
|
|
|
}
|
|
|
|
|
|
2026-05-07 00:14:48 +02:00
|
|
|
@Override
|
|
|
|
|
public void render(GuiGraphics graphics, int mouseX, int mouseY, float partialTick) {
|
2026-05-07 23:08:09 +02:00
|
|
|
this.renderBackground(graphics, mouseX, mouseY, partialTick);
|
|
|
|
|
graphics.fill(0, 0, this.width, this.height, 0xE0101117);
|
|
|
|
|
graphics.drawCenteredString(this.font, Component.literal("Explosion Overhaul"), this.width / 2, 28, 0xFFFFFF);
|
|
|
|
|
graphics.drawCenteredString(this.font, this.choosingQuality ? Component.literal("Choose texture quality") : Component.literal("Choose explosion render mode"), this.width / 2, 48, 0xFFB35C);
|
|
|
|
|
|
|
|
|
|
if (this.choosingQuality) {
|
|
|
|
|
this.drawPreview(graphics, REALISTIC, this.width / 2 - 270, 82, 250, 141, "256p Quality");
|
|
|
|
|
this.drawPreview(graphics, QUALITY_64, this.width / 2 + 20, 82, 250, 141, "64p Performance");
|
|
|
|
|
} else {
|
|
|
|
|
this.drawPreview(graphics, REALISTIC, this.width / 2 - 390, 82, 240, 135, "Realistic");
|
|
|
|
|
this.drawPreview(graphics, VANILLA, this.width / 2 - 120, 82, 240, 135, "Vanilla Performance");
|
|
|
|
|
this.drawPreview(graphics, REALISTIC_2, this.width / 2 + 150, 82, 240, 135, "Realistic 2");
|
|
|
|
|
}
|
2026-05-07 00:14:48 +02:00
|
|
|
super.render(graphics, mouseX, mouseY, partialTick);
|
2026-05-04 12:09:37 +02:00
|
|
|
}
|
2026-05-07 23:08:09 +02:00
|
|
|
|
|
|
|
|
private void drawPreview(GuiGraphics graphics, ResourceLocation texture, int x, int y, int w, int h, String label) {
|
|
|
|
|
graphics.fill(x - 2, y - 2, x + w + 2, y + h + 20, 0xAA000000);
|
|
|
|
|
graphics.blit(texture, x, y, 0.0f, 0.0f, w, h, 854, 480);
|
|
|
|
|
graphics.drawCenteredString(this.font, Component.literal(label), x + w / 2, y + h + 7, 0xFFFFFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean shouldCloseOnEsc() {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2026-05-04 12:09:37 +02:00
|
|
|
}
|