Fix intro preview textures
All checks were successful
Build / build (push) Successful in 9m46s

This commit is contained in:
MrSphay
2026-05-09 00:25:19 +02:00
parent 5bcf77137b
commit ef71d03beb
10 changed files with 71 additions and 43 deletions

View File

@@ -7,17 +7,17 @@ import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
public class FirstTimeScreen extends Screen {
private static final int FRAME_WIDTH = 854;
private static final int FRAME_HEIGHT = 480;
private static final int FRAME_WIDTH = 256;
private static final int FRAME_HEIGHT = 144;
private static final int COLUMNS = 10;
private static final int ROWS = 10;
private static final int FRAME_COUNT = COLUMNS * ROWS;
private static final int BORDER = 0xFFFF7A70;
private static final int BORDER_HOVER = 0xFFFF9B91;
private static final Choice[] CHOICES = new Choice[] {
new Choice("gui_screen_1.png", 42, "REALISTIC", Config.Client.ParticleRenderMode.REALISTIC),
new Choice("gui_screen_2.png", 42, "VANILLA-LIKE", Config.Client.ParticleRenderMode.VANILA),
new Choice("gui_screen_3.png", 42, "REALISTIC 2", Config.Client.ParticleRenderMode.REALISTIC_2)
new Choice("gui_screen_1.png", 12, "REALISTIC", Config.Client.ParticleRenderMode.REALISTIC),
new Choice("gui_screen_2.png", 28, "VANILLA-LIKE", Config.Client.ParticleRenderMode.VANILA),
new Choice("gui_screen_3.png", 44, "REALISTIC 2", Config.Client.ParticleRenderMode.REALISTIC_2)
};
private final Rect[] cardRects = new Rect[] { Rect.empty(), Rect.empty(), Rect.empty() };
@@ -31,18 +31,20 @@ public class FirstTimeScreen extends Screen {
graphics.fill(0, 0, this.width, this.height, 0xFF050506);
this.drawAmbient(graphics);
int top = Math.max(34, this.height / 6);
int top = Math.max(28, this.height / 9);
graphics.drawCenteredString(this.font, Component.literal("Choose Your Explosion Style."), this.width / 2, top, 0xFFFF9900);
graphics.drawCenteredString(this.font, Component.literal("You can change this anytime in the config"), this.width / 2, top + 25, 0xFFE5E5E5);
graphics.drawCenteredString(this.font, Component.literal("The game may differ from the animations because compression has altered them."), this.width / 2, top + 48, 0xFF9C9C9C);
int cardW = Math.min(420, Math.max(220, (this.width - 170) / 2));
int availableCardH = Math.max(78, (this.height - top - 188) / 2);
int cardW = Math.min(360, Math.max(150, (this.width - 170) / 2));
cardW = Math.min(cardW, availableCardH * FRAME_WIDTH / FRAME_HEIGHT);
int cardH = cardW * FRAME_HEIGHT / FRAME_WIDTH;
int gap = Math.max(34, this.width / 28);
int firstX = this.width / 2 - cardW - gap / 2;
int secondX = this.width / 2 + gap / 2;
int firstRowY = top + 88;
int secondRowY = firstRowY + cardH + 84;
int firstRowY = top + 92;
int secondRowY = firstRowY + cardH + 60;
this.cardRects[0] = new Rect(firstX, firstRowY, cardW, cardH + 58);
this.cardRects[1] = new Rect(secondX, firstRowY, cardW, cardH + 58);
@@ -81,7 +83,7 @@ public class FirstTimeScreen extends Screen {
int imageW = rect.w;
int imageH = rect.w * FRAME_HEIGHT / FRAME_WIDTH;
graphics.fill(imageX - 6, imageY - 6, imageX + imageW + 6, imageY + imageH + 6, hovered ? BORDER_HOVER : BORDER);
this.drawSheetFrame(graphics, choice.texture, choice.frame, imageX, imageY, imageW, imageH);
this.drawSheetFrame(graphics, choice.texture, (this.currentFrame(65L) + choice.frameOffset) % FRAME_COUNT, imageX, imageY, imageW, imageH);
graphics.drawCenteredString(this.font, Component.literal(choice.label), imageX + imageW / 2, imageY + imageH + 28, 0xFFFFFFFF);
}
@@ -98,12 +100,16 @@ public class FirstTimeScreen extends Screen {
graphics.pose().popPose();
}
private int currentFrame(long frameTimeMillis) {
return (int)((System.currentTimeMillis() / frameTimeMillis) % FRAME_COUNT);
}
private void drawAmbient(GuiGraphics graphics) {
for (int i = 0; i < 96; ++i) {
for (int i = 0; i < 48; ++i) {
int x = Math.floorMod(i * 173 + 19, Math.max(1, this.width));
int y = Math.floorMod(i * 97 + 53, Math.max(1, this.height));
int color = i % 7 == 0 ? 0xFFFFB347 : 0xFF414141;
graphics.fill(x, y, x + 2, y + 2, color);
graphics.fill(x, y, x + 1, y + 1, color);
}
}
@@ -114,13 +120,13 @@ public class FirstTimeScreen extends Screen {
private static final class Choice {
private final ResourceLocation texture;
private final int frame;
private final int frameOffset;
private final String label;
private final Config.Client.ParticleRenderMode mode;
private Choice(String fileName, int frame, String label, Config.Client.ParticleRenderMode mode) {
this.texture = ResourceLocation.fromNamespaceAndPath("explosionoverhaul", "intro_gui/" + fileName);
this.frame = frame;
private Choice(String fileName, int frameOffset, String label, Config.Client.ParticleRenderMode mode) {
this.texture = ResourceLocation.fromNamespaceAndPath("explosionoverhaul", "intro_gui/preview/" + fileName);
this.frameOffset = frameOffset;
this.label = label;
this.mode = mode;
}