improve building list format

master
agp8x 2023-04-10 00:12:55 +02:00
parent 9f5ecdee8a
commit c4cf7c9ec9
2 changed files with 9 additions and 3 deletions

View File

@ -247,8 +247,14 @@ public class Recipe {
public String getName() { public String getName() {
return name; return name;
} }
public String formatName(){
if (name == null) {
return formatOutputs();
}
return name + " (" + formatOutputs() + ")";
}
public String getOutputs() { public String formatOutputs() {
return outputs.keySet().stream().map(Item::getName).collect(Collectors.joining(" + ")); return outputs.keySet().stream().map(Item::getName).collect(Collectors.joining(" + "));
} }
} }

View File

@ -102,9 +102,9 @@ public class SumResult {
StringBuilder internal = new StringBuilder(); StringBuilder internal = new StringBuilder();
for (Map.Entry<Recipe, Double> recipes : entry.getValue().entrySet()) { for (Map.Entry<Recipe, Double> recipes : entry.getValue().entrySet()) {
sum += Math.ceil(recipes.getValue()); sum += Math.ceil(recipes.getValue());
internal.append("\t").append(recipes.getKey().getName()).append(" (").append(recipes.getKey().getOutputs()).append(")\t").append(recipes.getValue()).append("\n"); internal.append("\t").append(recipes.getKey().formatName()).append("\t").append(recipes.getValue()).append("\n");
} }
sb.append(entry.getKey().getName().replace("satisfactory.buildings.production.","")). append("\t"). append(sum).append("\n").append(internal); sb.append(entry.getKey().getName()). append("\t"). append(sum).append("\n").append(internal);
} }
return sb.toString(); return sb.toString();
} }