Implement detection for resetting points and add remaining skillpoints in tree screen
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user