From 7ba298e162aa04635c73a2b98c5bce9993eb70cd Mon Sep 17 00:00:00 2001 From: Sollace Date: Fri, 2 Sep 2022 20:59:46 +0200 Subject: [PATCH] Change titles to be more consistent --- .../unicopia/container/DynamicContent.java | 6 ++++-- .../unicopia/container/SpellbookCraftingPageContent.java | 9 ++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/container/DynamicContent.java b/src/main/java/com/minelittlepony/unicopia/container/DynamicContent.java index 34257995..9396d894 100644 --- a/src/main/java/com/minelittlepony/unicopia/container/DynamicContent.java +++ b/src/main/java/com/minelittlepony/unicopia/container/DynamicContent.java @@ -140,8 +140,10 @@ public class DynamicContent implements Content { boolean needsMoreXp = level < 0 || Pony.of(MinecraftClient.getInstance().player).getLevel().get() < level; - DrawableUtil.drawScaledText(matrices, needsMoreXp ? UNKNOWN : title, bounds.left, bounds.top - 10, 1.3F, mouseY); - DrawableUtil.drawScaledText(matrices, level < 0 ? UNKNOWN_LEVEL : Text.literal("Level: " + (level + 1)).formatted(Formatting.DARK_GREEN), bounds.left, bounds.top - 10 + 12, 0.8F, mouseY); + int headerColor = mouseY % 255; + + DrawableUtil.drawScaledText(matrices, needsMoreXp ? UNKNOWN : title, bounds.left, bounds.top - 10, 1.3F, headerColor); + DrawableUtil.drawScaledText(matrices, level < 0 ? UNKNOWN_LEVEL : Text.literal("Level: " + (level + 1)).formatted(Formatting.DARK_GREEN), bounds.left, bounds.top - 10 + 12, 0.8F, headerColor); matrices.push(); matrices.translate(bounds.left, bounds.top + 16, 0); diff --git a/src/main/java/com/minelittlepony/unicopia/container/SpellbookCraftingPageContent.java b/src/main/java/com/minelittlepony/unicopia/container/SpellbookCraftingPageContent.java index 4c802df9..136365d9 100644 --- a/src/main/java/com/minelittlepony/unicopia/container/SpellbookCraftingPageContent.java +++ b/src/main/java/com/minelittlepony/unicopia/container/SpellbookCraftingPageContent.java @@ -5,6 +5,7 @@ import com.minelittlepony.common.client.gui.ScrollContainer; import com.minelittlepony.common.client.gui.element.Label; import com.minelittlepony.unicopia.ability.magic.spell.crafting.SpellbookRecipe; import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait; +import com.minelittlepony.unicopia.client.gui.DrawableUtil; import com.minelittlepony.unicopia.container.SpellbookScreen.TraitButton; import com.minelittlepony.unicopia.item.URecipes; import com.mojang.blaze3d.systems.RenderSystem; @@ -37,11 +38,13 @@ public class SpellbookCraftingPageContent extends ScrollContainer implements Spe @Override public void draw(MatrixStack matrices, int mouseX, int mouseY, IViewRoot container) { - textRenderer.draw(matrices, screen.getTitle(), SpellbookScreen.TITLE_X, SpellbookScreen.TITLE_Y, SpellbookScreen.TITLE_COLOR); - textRenderer.draw(matrices, SpellbookPage.getCurrent().getLabel(), screen.getBackgroundWidth() / 2 + SpellbookScreen.TITLE_X, SpellbookScreen.TITLE_Y, SpellbookScreen.TITLE_COLOR); + + int headerColor = mouseY % 255; + + DrawableUtil.drawScaledText(matrices, SpellbookPage.getCurrent().getLabel(), screen.getFrameBounds().left + screen.getFrameBounds().width / 2 + 20, SpellbookScreen.TITLE_Y, 1.3F, headerColor); Text pageText = Text.translatable("%s/%s", SpellbookPage.getCurrent().ordinal() + 1, SpellbookPage.VALUES.length); - textRenderer.draw(matrices, pageText, 337 - textRenderer.getWidth(pageText) / 2F, 190, SpellbookScreen.TITLE_COLOR); + textRenderer.draw(matrices, pageText, 337 - textRenderer.getWidth(pageText) / 2F, 190, headerColor); } @Override