update dependencies and fix a small issue with GUI Scale

This commit is contained in:
Frederik Spirgi
2026-10-08 09:28:44 +02:00
parent cfccdd9b36
commit efb1b98868
4 changed files with 65 additions and 27 deletions
+2
View File
@@ -16,6 +16,8 @@ out
# gradle # gradle
build build
.gradle .gradle
.gradle-user-home
mcmodsrepo
# other # other
eclipse eclipse
+4 -4
View File
@@ -135,19 +135,19 @@ repositories {
dependencies { dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
implementation fg.deobf("net.fretux.mindmotion:mindmotion:${mindmotion_version}") implementation fg.deobf("curse.maven:mind-motion-1386864:${mindmotion_file_id}")
// Skill Engine is an Ascend addon, so include it in development runs without // Skill Engine is an Ascend addon, so include it in development runs without
// creating a circular mandatory dependency from Ascend back to Skill Engine. // creating a circular mandatory dependency from Ascend back to Skill Engine.
runtimeOnly fg.deobf("net.fretux.skillengine:SkillEngine:${skillengine_version}") runtimeOnly fg.deobf("curse.maven:fretux-skill-engine-1391618:${skillengine_file_id}")
// Current Iron's Spellbooks releases are distributed through Curse Maven. // Current Iron's Spellbooks releases are distributed through Curse Maven.
compileOnly fg.deobf("curse.maven:irons-spells-n-spellbooks-855414:${irons_spells_file_id}") compileOnly fg.deobf("curse.maven:irons-spells-n-spellbooks-855414:${irons_spells_file_id}")
// GECKOLIB — deobfuscated, full mod // GECKOLIB - deobfuscated, full mod
implementation fg.deobf("software.bernie.geckolib:geckolib-forge-${geckolib_version}") implementation fg.deobf("software.bernie.geckolib:geckolib-forge-${geckolib_version}")
// PLAYER ANIMATOR — deobf // PLAYER ANIMATOR - deobf
implementation fg.deobf("dev.kosmx.player-anim:player-animation-lib-forge:${player_animator_version}") implementation fg.deobf("dev.kosmx.player-anim:player-animation-lib-forge:${player_animator_version}")
// CAELUS // CAELUS
+4 -2
View File
@@ -22,8 +22,10 @@ loader_version_range=[47,)
# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"]. # The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"].
# Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin. # Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin.
# #
mindmotion_version=1.4.5 mindmotion_version=1.4.7
skillengine_version=1.4.14 mindmotion_file_id=8726482
skillengine_version=1.4.7
skillengine_file_id=8726402
irons_spells_version=1.20.1-3.16.2 irons_spells_version=1.20.1-3.16.2
irons_spells_file_id=8364933 irons_spells_file_id=8364933
caelus_version=3.2.0+1.20.1 caelus_version=3.2.0+1.20.1
@@ -57,8 +57,9 @@ public class StatsScreen extends Screen {
private final Minecraft minecraft = Minecraft.getInstance(); private final Minecraft minecraft = Minecraft.getInstance();
private final Map<String, Button> plusButtons = new HashMap<>(); private final Map<String, Button> plusButtons = new HashMap<>();
private int leftPos; private float uiScale = 1.0F;
private int topPos; private int uiLeft;
private int uiTop;
private String hoveredAttributeKey; private String hoveredAttributeKey;
public StatsScreen() { public StatsScreen() {
@@ -68,8 +69,10 @@ public class StatsScreen extends Screen {
@Override @Override
protected void init() { protected void init() {
super.init(); super.init();
leftPos = (width - WIDTH) / 2; uiScale = Math.min(1.0F, Math.min((width - 12.0F) / WIDTH, (height - 12.0F) / HEIGHT));
topPos = (height - HEIGHT) / 2; uiScale = Math.max(0.25F, uiScale);
uiLeft = Math.round((width - WIDTH * uiScale) / 2.0F);
uiTop = Math.round((height - HEIGHT * uiScale) / 2.0F);
plusButtons.clear(); plusButtons.clear();
clearWidgets(); clearWidgets();
@@ -77,8 +80,8 @@ public class StatsScreen extends Screen {
String attribute = ATTRIBUTES[index]; String attribute = ATTRIBUTES[index];
int column = index % 2; int column = index % 2;
int row = index / 2; int row = index / 2;
int cardX = leftPos + PADDING + column * (CARD_WIDTH + COLUMN_GAP); int cardX = PADDING + column * (CARD_WIDTH + COLUMN_GAP);
int cardY = topPos + CARDS_TOP + row * (CARD_HEIGHT + CARD_GAP); int cardY = CARDS_TOP + row * (CARD_HEIGHT + CARD_GAP);
Button plus = Button.builder(Component.literal("+"), button -> Button plus = Button.builder(Component.literal("+"), button ->
PacketHandler.INSTANCE.sendToServer(new ServerboundSpendPointPacket(attribute))) PacketHandler.INSTANCE.sendToServer(new ServerboundSpendPointPacket(attribute)))
.bounds(cardX + CARD_WIDTH - 30, cardY + 5, 22, 18) .bounds(cardX + CARD_WIDTH - 30, cardY + 5, 22, 18)
@@ -88,16 +91,23 @@ public class StatsScreen extends Screen {
} }
addRenderableWidget(Button.builder(Component.translatable("gui.done"), button -> onClose()) addRenderableWidget(Button.builder(Component.translatable("gui.done"), button -> onClose())
.bounds(leftPos + WIDTH / 2 - 45, topPos + HEIGHT - 24, 90, 18) .bounds(WIDTH / 2 - 45, HEIGHT - 24, 90, 18)
.build()); .build());
} }
@Override @Override
public void render(GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) { public void render(GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) {
renderBackground(graphics); renderBackground(graphics);
drawWindow(graphics);
hoveredAttributeKey = null; hoveredAttributeKey = null;
int uiMouseX = (int) toUiX(mouseX);
int uiMouseY = (int) toUiY(mouseY);
graphics.pose().pushPose();
graphics.pose().translate(uiLeft, uiTop, 0.0F);
graphics.pose().scale(uiScale, uiScale, 1.0F);
drawWindow(graphics);
if (minecraft.player != null) { if (minecraft.player != null) {
minecraft.player.getCapability(PlayerStatsProvider.PLAYER_STATS).ifPresent(stats -> { minecraft.player.getCapability(PlayerStatsProvider.PLAYER_STATS).ifPresent(stats -> {
drawProgression(graphics, stats.getAscendLevel(), stats.getMaxAscendLevel(), drawProgression(graphics, stats.getAscendLevel(), stats.getMaxAscendLevel(),
@@ -107,11 +117,11 @@ public class StatsScreen extends Screen {
String attribute = ATTRIBUTES[index]; String attribute = ATTRIBUTES[index];
int column = index % 2; int column = index % 2;
int row = index / 2; int row = index / 2;
int cardX = leftPos + PADDING + column * (CARD_WIDTH + COLUMN_GAP); int cardX = PADDING + column * (CARD_WIDTH + COLUMN_GAP);
int cardY = topPos + CARDS_TOP + row * (CARD_HEIGHT + CARD_GAP); int cardY = CARDS_TOP + row * (CARD_HEIGHT + CARD_GAP);
int value = stats.getAttributeLevel(attribute); int value = stats.getAttributeLevel(attribute);
boolean hovered = mouseX >= cardX && mouseX < cardX + CARD_WIDTH boolean hovered = uiMouseX >= cardX && uiMouseX < cardX + CARD_WIDTH
&& mouseY >= cardY && mouseY < cardY + CARD_HEIGHT; && uiMouseY >= cardY && uiMouseY < cardY + CARD_HEIGHT;
drawAttributeCard(graphics, attribute, value, stats.getMaxAttributePoints(), cardX, cardY, hovered); drawAttributeCard(graphics, attribute, value, stats.getMaxAttributePoints(), cardX, cardY, hovered);
if (hovered) hoveredAttributeKey = attribute; if (hovered) hoveredAttributeKey = attribute;
@@ -126,7 +136,8 @@ public class StatsScreen extends Screen {
}); });
} }
super.render(graphics, mouseX, mouseY, partialTicks); super.render(graphics, uiMouseX, uiMouseY, partialTicks);
graphics.pose().popPose();
if (hoveredAttributeKey != null) { if (hoveredAttributeKey != null) {
graphics.renderTooltip(font, ATTRIBUTE_TOOLTIPS.get(hoveredAttributeKey), mouseX, mouseY); graphics.renderTooltip(font, ATTRIBUTE_TOOLTIPS.get(hoveredAttributeKey), mouseX, mouseY);
} }
@@ -134,20 +145,20 @@ public class StatsScreen extends Screen {
private void drawWindow(GuiGraphics graphics) { private void drawWindow(GuiGraphics graphics) {
RenderSystem.enableBlend(); RenderSystem.enableBlend();
graphics.fill(leftPos - 6, topPos - 6, leftPos + WIDTH + 6, topPos + HEIGHT + 6, 0xCC090A0C); graphics.fill(-6, -6, WIDTH + 6, HEIGHT + 6, 0xCC090A0C);
graphics.fill(leftPos - 3, topPos - 3, leftPos + WIDTH + 3, topPos + HEIGHT + 3, BORDER); graphics.fill(-3, -3, WIDTH + 3, HEIGHT + 3, BORDER);
graphics.fill(leftPos, topPos, leftPos + WIDTH, topPos + HEIGHT, BACKGROUND); graphics.fill(0, 0, WIDTH, HEIGHT, BACKGROUND);
graphics.fill(leftPos, topPos, leftPos + WIDTH, topPos + 20, PANEL); graphics.fill(0, 0, WIDTH, 20, PANEL);
graphics.fill(leftPos, topPos + 20, leftPos + WIDTH, topPos + 21, BORDER); graphics.fill(0, 20, WIDTH, 21, BORDER);
RenderSystem.disableBlend(); RenderSystem.disableBlend();
graphics.drawCenteredString(font, title, leftPos + WIDTH / 2, topPos + 6, PRIMARY_TEXT); graphics.drawCenteredString(font, title, WIDTH / 2, 6, PRIMARY_TEXT);
} }
private void drawProgression(GuiGraphics graphics, int level, int maxLevel, int xp, int xpNext, private void drawProgression(GuiGraphics graphics, int level, int maxLevel, int xp, int xpNext,
int knowledge, int unspent) { int knowledge, int unspent) {
int panelX = leftPos + PADDING; int panelX = PADDING;
int panelY = topPos + 26; int panelY = 26;
int panelWidth = WIDTH - PADDING * 2; int panelWidth = WIDTH - PADDING * 2;
graphics.fill(panelX, panelY, panelX + panelWidth, panelY + 45, PANEL); graphics.fill(panelX, panelY, panelX + panelWidth, panelY + 45, PANEL);
@@ -203,4 +214,27 @@ public class StatsScreen extends Screen {
public boolean isPauseScreen() { public boolean isPauseScreen() {
return false; return false;
} }
private double toUiX(double mouseX) {
return (mouseX - uiLeft) / uiScale;
}
private double toUiY(double mouseY) {
return (mouseY - uiTop) / uiScale;
}
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
return super.mouseClicked(toUiX(mouseX), toUiY(mouseY), button);
}
@Override
public boolean mouseReleased(double mouseX, double mouseY, int button) {
return super.mouseReleased(toUiX(mouseX), toUiY(mouseY), button);
}
@Override
public boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) {
return super.mouseDragged(toUiX(mouseX), toUiY(mouseY), button, dragX / uiScale, dragY / uiScale);
}
} }