mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 08:48:34 +01:00
Make getOverlayText return a Component in FluidDisplay
This commit is contained in:
parent
83828a6def
commit
4a36c696ab
1 changed files with 5 additions and 5 deletions
|
@ -110,7 +110,7 @@ public class FluidDisplay {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.drawTextNextTo) {
|
if (this.drawTextNextTo) {
|
||||||
guiGraphics.drawString(mc.font, Component.literal(this.getOverlayText()), barX + 25, barY + 78, 0xFFFFFF, false);
|
guiGraphics.drawString(mc.font, this.getOverlayText(), barX + 25, barY + 78, 0xFFFFFF, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,17 +121,17 @@ public class FluidDisplay {
|
||||||
? 93
|
? 93
|
||||||
: 85)) {
|
: 85)) {
|
||||||
Minecraft mc = Minecraft.getInstance();
|
Minecraft mc = Minecraft.getInstance();
|
||||||
guiGraphics.renderComponentTooltip(mc.font, Collections.singletonList(Component.literal(this.getOverlayText())), mouseX, mouseY); //TODO: Check if this is correct, used to call GuiUtils.drawHoveringText
|
guiGraphics.renderComponentTooltip(mc.font, Collections.singletonList(this.getOverlayText()), mouseX, mouseY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getOverlayText() {
|
private Component getOverlayText() {
|
||||||
NumberFormat format = NumberFormat.getInstance();
|
NumberFormat format = NumberFormat.getInstance();
|
||||||
FluidStack stack = this.fluidReference.getFluid();
|
FluidStack stack = this.fluidReference.getFluid();
|
||||||
String cap = format.format(this.fluidReference.getCapacity());
|
String cap = format.format(this.fluidReference.getCapacity());
|
||||||
return stack.isEmpty()
|
return stack.isEmpty()
|
||||||
? "0/" + cap + " mB"
|
? Component.literal("0/" + cap + " mB")
|
||||||
: format.format(this.fluidReference.getFluidAmount()) + (drawCapacityInTooltip?"/" + cap + " mB ":" mB ") + stack.getDisplayName().getString();
|
: Component.literal(format.format(this.fluidReference.getFluidAmount()) + (drawCapacityInTooltip?"/" + cap + " mB ":" mB ")).append(stack.getDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class DummyTank implements IFluidTank {
|
public static class DummyTank implements IFluidTank {
|
||||||
|
|
Loading…
Reference in a new issue