This commit is contained in:
Moulberry committed 2024-08-29 10:34:49 +08:00
1 parent d2a217509f
commit 4d8f896cdf
90 files changed
+2345 -720

No files matched your search

@@ -23,8 +23,7 @@ public class ConfigScreen extends OptionsSubScreen {
}
public void removed() {
Path configFolder = FabricLoader.getInstance().getConfigDir().resolve("flashback");
Flashback.getConfig().saveToFolder(configFolder);
Flashback.getConfig().saveToDefaultFolder();
}
}
@@ -1,8 +1,5 @@
package com.moulberry.flashback.screen;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.Button;
@@ -11,6 +8,8 @@ import net.minecraft.resources.ResourceLocation;
public class FlashbackButton extends Button {
private static final ResourceLocation ICON_PIXELATED = ResourceLocation.parse("flashback:icon_pixelated.png");
public FlashbackButton(int x, int y, int width, int height, Component component, OnPress onPress) {
super(x, y, width, height, component, onPress, DEFAULT_NARRATION);
}
@@ -19,30 +18,14 @@ public class FlashbackButton extends Button {
protected void renderWidget(GuiGraphics guiGraphics, int i, int j, float f) {
super.renderWidget(guiGraphics, i, j, f);
final int size = 14;
final int size = 16;
int paddingX = (this.getWidth() - size) / 2;
int paddingY = (this.getHeight() - size) / 2;
int x = this.getX() + paddingX;
int y = this.getY() + paddingY;
double guiScale = Minecraft.getInstance().getWindow().getGuiScale();
int realSize = (int)(size * guiScale);
ResourceLocation icon;
if (realSize == 14) {
icon = ResourceLocation.parse("flashback:icon_14x.png");
} else if (realSize == 28) {
icon = ResourceLocation.parse("flashback:icon_28x.png");
} else if (realSize == 42) {
icon = ResourceLocation.parse("flashback:icon_42x.png");
} else if (realSize == 56) {
icon = ResourceLocation.parse("flashback:icon_56x.png");
} else {
icon = ResourceLocation.parse("flashback:icon.png");
}
guiGraphics.blit(icon, x, y, 0f, 0f, size, size, size, size);
guiGraphics.blit(ICON_PIXELATED, x, y, 0f, 0f, size, size, size, size);
}
@@ -1,5 +1,7 @@
package com.moulberry.flashback.screen;
import com.moulberry.flashback.Flashback;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.EditBox;
@@ -37,6 +39,11 @@ public class SelectReplayScreen extends Screen {
.bounds(this.width / 2 + 4, this.height - 28, 72, 20).build());
this.addRenderableWidget(Button.builder(CommonComponents.GUI_BACK, button -> this.minecraft.setScreen(this.lastScreen))
.bounds(this.width / 2 + 82, this.height - 28, 72, 20).build());
if (this.width/2 > 154 + 128) {
this.addRenderableWidget(Button.builder(Component.literal("Flashback Settings"), btn -> Minecraft.getInstance().setScreen(new ConfigScreen(this)))
.bounds(this.width - 120 - 8, this.height - 28, 120, 20).build());
}
this.updateButtonStatus(null);
}