update dependencies and fix a small issue with GUI Scale
This commit is contained in:
@@ -16,6 +16,8 @@ out
|
||||
# gradle
|
||||
build
|
||||
.gradle
|
||||
.gradle-user-home
|
||||
mcmodsrepo
|
||||
|
||||
# other
|
||||
eclipse
|
||||
|
||||
+4
-4
@@ -135,19 +135,19 @@ repositories {
|
||||
dependencies {
|
||||
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
|
||||
// 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.
|
||||
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}")
|
||||
|
||||
// PLAYER ANIMATOR — deobf
|
||||
// PLAYER ANIMATOR - deobf
|
||||
implementation fg.deobf("dev.kosmx.player-anim:player-animation-lib-forge:${player_animator_version}")
|
||||
|
||||
// CAELUS
|
||||
|
||||
+4
-2
@@ -22,8 +22,10 @@ loader_version_range=[47,)
|
||||
# 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.
|
||||
#
|
||||
mindmotion_version=1.4.5
|
||||
skillengine_version=1.4.14
|
||||
mindmotion_version=1.4.7
|
||||
mindmotion_file_id=8726482
|
||||
skillengine_version=1.4.7
|
||||
skillengine_file_id=8726402
|
||||
irons_spells_version=1.20.1-3.16.2
|
||||
irons_spells_file_id=8364933
|
||||
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 Map<String, Button> plusButtons = new HashMap<>();
|
||||
private int leftPos;
|
||||
private int topPos;
|
||||
private float uiScale = 1.0F;
|
||||
private int uiLeft;
|
||||
private int uiTop;
|
||||
private String hoveredAttributeKey;
|
||||
|
||||
public StatsScreen() {
|
||||
@@ -68,8 +69,10 @@ public class StatsScreen extends Screen {
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
leftPos = (width - WIDTH) / 2;
|
||||
topPos = (height - HEIGHT) / 2;
|
||||
uiScale = Math.min(1.0F, Math.min((width - 12.0F) / WIDTH, (height - 12.0F) / HEIGHT));
|
||||
uiScale = Math.max(0.25F, uiScale);
|
||||
uiLeft = Math.round((width - WIDTH * uiScale) / 2.0F);
|
||||
uiTop = Math.round((height - HEIGHT * uiScale) / 2.0F);
|
||||
plusButtons.clear();
|
||||
clearWidgets();
|
||||
|
||||
@@ -77,8 +80,8 @@ public class StatsScreen extends Screen {
|
||||
String attribute = ATTRIBUTES[index];
|
||||
int column = index % 2;
|
||||
int row = index / 2;
|
||||
int cardX = leftPos + PADDING + column * (CARD_WIDTH + COLUMN_GAP);
|
||||
int cardY = topPos + CARDS_TOP + row * (CARD_HEIGHT + CARD_GAP);
|
||||
int cardX = PADDING + column * (CARD_WIDTH + COLUMN_GAP);
|
||||
int cardY = CARDS_TOP + row * (CARD_HEIGHT + CARD_GAP);
|
||||
Button plus = Button.builder(Component.literal("+"), button ->
|
||||
PacketHandler.INSTANCE.sendToServer(new ServerboundSpendPointPacket(attribute)))
|
||||
.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())
|
||||
.bounds(leftPos + WIDTH / 2 - 45, topPos + HEIGHT - 24, 90, 18)
|
||||
.bounds(WIDTH / 2 - 45, HEIGHT - 24, 90, 18)
|
||||
.build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) {
|
||||
renderBackground(graphics);
|
||||
drawWindow(graphics);
|
||||
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) {
|
||||
minecraft.player.getCapability(PlayerStatsProvider.PLAYER_STATS).ifPresent(stats -> {
|
||||
drawProgression(graphics, stats.getAscendLevel(), stats.getMaxAscendLevel(),
|
||||
@@ -107,11 +117,11 @@ public class StatsScreen extends Screen {
|
||||
String attribute = ATTRIBUTES[index];
|
||||
int column = index % 2;
|
||||
int row = index / 2;
|
||||
int cardX = leftPos + PADDING + column * (CARD_WIDTH + COLUMN_GAP);
|
||||
int cardY = topPos + CARDS_TOP + row * (CARD_HEIGHT + CARD_GAP);
|
||||
int cardX = PADDING + column * (CARD_WIDTH + COLUMN_GAP);
|
||||
int cardY = CARDS_TOP + row * (CARD_HEIGHT + CARD_GAP);
|
||||
int value = stats.getAttributeLevel(attribute);
|
||||
boolean hovered = mouseX >= cardX && mouseX < cardX + CARD_WIDTH
|
||||
&& mouseY >= cardY && mouseY < cardY + CARD_HEIGHT;
|
||||
boolean hovered = uiMouseX >= cardX && uiMouseX < cardX + CARD_WIDTH
|
||||
&& uiMouseY >= cardY && uiMouseY < cardY + CARD_HEIGHT;
|
||||
drawAttributeCard(graphics, attribute, value, stats.getMaxAttributePoints(), cardX, cardY, hovered);
|
||||
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) {
|
||||
graphics.renderTooltip(font, ATTRIBUTE_TOOLTIPS.get(hoveredAttributeKey), mouseX, mouseY);
|
||||
}
|
||||
@@ -134,20 +145,20 @@ public class StatsScreen extends Screen {
|
||||
|
||||
private void drawWindow(GuiGraphics graphics) {
|
||||
RenderSystem.enableBlend();
|
||||
graphics.fill(leftPos - 6, topPos - 6, leftPos + WIDTH + 6, topPos + HEIGHT + 6, 0xCC090A0C);
|
||||
graphics.fill(leftPos - 3, topPos - 3, leftPos + WIDTH + 3, topPos + HEIGHT + 3, BORDER);
|
||||
graphics.fill(leftPos, topPos, leftPos + WIDTH, topPos + HEIGHT, BACKGROUND);
|
||||
graphics.fill(leftPos, topPos, leftPos + WIDTH, topPos + 20, PANEL);
|
||||
graphics.fill(leftPos, topPos + 20, leftPos + WIDTH, topPos + 21, BORDER);
|
||||
graphics.fill(-6, -6, WIDTH + 6, HEIGHT + 6, 0xCC090A0C);
|
||||
graphics.fill(-3, -3, WIDTH + 3, HEIGHT + 3, BORDER);
|
||||
graphics.fill(0, 0, WIDTH, HEIGHT, BACKGROUND);
|
||||
graphics.fill(0, 0, WIDTH, 20, PANEL);
|
||||
graphics.fill(0, 20, WIDTH, 21, BORDER);
|
||||
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,
|
||||
int knowledge, int unspent) {
|
||||
int panelX = leftPos + PADDING;
|
||||
int panelY = topPos + 26;
|
||||
int panelX = PADDING;
|
||||
int panelY = 26;
|
||||
int panelWidth = WIDTH - PADDING * 2;
|
||||
graphics.fill(panelX, panelY, panelX + panelWidth, panelY + 45, PANEL);
|
||||
|
||||
@@ -203,4 +214,27 @@ public class StatsScreen extends Screen {
|
||||
public boolean isPauseScreen() {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user