Skip to content

Commit

Permalink
fix MEInputHatch not showing tooltip (#1993)
Browse files Browse the repository at this point in the history
  • Loading branch information
EasterFG authored Sep 22, 2024
1 parent 32397c0 commit 04e90ef
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,34 @@ public AEConfigSlotWidget(Position pos, Size size, ConfigWidget widget, int inde
public void drawInForeground(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) {
super.drawInForeground(graphics, mouseX, mouseY, partialTicks);
IConfigurableSlot slot = this.parentWidget.getDisplay(this.index);
if (slot.getConfig() == null && mouseOverConfig(mouseX, mouseY)) {
List<Component> hoverStringList = new ArrayList<>();
hoverStringList.add(Component.translatable("gtceu.gui.config_slot"));
if (parentWidget.isAutoPull()) {
hoverStringList.add(Component.translatable("gtceu.gui.config_slot.auto_pull_managed"));
} else {
if (!parentWidget.isStocking()) {
hoverStringList.add(Component.translatable("gtceu.gui.config_slot.set"));
hoverStringList.add(Component.translatable("gtceu.gui.config_slot.scroll"));
if (slot.getConfig() == null) {
if (mouseOverConfig(mouseX, mouseY)) {
List<Component> hoverStringList = new ArrayList<>();
hoverStringList.add(Component.translatable("gtceu.gui.config_slot"));
if (parentWidget.isAutoPull()) {
hoverStringList.add(Component.translatable("gtceu.gui.config_slot.auto_pull_managed"));
} else {
hoverStringList.add(Component.translatable("gtceu.gui.config_slot.set_only"));
if (!parentWidget.isStocking()) {
hoverStringList.add(Component.translatable("gtceu.gui.config_slot.set"));
hoverStringList.add(Component.translatable("gtceu.gui.config_slot.scroll"));
} else {
hoverStringList.add(Component.translatable("gtceu.gui.config_slot.set_only"));
}
hoverStringList.add(Component.translatable("gtceu.gui.config_slot.remove"));
}
hoverStringList.add(Component.translatable("gtceu.gui.config_slot.remove"));
graphics.renderTooltip(Minecraft.getInstance().font, hoverStringList, Optional.empty(), mouseX, mouseY);
}
} else {
GenericStack item = null;
if (mouseOverConfig(mouseX, mouseY)) {
item = slot.getConfig();
} else if (mouseOverStock(mouseX, mouseY)) {
item = slot.getStock();
}
if (item != null) {
graphics.renderTooltip(Minecraft.getInstance().font, GenericStack.wrapInItemStack(item), mouseX,
mouseY);
}
graphics.renderTooltip(Minecraft.getInstance().font, hoverStringList, Optional.empty(), mouseX, mouseY);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import com.lowdragmc.lowdraglib.utils.Position;
import com.lowdragmc.lowdraglib.utils.Size;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.Rect2i;
import net.minecraft.network.FriendlyByteBuf;
Expand Down Expand Up @@ -88,22 +87,6 @@ private void drawSlots(GuiGraphics graphics, int mouseX, int mouseY, int x, int
GuiTextures.SLOT_DARK.draw(graphics, mouseX, mouseY, x, y + 18, 18, 18);
}

@OnlyIn(Dist.CLIENT)
@Override
public void drawInForeground(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) {
super.drawInForeground(graphics, mouseX, mouseY, partialTicks);
GenericStack item = null;
IConfigurableSlot slot = this.parentWidget.getDisplay(this.index);
if (mouseOverConfig(mouseX, mouseY)) {
item = slot.getConfig();
} else if (mouseOverStock(mouseX, mouseY)) {
item = slot.getStock();
}
if (item != null) {
graphics.renderTooltip(Minecraft.getInstance().font, GenericStack.wrapInItemStack(item), mouseX, mouseY);
}
}

@OnlyIn(Dist.CLIENT)
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
Expand Down

0 comments on commit 04e90ef

Please sign in to comment.