Skip to content

Commit 173121d

Browse files
committed
Remove setting the tooltip delay to -1 as now that it is in its own wrapper class, it doesn't cause flickering when updating rapidly
1 parent e9eb3c7 commit 173121d

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/main/java/mekanism/client/gui/element/GuiElement.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.mojang.blaze3d.systems.RenderSystem;
44
import com.mojang.blaze3d.vertex.PoseStack;
5-
import java.time.Duration;
65
import java.util.ArrayList;
76
import java.util.List;
87
import java.util.Optional;
@@ -50,8 +49,6 @@ public abstract class GuiElement extends AbstractWidget implements IFancyFontRen
5049
private static final int BUTTON_TEX_X = 200, BUTTON_TEX_Y = 60, BUTTON_INDIVIDUAL_TEX_Y = BUTTON_TEX_Y / 3;
5150
public static final ResourceLocation WARNING_BACKGROUND_TEXTURE = MekanismUtils.getResource(ResourceType.GUI, "warning_background.png");
5251
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);
5552

5653
public static final Minecraft minecraft = Minecraft.getInstance();
5754

@@ -84,7 +81,6 @@ public GuiElement(IGuiWrapper gui, int x, int y, int width, int height, Componen
8481
this.relativeX = x;
8582
this.relativeY = y;
8683
this.guiObj = gui;
87-
setTooltipDelay(NO_DELAY);
8884
}
8985

9086
@Override
@@ -303,11 +299,9 @@ public void openPinnedWindows() {
303299
public void renderToolTip(@NotNull GuiGraphics guiGraphics, int mouseX, int mouseY) {
304300
updateTooltip(mouseX, mouseY);
305301
//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));
311305
//We do this before child renders so that if one has a tooltip then they can override the target tooltip
312306
for (GuiElement child : children) {
313307
if (child.isMouseOver(mouseX, mouseY)) {

0 commit comments

Comments
 (0)