Stop fluid stacks from displaying "0" (#1630)
* Changed display logic of fluid stacks Fluid stacks that contain less than one bucket (999mB or less) of fluid will now display "<1" instead of "0", for aesthetic purposes. * Update CHANGELOG.md * typo fix * Changed to float display
This commit is contained in:
@@ -63,7 +63,11 @@ public class GridStackFluid implements IGridStack {
|
||||
public void draw(GuiBase gui, int x, int y) {
|
||||
GuiBase.FLUID_RENDERER.draw(gui.mc, x, y, stack);
|
||||
|
||||
gui.drawQuantity(x, y, API.instance().getQuantityFormatter().formatWithUnits((int) ((float) stack.amount / 1000F)));
|
||||
float amountRaw = ((float) stack.amount / 1000F);
|
||||
int amount = (int) amountRaw;
|
||||
String formattedAmount = amount >= 1 ? API.instance().getQuantityFormatter().formatWithUnits(amount) : String.format("%.1f", amountRaw);
|
||||
|
||||
gui.drawQuantity(x, y, formattedAmount);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user