Implement detection for resetting points and add remaining skillpoints in tree screen

This commit is contained in:
2025-11-25 22:23:14 +01:00
parent ec49eb4385
commit dd15eb9327
9 changed files with 116 additions and 8 deletions
@@ -12,6 +12,7 @@ import java.util.Set;
public class SkilltreeClientState {
private static final Set<ResourceLocation> unlocked = new HashSet<>();
private static int currentSkillPoints = 0;
public static void unlockNode(ResourceLocation id) {
SkillEngine.LOGGER.info("[CLIENT] Unlocking node: {}", id);
@@ -41,4 +42,12 @@ public class SkilltreeClientState {
unlocked.clear();
unlocked.addAll(ids);
}
public static void setCurrentSkillPoints(int points) {
currentSkillPoints = points;
}
public static int getCurrentSkillPoints() {
return currentSkillPoints;
}
}
@@ -98,6 +98,11 @@ public class SkilltreeScreen extends Screen {
@Override
public void render(GuiGraphics gfx, int mouseX, int mouseY, float partialTicks) {
this.renderBackground(gfx);
int remaining = SkilltreeClientState.getCurrentSkillPoints();
Component pointsText = Component.literal(remaining + " skillpoints remaining")
.withStyle(ChatFormatting.YELLOW);
gfx.drawString(font, pointsText, 10, 10, 0xFFFFFF);
hoveredNode = findNodeAt(mouseX, mouseY);
drawGraph(gfx);
if (hoveredNode != null && selectedNode == null) {