diff --git a/src/main/java/com/minelittlepony/unicopia/container/SpellbookProfilePageContent.java b/src/main/java/com/minelittlepony/unicopia/container/SpellbookProfilePageContent.java index 79919755..26b72be8 100644 --- a/src/main/java/com/minelittlepony/unicopia/container/SpellbookProfilePageContent.java +++ b/src/main/java/com/minelittlepony/unicopia/container/SpellbookProfilePageContent.java @@ -40,7 +40,7 @@ public class SpellbookProfilePageContent extends DrawableHelper implements Spell int currentLevel = pony.getLevel().get(); DrawableUtil.drawScaledText(matrices, pony.getEntity().getName(), SpellbookScreen.TITLE_X, y, 1.3F, SpellbookScreen.TITLE_COLOR); - DrawableUtil.drawScaledText(matrices, ExperienceGroup.forLevel(currentLevel).getLabel(), SpellbookScreen.TITLE_X, y + 13, 0.8F, 0xAA0040FF); + DrawableUtil.drawScaledText(matrices, ExperienceGroup.forLevel(currentLevel, pony.getCorruption().get()), SpellbookScreen.TITLE_X, y + 13, 0.8F, 0xAA0040FF); MagicReserves reserves = pony.getMagicalReserves(); diff --git a/src/main/java/com/minelittlepony/unicopia/container/SpellbookScreen.java b/src/main/java/com/minelittlepony/unicopia/container/SpellbookScreen.java index 592a5adb..65814667 100644 --- a/src/main/java/com/minelittlepony/unicopia/container/SpellbookScreen.java +++ b/src/main/java/com/minelittlepony/unicopia/container/SpellbookScreen.java @@ -180,6 +180,7 @@ public class SpellbookScreen extends HandledScreen imple @Override protected void drawForeground(MatrixStack matrices, int mouseX, int mouseY) { + this.clearAndInit(); chapters.getCurrentChapter().content().ifPresent(content -> content.draw(matrices, mouseX, mouseY, (IViewRoot)this)); } diff --git a/src/main/java/com/minelittlepony/unicopia/entity/player/ExperienceGroup.java b/src/main/java/com/minelittlepony/unicopia/entity/player/ExperienceGroup.java index 1176ae92..0fcb3b67 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/player/ExperienceGroup.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/player/ExperienceGroup.java @@ -3,31 +3,39 @@ package com.minelittlepony.unicopia.entity.player; import net.minecraft.text.Text; import net.minecraft.util.math.MathHelper; -public enum ExperienceGroup { - MAGICAL_KINDERGARTENER, - FRIENDSHIP_STUDENT, - SENIOR_FRIENDSHIP_STUDENT, - JUNIOR_MAGE, - MAGE, - ARCHMAGE, - ARCHMAGUS, - SENIOR_ARCHMAGUS, - ASCENDED_SENIOR_ARCHMAGUS, - DEMI_GOD, - ARCH_DEMI_GOD, - ALICORN_PRINCESS, - POLYCORN_PRINCESS, - FAUSTIAN_LEGEND; +public record ExperienceGroup (String experience, String corruption) { + public static final LinearSelector EXPERIENCES = new LinearSelector<>(new String[] { + "MAGICAL_KINDERGARTENER", + "FRIENDSHIP_STUDENT", + "SENIOR_FRIENDSHIP_STUDENT", + "JUNIOR_MAGE", + "MAGE", + "ARCHMAGE", + "ARCHMAGUS", + "SENIOR_ARCHMAGUS", + "ASCENDED_SENIOR_ARCHMAGUS", + "DEMI_GOD", + "ARCH_DEMI_GOD", + "ALICORN_PRINCESS", + "POLYCORN_PRINCESS", + "FAUSTIAN_LEGEND" + }, 2); + public static final LinearSelector CORRUPTIONS = new LinearSelector<>(new String[] { + "PURE", + "IMPURE", + "TAINTED", + "TWISTED", + "CORRUPT", + "MONSTROUS" + }, 1F/8F); - private final Text label = Text.literal(name().toLowerCase()); - - public Text getLabel() { - return label; + public static Text forLevel(int level, int corruption) { + return Text.of(CORRUPTIONS.get(corruption).toLowerCase() + " " + EXPERIENCES.get(level).toLowerCase()); } - public static ExperienceGroup forLevel(int level) { - level /= 20; - level = MathHelper.clamp(level, 0, values().length - 1); - return values()[level]; + public record LinearSelector (T[] values, float ratio) { + public T get(int level) { + return values()[MathHelper.clamp(MathHelper.floor(MathHelper.sqrt(level * ratio())), 0, values().length - 1)]; + } } }