Fixed position of furnace auto split button.

Fixed rendering of Furnace and Crusher auto split tooltips.
This commit is contained in:
Flanks255 2024-03-16 17:25:03 -05:00
parent 8104cc4be2
commit bfaf90b42c
2 changed files with 5 additions and 8 deletions

View file

@ -53,7 +53,8 @@ public class CrusherScreen extends AAScreen<CrusherContainer> {
if (this.isDouble) { if (this.isDouble) {
this.buttonAutoSplit = Button.builder(Component.literal("S"), (button) -> actionPerformed(0)) this.buttonAutoSplit = Button.builder(Component.literal("S"), (button) -> actionPerformed(0))
.bounds(this.leftPos - 10, this.topPos, 16, 16).build(); .bounds(this.leftPos - 10, this.topPos, 16, 16)
.build();
this.addRenderableWidget(this.buttonAutoSplit); this.addRenderableWidget(this.buttonAutoSplit);
} }
@ -84,7 +85,7 @@ public class CrusherScreen extends AAScreen<CrusherContainer> {
this.energy.render(guiGraphics, x, y); this.energy.render(guiGraphics, x, y);
if (this.isDouble && this.buttonAutoSplit.isMouseOver(x,y)) { if (this.isDouble && this.buttonAutoSplit.isMouseOver(x,y)) {
guiGraphics.drawString(font, Component.translatable("info.actuallyadditions.gui.autosplititems." + (tileGrinder.isAutoSplit?"on":"off")).withStyle(ChatFormatting.BOLD), x , y, 0xffffff); guiGraphics.renderTooltip(font, Component.translatable("info.actuallyadditions.gui.autosplititems." + (tileGrinder.isAutoSplit?"on":"off")), x, y);
} }
} }

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFurnaceDouble; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFurnaceDouble;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPoweredFurnace; import de.ellpeck.actuallyadditions.mod.tile.TileEntityPoweredFurnace;
@ -26,7 +25,6 @@ import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn; import net.neoforged.api.distmarker.OnlyIn;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.Collections;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiFurnaceDouble extends AAScreen<ContainerFurnaceDouble> { public class GuiFurnaceDouble extends AAScreen<ContainerFurnaceDouble> {
@ -50,9 +48,7 @@ public class GuiFurnaceDouble extends AAScreen<ContainerFurnaceDouble> {
this.energy.render(guiGraphics, x, y); this.energy.render(guiGraphics, x, y);
if (this.buttonAutoSplit.isMouseOver(x, y)) { if (this.buttonAutoSplit.isMouseOver(x, y)) {
guiGraphics.renderComponentTooltip(font, Collections.singletonList(this.tileFurnace.isAutoSplit guiGraphics.renderTooltip(font, Component.translatable("info.actuallyadditions.gui.autosplititems." + (tileFurnace.isAutoSplit?"on":"off")), x, y);
? Component.translatable("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.on").withStyle(ChatFormatting.BOLD)
: Component.translatable("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.off").withStyle(ChatFormatting.BOLD)), x, y);
} }
} }
@ -61,7 +57,7 @@ public class GuiFurnaceDouble extends AAScreen<ContainerFurnaceDouble> {
super.init(); super.init();
this.energy = new EnergyDisplay(this.leftPos + 27, this.topPos + 5, this.tileFurnace.storage); this.energy = new EnergyDisplay(this.leftPos + 27, this.topPos + 5, this.tileFurnace.storage);
this.buttonAutoSplit = Button.builder(Component.literal("S"), (button) -> PacketHandlerHelper.sendButtonPacket(this.tileFurnace, 0)) this.buttonAutoSplit = Button.builder(Component.literal("S"), (button) -> PacketHandlerHelper.sendButtonPacket(this.tileFurnace, 0))
.bounds(this.getGuiLeft(), 30, 16, 16).build(); .bounds(this.getGuiLeft(), this.topPos + 5, 16, 16).build();
buttonAutoSplit.setFGColor(this.tileFurnace.isAutoSplit ? ChatFormatting.DARK_GREEN.getColor() : ChatFormatting.RED.getColor()); buttonAutoSplit.setFGColor(this.tileFurnace.isAutoSplit ? ChatFormatting.DARK_GREEN.getColor() : ChatFormatting.RED.getColor());
this.addRenderableWidget(this.buttonAutoSplit); this.addRenderableWidget(this.buttonAutoSplit);
} }