Improve small text tooltip function.

This commit is contained in:
raoulvdberge
2018-07-27 13:13:18 +02:00
parent 4a89945d6a
commit 2fe3e54a90
2 changed files with 6 additions and 9 deletions

View File

@@ -42,7 +42,6 @@ public final class RS {
return new ItemStack(RSItems.STORAGE_HOUSING); return new ItemStack(RSItems.STORAGE_HOUSING);
} }
}; };
public final CreativeTabs coversTab = new CreativeTabs(ID + ".covers") { public final CreativeTabs coversTab = new CreativeTabs(ID + ".covers") {
@Override @Override
public ItemStack getTabIconItem() { public ItemStack getTabIconItem() {

View File

@@ -286,14 +286,6 @@ public final class RenderUtils {
// Copied with some tweaks from GuiUtils#drawHoveringText(@Nonnull final ItemStack stack, List<String> textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, FontRenderer font) // Copied with some tweaks from GuiUtils#drawHoveringText(@Nonnull final ItemStack stack, List<String> textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, FontRenderer font)
public static void drawTooltipWithSmallText(List<String> textLines, List<String> smallTextLines, boolean showSmallText, @Nonnull ItemStack stack, int mouseX, int mouseY, int screenWidth, int screenHeight, FontRenderer fontRenderer) { public static void drawTooltipWithSmallText(List<String> textLines, List<String> smallTextLines, boolean showSmallText, @Nonnull ItemStack stack, int mouseX, int mouseY, int screenWidth, int screenHeight, FontRenderer fontRenderer) {
// RS BEGIN
if (showSmallText) {
for (int i = 0; i < smallTextLines.size(); ++i) {
textLines.add("");
}
}
// RS END
if (!textLines.isEmpty()) { if (!textLines.isEmpty()) {
RenderTooltipEvent.Pre event = new RenderTooltipEvent.Pre(stack, textLines, mouseX, mouseY, screenWidth, screenHeight, -1, fontRenderer); RenderTooltipEvent.Pre event = new RenderTooltipEvent.Pre(stack, textLines, mouseX, mouseY, screenWidth, screenHeight, -1, fontRenderer);
if (MinecraftForge.EVENT_BUS.post(event)) { if (MinecraftForge.EVENT_BUS.post(event)) {
@@ -353,6 +345,12 @@ public final class RenderUtils {
} }
} }
// RS BEGIN
if (showSmallText) {
tooltipHeight += smallTextLines.size() * 10;
}
// RS END
if (tooltipY + tooltipHeight + 6 > screenHeight) { if (tooltipY + tooltipHeight + 6 > screenHeight) {
tooltipY = screenHeight - tooltipHeight - 6; tooltipY = screenHeight - tooltipHeight - 6;
} }