Show build cost even in sandbox (#7814)

This commit is contained in:
MEEPofFaith
2022-11-03 20:27:46 -07:00
committed by GitHub
parent 3a0f4409fc
commit 36a7e98f86

View File

@@ -370,10 +370,10 @@ public class PlacementFragment{
line.add(stack.item.localizedName).maxWidth(140f).fillX().color(Color.lightGray).padLeft(2).left().get().setEllipsis(true);
line.labelWrap(() -> {
Building core = player.core();
if(core == null || state.rules.infiniteResources) return "*/*";
int stackamount = Math.round(stack.amount * state.rules.buildCostMultiplier);
if(core == null || state.rules.infiniteResources) return "*/" + stackamount;
int amount = core.items.get(stack.item);
int stackamount = Math.round(stack.amount * state.rules.buildCostMultiplier);
String color = (amount < stackamount / 2f ? "[scarlet]" : amount < stackamount ? "[accent]" : "[white]");
return color + UI.formatAmount(amount) + "[white]/" + stackamount;