Skip to content

Commit

Permalink
fix: tooltips wouldn't render
Browse files Browse the repository at this point in the history
There's something overlapping with the text that hides tabs' titles.
So rendering the tooltip as the last step fixes the issue
  • Loading branch information
voidpointer0x00 committed Jun 1, 2024
1 parent c2a6997 commit 2ec94c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
import net.minecraft.ChatFormatting;
import net.minecraft.Util;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.Button;
Expand All @@ -15,7 +14,6 @@
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.advancements.AdvancementsScreen;
import net.minecraft.client.gui.screens.inventory.InventoryScreen;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.network.chat.CommonComponents;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.LivingEntity;
Expand All @@ -37,6 +35,7 @@
import java.util.List;
import java.util.concurrent.CompletableFuture;

import static net.minecraft.ChatFormatting.WHITE;
import static org.samo_lego.fabrictailor.client.ClientTailor.ALLOW_DEFAULT_SKIN;
import static org.samo_lego.fabrictailor.client.ClientTailor.TAILORED_SERVER;

Expand Down Expand Up @@ -99,7 +98,7 @@ protected void init() {
this.skinModelCheckbox.visible = false;

// Text field input
skinInput = new EditBox(this.font, width / 2, height / 2 - 29, BUTTON_WIDTH, 14, Component.translatable("itemGroup.search").withStyle(ChatFormatting.WHITE));
skinInput = new EditBox(this.font, width / 2, height / 2 - 29, BUTTON_WIDTH, 14, Component.translatable("itemGroup.search").withStyle(WHITE));
skinInput.setMaxLength(256);
skinInput.setVisible(true);
skinInput.setBordered(true);
Expand Down Expand Up @@ -227,7 +226,6 @@ public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float delta)
// Other renders
this.drawTabs(guiGraphics, startX, startY);
this.drawIcons(guiGraphics, startX, startY);
this.drawWidgetTooltips(guiGraphics, startX, startY, mouseX, mouseY);


if (this.selectedTab.showModelBackwards()) {
Expand All @@ -248,6 +246,9 @@ public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float delta)
int y = this.startY - 76;
InventoryScreen.renderEntityInInventoryFollowsMouse(guiGraphics, x, y, x + 75, y + 208, 48, 1.0f, mouseX + 2, mouseY - 16, this.minecraft.player);
}

// draw last to fix some overlapping issue that would hide text
this.drawWidgetTooltips(guiGraphics, startX, startY, mouseX, mouseY);
}

public void renderEntityInInventoryFollowsMouseBackwards(GuiGraphics guiGraphics, int i, int j, int k, int l, int m, float f, float g, float h, LivingEntity livingEntity) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import org.samo_lego.fabrictailor.util.TextTranslations;

import javax.imageio.ImageIO;
import java.awt.image.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
Expand Down

0 comments on commit 2ec94c9

Please sign in to comment.