Skip to content

Commit

Permalink
refactor: minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed Aug 30, 2024
1 parent 695db43 commit 6910a76
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package net.blay09.mods.trashslot.client;

import com.google.common.collect.Lists;
import net.blay09.mods.balm.mixin.AbstractContainerScreenAccessor;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;

import java.util.List;
import java.util.Optional;

public class Hint {
Expand All @@ -22,11 +22,12 @@ public Hint(String id, Component message, int timeToDisplay) {
}

public void render(Screen screen, GuiGraphics guiGraphics) {
final var font = Minecraft.getInstance().font;
guiGraphics.renderTooltip(
Minecraft.getInstance().font,
Lists.newArrayList(message),
font,
List.of(message),
Optional.empty(),
((AbstractContainerScreenAccessor) screen).getLeftPos() + ((AbstractContainerScreenAccessor) screen).getImageWidth() / 2 - Minecraft.getInstance().font.width(message) / 2 - 12, ((AbstractContainerScreenAccessor) screen).getTopPos() - 20 + 12);
((AbstractContainerScreenAccessor) screen).getLeftPos() + ((AbstractContainerScreenAccessor) screen).getImageWidth() / 2 - font.width(message) / 2 - 12, ((AbstractContainerScreenAccessor) screen).getTopPos() - 20 + 12);
}

public boolean isComplete() {
Expand Down

0 comments on commit 6910a76

Please sign in to comment.