|
2 | 2 |
|
3 | 3 | import com.mojang.blaze3d.systems.RenderSystem; |
4 | 4 | import com.mojang.blaze3d.vertex.PoseStack; |
5 | | -import java.time.Duration; |
6 | 5 | import java.util.ArrayList; |
7 | 6 | import java.util.List; |
8 | 7 | import java.util.Optional; |
@@ -50,8 +49,6 @@ public abstract class GuiElement extends AbstractWidget implements IFancyFontRen |
50 | 49 | private static final int BUTTON_TEX_X = 200, BUTTON_TEX_Y = 60, BUTTON_INDIVIDUAL_TEX_Y = BUTTON_TEX_Y / 3; |
51 | 50 | public static final ResourceLocation WARNING_BACKGROUND_TEXTURE = MekanismUtils.getResource(ResourceType.GUI, "warning_background.png"); |
52 | 51 | public static final ResourceLocation WARNING_TEXTURE = MekanismUtils.getResource(ResourceType.GUI, "warning.png"); |
53 | | - //Set the delay to -1 so that it appears immediately instead of after a single millisecond |
54 | | - private static final Duration NO_DELAY = Duration.ofMillis(-1); |
55 | 52 |
|
56 | 53 | public static final Minecraft minecraft = Minecraft.getInstance(); |
57 | 54 |
|
@@ -84,7 +81,6 @@ public GuiElement(IGuiWrapper gui, int x, int y, int width, int height, Componen |
84 | 81 | this.relativeX = x; |
85 | 82 | this.relativeY = y; |
86 | 83 | this.guiObj = gui; |
87 | | - setTooltipDelay(NO_DELAY); |
88 | 84 | } |
89 | 85 |
|
90 | 86 | @Override |
@@ -303,11 +299,9 @@ public void openPinnedWindows() { |
303 | 299 | public void renderToolTip(@NotNull GuiGraphics guiGraphics, int mouseX, int mouseY) { |
304 | 300 | updateTooltip(mouseX, mouseY); |
305 | 301 | //If there is a tooltip, update it for the next render pass |
306 | | - //TODO - 1.20.5: Re-evaluate this, maybe we don't want to have the null check so that we mark it as not having been displayed |
307 | | - if (getTooltip() != null) { |
308 | | - //Note: We only call this method if we are hovering the proper spot |
309 | | - tooltip.refreshTooltipForNextRenderPass(true, isFocused(), getTooltipRectangle(mouseX, mouseY)); |
310 | | - } |
| 302 | + // We also call it regardless of whether the backing tooltip is null so that we properly mark wasDisplayed as false |
| 303 | + //Note: We only call this method if we are hovering the proper spot |
| 304 | + tooltip.refreshTooltipForNextRenderPass(true, isFocused(), getTooltipRectangle(mouseX, mouseY)); |
311 | 305 | //We do this before child renders so that if one has a tooltip then they can override the target tooltip |
312 | 306 | for (GuiElement child : children) { |
313 | 307 | if (child.isMouseOver(mouseX, mouseY)) { |
|
0 commit comments