This commit is contained in:
Anuken
2025-02-08 00:07:58 -05:00
parent 49f68be2cb
commit 710895fab5
4 changed files with 31 additions and 6 deletions
@@ -460,14 +460,21 @@ public class StatValues{
}
public static StatValue itemEffMultiplier(Floatf<Item> efficiency, float timePeriod, Boolf<Item> filter){
return itemEffMultiplier(efficiency, timePeriod, filter, null);
}
public static StatValue itemEffMultiplier(Floatf<Item> efficiency, float timePeriod, Boolf<Item> filter, @Nullable ObjectFloatMap<Item> itemDurationMultipliers){
return table -> {
table.getCells().peek().growX(); //Expand the spacer on the row above to push everything to the left
table.row();
table.table(c -> {
for(Item item : content.items().select(i -> filter.get(i) && i.unlockedNow() && !i.isHidden())){
float timeMultiplier = itemDurationMultipliers == null ? 1f : itemDurationMultipliers.get(item, 1f);
float time = 1f / (timePeriod * timeMultiplier / 60f);
c.table(Styles.grayPanel, b -> {
b.image(item.uiIcon).size(40).pad(10f).left().scaling(Scaling.fit);
b.add(item.localizedName + (timePeriod > 0 ? "\n[lightgray]" + Strings.autoFixed(1f / (timePeriod / 60f), 2) + StatUnit.perSecond.localized() : "")).left().grow();
b.add(item.localizedName + (timePeriod > 0 ? "\n[lightgray]" + (time < 0.01f ? Strings.fixed(time, 3) : Strings.autoFixed(time, 2)) + StatUnit.perSecond.localized() : "")).left().grow();
b.add(Core.bundle.format("stat.efficiency", fixValue(efficiency.get(item) * 100f))).right().pad(10f).padRight(15f);
}).growX().pad(5).row();
}