some GUI fixes

This commit is contained in:
Ell 2023-07-07 20:44:52 +02:00
parent ad9f228ba4
commit c8c0db6aa9
7 changed files with 17 additions and 17 deletions

View file

@ -90,7 +90,7 @@ public class JEIPrettyPipesPlugin implements IModPlugin {
return;
var sync = PlayerPrefs.get().syncJei;
if (event instanceof ScreenEvent.Render.Post) {
if (this.jeiSyncButton.isHoveredOrFocused())
if (this.jeiSyncButton.isHovered())
event.getGuiGraphics().renderTooltip(terminal.getMinecraft().font, Component.translatable("info." + PrettyPipes.ID + ".sync_jei." + (sync ? "on" : "off")), event.getMouseX(), event.getMouseY());
} else if (event instanceof ScreenEvent.Render.Pre) {
this.jeiSyncButton.setMessage(Component.literal((sync ? ChatFormatting.GREEN : ChatFormatting.RED) + "J"));

View file

@ -61,7 +61,7 @@ public class ItemTerminalWidget extends AbstractWidget {
}
public void renderToolTip(GuiGraphics graphics, int mouseX, int mouseY) {
if (this.visible && this.isHoveredOrFocused()) {
if (this.visible && this.isHovered()) {
var tooltip = Screen.getTooltipFromItem(this.screen.getMinecraft(), this.stack);
if (this.stack.getCount() >= 1000) {
var comp = tooltip.get(0);

View file

@ -68,8 +68,8 @@ public abstract class AbstractPipeGui<T extends AbstractPipeContainer<?>> extend
@Override
protected void renderLabels(GuiGraphics graphics, int mouseX, int mouseY) {
graphics.drawString(this.font, this.playerInventoryTitle.getString(), 8, this.imageHeight - 96 + 2, 4210752);
graphics.drawString(this.font, this.title.getString(), 8, 6 + 32, 4210752);
graphics.drawString(this.font, this.playerInventoryTitle.getString(), 8, this.imageHeight - 96 + 2, 4210752, false);
graphics.drawString(this.font, this.title.getString(), 8, 6 + 32, 4210752, false);
for (var tab : this.tabs)
tab.drawForeground(graphics, mouseX, mouseY);
}

View file

@ -124,7 +124,7 @@ public class FilterModifierModuleGui extends AbstractPipeGui<FilterModifierModul
color = 0xFFFFFF;
if (this.tag.equals(FilterModifierModuleItem.getFilterTag(FilterModifierModuleGui.this.menu.moduleStack)))
text = ChatFormatting.BOLD + text;
graphics.drawString(FilterModifierModuleGui.this.font, text, this.x, this.y, color);
graphics.drawString(FilterModifierModuleGui.this.font, text, this.x, this.y, color, false);
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, AbstractPipeGui.TEXTURE);
}

View file

@ -52,7 +52,7 @@ public class StackSizeModuleGui extends AbstractPipeGui<StackSizeModuleContainer
@Override
protected void renderLabels(GuiGraphics graphics, int mouseX, int mouseY) {
super.renderLabels(graphics, mouseX, mouseY);
graphics.drawString(this.font, I18n.get("info." + PrettyPipes.ID + ".max_stack_size") + ":", 7, 17 + 32, 4210752);
graphics.drawString(this.font, I18n.get("info." + PrettyPipes.ID + ".max_stack_size") + ":", 7, 17 + 32, 4210752, false);
}
}

View file

@ -28,8 +28,8 @@ public class PressurizerGui extends AbstractContainerScreen<PressurizerContainer
@Override
protected void renderLabels(GuiGraphics graphics, int mouseX, int mouseY) {
graphics.drawString(this.font, this.playerInventoryTitle.getString(), 8, this.imageHeight - 96 + 2, 4210752);
graphics.drawString(this.font, this.title.getString(), 8, 6, 4210752);
graphics.drawString(this.font, this.playerInventoryTitle.getString(), 8, this.imageHeight - 96 + 2, 4210752, false);
graphics.drawString(this.font, this.title.getString(), 8, 6, 4210752, false);
}
@Override

View file

@ -158,7 +158,7 @@ public class ItemTerminalGui extends AbstractContainerScreen<ItemTerminalContain
public boolean mouseReleased(double mouseX, double mouseY, int button) {
// we have to do the click logic here because JEI is activated when letting go of the mouse button
// and vanilla buttons are activated when the click starts, so we'll always invoke jei accidentally by default
if (button == 0 && this.cancelCraftingButton.visible && this.cancelCraftingButton.isHoveredOrFocused()) {
if (button == 0 && this.cancelCraftingButton.visible && this.cancelCraftingButton.isHovered()) {
if (this.currentlyCrafting != null && !this.currentlyCrafting.isEmpty()) {
PacketHandler.sendToServer(new PacketButton(this.menu.tile.getBlockPos(), PacketButton.ButtonResult.CANCEL_CRAFTING));
return true;
@ -276,12 +276,12 @@ public class ItemTerminalGui extends AbstractContainerScreen<ItemTerminalContain
}
if (this.sortedItems != null) {
var prefs = PlayerPrefs.get();
if (this.orderButton.isHoveredOrFocused())
if (this.orderButton.isHovered())
graphics.renderTooltip(this.font, Component.translatable("info." + PrettyPipes.ID + ".order", I18n.get("info." + PrettyPipes.ID + ".order." + prefs.terminalItemOrder.name().toLowerCase(Locale.ROOT))), mouseX, mouseY);
if (this.ascendingButton.isHoveredOrFocused())
if (this.ascendingButton.isHovered())
graphics.renderTooltip(this.font, Component.translatable("info." + PrettyPipes.ID + "." + (prefs.terminalAscending ? "ascending" : "descending")), mouseX, mouseY);
}
if (this.cancelCraftingButton.visible && this.cancelCraftingButton.isHoveredOrFocused()) {
if (this.cancelCraftingButton.visible && this.cancelCraftingButton.isHovered()) {
var tooltip = I18n.get("info." + PrettyPipes.ID + ".cancel_all.desc").split("\n");
graphics.renderTooltip(this.font, Arrays.stream(tooltip).map(Component::literal).collect(Collectors.toList()), Optional.empty(), mouseX, mouseY);
}
@ -293,16 +293,16 @@ public class ItemTerminalGui extends AbstractContainerScreen<ItemTerminalContain
@Override
protected void renderLabels(GuiGraphics graphics, int mouseX, int mouseY) {
graphics.drawString(this.font, this.playerInventoryTitle.getString(), 8 + this.getXOffset(), this.imageHeight - 96 + 2, 4210752);
graphics.drawString(this.font, this.title.getString(), 8, 6, 4210752);
graphics.drawString(this.font, this.playerInventoryTitle.getString(), 8 + this.getXOffset(), this.imageHeight - 96 + 2, 4210752, false);
graphics.drawString(this.font, this.title.getString(), 8, 6, 4210752, false);
var amount = String.valueOf(this.requestAmount);
graphics.drawString(this.font, amount, (176 + 15 - this.font.width(amount)) / 2 - 7 + this.getXOffset(), 106, 4210752);
graphics.drawString(this.font, amount, (176 + 15 - this.font.width(amount)) / 2 - 7 + this.getXOffset(), 106, 4210752, false);
if (this.currentlyCrafting != null && !this.currentlyCrafting.isEmpty()) {
graphics.drawString(this.font, I18n.get("info." + PrettyPipes.ID + ".crafting"), this.imageWidth + 4, 4 + 6, 4210752);
graphics.drawString(this.font, I18n.get("info." + PrettyPipes.ID + ".crafting"), this.imageWidth + 4, 4 + 6, 4210752, false);
if (this.currentlyCrafting.size() > 6)
graphics.drawString(this.font, ". . .", this.imageWidth + 24, 4 + 51, 4210752);
graphics.drawString(this.font, ". . .", this.imageWidth + 24, 4 + 51, 4210752, false);
}
}