mirror of
https://github.com/Ellpeck/PrettyPipes.git
synced 2024-11-22 11:53:29 +01:00
some GUI fixes
This commit is contained in:
parent
ad9f228ba4
commit
c8c0db6aa9
7 changed files with 17 additions and 17 deletions
|
@ -90,7 +90,7 @@ public class JEIPrettyPipesPlugin implements IModPlugin {
|
||||||
return;
|
return;
|
||||||
var sync = PlayerPrefs.get().syncJei;
|
var sync = PlayerPrefs.get().syncJei;
|
||||||
if (event instanceof ScreenEvent.Render.Post) {
|
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());
|
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) {
|
} else if (event instanceof ScreenEvent.Render.Pre) {
|
||||||
this.jeiSyncButton.setMessage(Component.literal((sync ? ChatFormatting.GREEN : ChatFormatting.RED) + "J"));
|
this.jeiSyncButton.setMessage(Component.literal((sync ? ChatFormatting.GREEN : ChatFormatting.RED) + "J"));
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class ItemTerminalWidget extends AbstractWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderToolTip(GuiGraphics graphics, int mouseX, int mouseY) {
|
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);
|
var tooltip = Screen.getTooltipFromItem(this.screen.getMinecraft(), this.stack);
|
||||||
if (this.stack.getCount() >= 1000) {
|
if (this.stack.getCount() >= 1000) {
|
||||||
var comp = tooltip.get(0);
|
var comp = tooltip.get(0);
|
||||||
|
|
|
@ -68,8 +68,8 @@ public abstract class AbstractPipeGui<T extends AbstractPipeContainer<?>> extend
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderLabels(GuiGraphics graphics, int mouseX, int mouseY) {
|
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.playerInventoryTitle.getString(), 8, this.imageHeight - 96 + 2, 4210752, false);
|
||||||
graphics.drawString(this.font, this.title.getString(), 8, 6 + 32, 4210752);
|
graphics.drawString(this.font, this.title.getString(), 8, 6 + 32, 4210752, false);
|
||||||
for (var tab : this.tabs)
|
for (var tab : this.tabs)
|
||||||
tab.drawForeground(graphics, mouseX, mouseY);
|
tab.drawForeground(graphics, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class FilterModifierModuleGui extends AbstractPipeGui<FilterModifierModul
|
||||||
color = 0xFFFFFF;
|
color = 0xFFFFFF;
|
||||||
if (this.tag.equals(FilterModifierModuleItem.getFilterTag(FilterModifierModuleGui.this.menu.moduleStack)))
|
if (this.tag.equals(FilterModifierModuleItem.getFilterTag(FilterModifierModuleGui.this.menu.moduleStack)))
|
||||||
text = ChatFormatting.BOLD + text;
|
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.setShader(GameRenderer::getPositionTexShader);
|
||||||
RenderSystem.setShaderTexture(0, AbstractPipeGui.TEXTURE);
|
RenderSystem.setShaderTexture(0, AbstractPipeGui.TEXTURE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class StackSizeModuleGui extends AbstractPipeGui<StackSizeModuleContainer
|
||||||
@Override
|
@Override
|
||||||
protected void renderLabels(GuiGraphics graphics, int mouseX, int mouseY) {
|
protected void renderLabels(GuiGraphics graphics, int mouseX, int mouseY) {
|
||||||
super.renderLabels(graphics, mouseX, 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);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,8 @@ public class PressurizerGui extends AbstractContainerScreen<PressurizerContainer
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderLabels(GuiGraphics graphics, int mouseX, int mouseY) {
|
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.playerInventoryTitle.getString(), 8, this.imageHeight - 96 + 2, 4210752, false);
|
||||||
graphics.drawString(this.font, this.title.getString(), 8, 6, 4210752);
|
graphics.drawString(this.font, this.title.getString(), 8, 6, 4210752, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -158,7 +158,7 @@ public class ItemTerminalGui extends AbstractContainerScreen<ItemTerminalContain
|
||||||
public boolean mouseReleased(double mouseX, double mouseY, int button) {
|
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
|
// 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
|
// 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()) {
|
if (this.currentlyCrafting != null && !this.currentlyCrafting.isEmpty()) {
|
||||||
PacketHandler.sendToServer(new PacketButton(this.menu.tile.getBlockPos(), PacketButton.ButtonResult.CANCEL_CRAFTING));
|
PacketHandler.sendToServer(new PacketButton(this.menu.tile.getBlockPos(), PacketButton.ButtonResult.CANCEL_CRAFTING));
|
||||||
return true;
|
return true;
|
||||||
|
@ -276,12 +276,12 @@ public class ItemTerminalGui extends AbstractContainerScreen<ItemTerminalContain
|
||||||
}
|
}
|
||||||
if (this.sortedItems != null) {
|
if (this.sortedItems != null) {
|
||||||
var prefs = PlayerPrefs.get();
|
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);
|
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);
|
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");
|
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);
|
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
|
@Override
|
||||||
protected void renderLabels(GuiGraphics graphics, int mouseX, int mouseY) {
|
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.playerInventoryTitle.getString(), 8 + this.getXOffset(), this.imageHeight - 96 + 2, 4210752, false);
|
||||||
graphics.drawString(this.font, this.title.getString(), 8, 6, 4210752);
|
graphics.drawString(this.font, this.title.getString(), 8, 6, 4210752, false);
|
||||||
|
|
||||||
var amount = String.valueOf(this.requestAmount);
|
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()) {
|
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)
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue