From c0fa0ae806946aad8500336d7c7916e727744cbd Mon Sep 17 00:00:00 2001 From: Sollace Date: Sat, 3 Jun 2023 14:02:07 +0100 Subject: [PATCH] Fix some rendering bugs with the spellbook --- .../gui/spellbook/SpellbookCraftingPageContent.java | 8 +++----- .../unicopia/client/gui/spellbook/SpellbookScreen.java | 4 +--- .../gui/spellbook/SpellbookTraitDexPageContent.java | 9 +++------ 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/SpellbookCraftingPageContent.java b/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/SpellbookCraftingPageContent.java index e2be6444..6ca19c38 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/SpellbookCraftingPageContent.java +++ b/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/SpellbookCraftingPageContent.java @@ -70,17 +70,15 @@ public class SpellbookCraftingPageContent extends ScrollContainer implements Spe getContentPadding().bottom = 30; if (state.getOffset() == 1) { - // TODO: Kirin's scrollbars in 1.19.4 are kind of jank - final int fixForPositionalBug = 10; - int top = 0 + fixForPositionalBug; + int top = 0; for (SpellbookRecipe recipe : this.client.world.getRecipeManager().listAllOfType(URecipes.SPELLBOOK)) { if (client.player.getRecipeBook().contains(recipe)) { - IngredientTree tree = new IngredientTree(-fixForPositionalBug, top, width - verticalScrollbar.getBounds().width + 2); + IngredientTree tree = new IngredientTree(0, top, width - verticalScrollbar.getBounds().width + 2); recipe.buildCraftingTree(tree); top += tree.build(this); } } - if (top == 0 + fixForPositionalBug) { + if (top == 0) { addButton(new Label(width / 2, 0).setCentered()).getStyle().setText("gui.unicopia.spellbook.page.recipes.empty"); } } diff --git a/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/SpellbookScreen.java b/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/SpellbookScreen.java index 3419e79b..b8ca5d9e 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/SpellbookScreen.java +++ b/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/SpellbookScreen.java @@ -170,9 +170,7 @@ public class SpellbookScreen extends HandledScreen imple context.drawTexture(TEXTURE, bounds.left, bounds.top, isRight ? 510 - bounds.width : 402, v, bounds.width, bounds.height, 512, 256); RenderSystem.setShaderColor(1, 1, 1, 1); - RenderSystem.setShaderTexture(0, tab.icon().get()); - context.drawTexture(TEXTURE, isRight ? bounds.left + bounds.width - 16 - 10 : bounds.left + 10, bounds.top + (bounds.height - 16) / 2, 0, 0, 16, 16, 16, 16); - RenderSystem.setShaderTexture(0, TEXTURE); + context.drawTexture(tab.icon().get(), isRight ? bounds.left + bounds.width - 16 - 10 : bounds.left + 10, bounds.top + (bounds.height - 16) / 2, 0, 0, 16, 16, 16, 16); }); MatrixStack matrices = context.getMatrices(); diff --git a/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/SpellbookTraitDexPageContent.java b/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/SpellbookTraitDexPageContent.java index 8276e4a1..368ddaec 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/SpellbookTraitDexPageContent.java +++ b/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/SpellbookTraitDexPageContent.java @@ -114,16 +114,13 @@ public class SpellbookTraitDexPageContent implements SpellbookChapterList.Conten boolean known = Pony.of(MinecraftClient.getInstance().player).getDiscoveries().isKnown(trait); - // TODO: Kirin's scrollbars in 1.19.4 are kind of jank - final int fixForPositionalBug = 8; - - addButton(new TraitButton(width / 2 - 8 - fixForPositionalBug, 8 + fixForPositionalBug, trait)); - addButton(new Label(width / 2 - fixForPositionalBug, 26 + fixForPositionalBug).setCentered()) + addButton(new TraitButton(width / 2 - 8, 8, trait)); + addButton(new Label(width / 2, 26).setCentered()) .getStyle() .setText(known ? Text.translatable("gui.unicopia.trait.label", Text.translatable("trait." + trait.getId().getNamespace() + "." + trait.getId().getPath() + ".name") ) : Text.literal("???")); - IngredientTree tree = new IngredientTree(-fixForPositionalBug, 50 + fixForPositionalBug, width + 18).noLabels(); + IngredientTree tree = new IngredientTree(0, 50, width + 18).noLabels(); List knownItems = Pony.of(MinecraftClient.getInstance().player).getDiscoveries().getKnownItems(trait).toList(); SpellTraits.getItems(trait)