Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3bff96c
Add documentation describing the Minecraft mod project
Mar 16, 2026
5be4a61
Improve the appearance and customization of status bars
Mar 16, 2026
a76e058
Introduce a reset to default functionality for status bars
Mar 16, 2026
2c01557
Improve bar customization and fix display errors
Mar 16, 2026
9c0907b
Improve bar customization options and fix display bugs
Mar 16, 2026
9d199bd
Improve customization and handling of status bar icons and text elements
Mar 16, 2026
8901dfc
Add ability to customize bar border radius for rounded corners
Mar 16, 2026
9c620a1
Improve status bar customization with resizable elements and visual u…
Mar 16, 2026
554f8ee
Improve bar selection, dragging, and display in the config screen
Mar 16, 2026
a43c75b
Add keyboard controls for precise element manipulation and a new tips…
Mar 16, 2026
57cce22
Improve bar editing with selection and reset functionality
Mar 16, 2026
af95a98
Set preferred status bar layout as default for new users
Mar 16, 2026
c5190d0
Improve element positioning feedback and update default layouts
Mar 16, 2026
49b3493
Update UI element positioning to adapt to different screen sizes
Mar 16, 2026
3789dd2
Make status bars position relative to the hotbar
Mar 17, 2026
594dc09
Adjust status bar positioning to match custom configuration precisely
Mar 17, 2026
6b78116
Adjust status bars and XP bar positioning for better visual layout
Mar 17, 2026
027881b
Add a gap between stat bars and the XP bar
Mar 17, 2026
cdfe0cf
Add preview screenshots of status bar customizations
Mar 17, 2026
5133a42
Delete attached_assets directory
Akar1881 Mar 17, 2026
7b76478
Delete .replit
Akar1881 Mar 17, 2026
b1acde0
Delete replit.md
Akar1881 Mar 17, 2026
e2f1d37
Add setColors method to StatusBar
Akar1881 Mar 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
package de.hysky.skyblocker.skyblock.fancybars;

import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.EditBox;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.input.KeyEvent;
import net.minecraft.network.chat.Component;
import org.lwjgl.glfw.GLFW;

import java.util.function.IntConsumer;

/**
* A small dialog that lets the user type a border-radius value (0–20 px).
* Opened from the right-click edit panel on any status bar.
*/
public class BorderRadiusDialog extends Screen {

private static final int MAX_RADIUS = 20;

private final Screen parent;
private final int currentRadius;
private final IntConsumer onConfirm;

private EditBox inputBox;
private Button confirmButton;
private Component errorMsg = Component.empty();

public BorderRadiusDialog(Screen parent, int currentRadius, IntConsumer onConfirm) {
super(Component.translatable("skyblocker.bars.config.borderRadius.dialog.title"));
this.parent = parent;
this.currentRadius = currentRadius;
this.onConfirm = onConfirm;
}

@Override
protected void init() {
int cx = width / 2;
int cy = height / 2;

inputBox = new EditBox(font, cx - 50, cy - 10, 100, 20,
Component.translatable("skyblocker.bars.config.borderRadius"));
inputBox.setMaxLength(3);
inputBox.setValue(String.valueOf(currentRadius));
inputBox.setFilter(s -> s.isEmpty() || s.matches("\\d{0,3}"));
inputBox.setResponder(text -> {
errorMsg = validate(text) == -1
? Component.translatable("skyblocker.bars.config.borderRadius.dialog.error", MAX_RADIUS)
: Component.empty();
if (confirmButton != null) confirmButton.active = (validate(text) != -1);
});
addRenderableWidget(inputBox);

confirmButton = addRenderableWidget(Button.builder(
Component.translatable("skyblocker.bars.config.borderRadius.dialog.confirm"),
btn -> confirm())
.bounds(cx - 52, cy + 16, 50, 16)
.build());

addRenderableWidget(Button.builder(
Component.translatable("skyblocker.bars.config.borderRadius.dialog.cancel"),
btn -> minecraft.setScreen(parent))
.bounds(cx + 2, cy + 16, 50, 16)
.build());

setFocused(inputBox);
}

/** Returns the clamped value, or -1 if the text is invalid. */
private int validate(String text) {
if (text == null || text.isBlank()) return 0;
try {
int v = Integer.parseInt(text.trim());
if (v < 0 || v > MAX_RADIUS) return -1;
return v;
} catch (NumberFormatException e) {
return -1;
}
}

private void confirm() {
int v = validate(inputBox.getValue());
if (v == -1) return;
onConfirm.accept(v);
minecraft.setScreen(parent);
}

@Override
public boolean keyPressed(KeyEvent keyEvent) {
int key = keyEvent.key();
if (key == GLFW.GLFW_KEY_ENTER || key == GLFW.GLFW_KEY_KP_ENTER) {
confirm();
return true;
}
if (key == GLFW.GLFW_KEY_ESCAPE) {
minecraft.setScreen(parent);
return true;
}
return super.keyPressed(keyEvent);
}

@Override
public void render(GuiGraphics context, int mouseX, int mouseY, float delta) {
renderTransparentBackground(context);

int cx = width / 2;
int cy = height / 2;

// Draw a simple background panel
int panelW = 160, panelH = 80;
context.fill(cx - panelW / 2, cy - panelH / 2, cx + panelW / 2, cy + panelH / 2, 0xCC000000);
context.fill(cx - panelW / 2, cy - panelH / 2, cx + panelW / 2, cy - panelH / 2 + 1, 0xFF555555);
context.fill(cx - panelW / 2, cy + panelH / 2 - 1, cx + panelW / 2, cy + panelH / 2, 0xFF555555);
context.fill(cx - panelW / 2, cy - panelH / 2, cx - panelW / 2 + 1, cy + panelH / 2, 0xFF555555);
context.fill(cx + panelW / 2 - 1, cy - panelH / 2, cx + panelW / 2, cy + panelH / 2, 0xFF555555);

// Title
context.drawCenteredString(font, getTitle(), cx, cy - panelH / 2 + 5, 0xFFFFFF);

// Prompt
context.drawCenteredString(font,
Component.translatable("skyblocker.bars.config.borderRadius.dialog.prompt", MAX_RADIUS),
cx, cy - 22, 0xAAAAAA);

// Error
if (!errorMsg.getString().isEmpty()) {
context.drawCenteredString(font, errorMsg, cx, cy + 36, 0xFF5555);
}

super.render(context, mouseX, mouseY, delta);
}

@Override
public boolean isPauseScreen() {
return false;
}
}
Loading