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:
ineternet
2018-01-28 10:28:59 +01:00
committed by Raoul
parent 7365964216
commit 07628a5872
2 changed files with 6 additions and 1 deletions

View File

@@ -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