rework getLoreForQuality() to extract a more generic getStringForQuality()

This commit is contained in:
Sebi
2020-05-08 12:33:51 +02:00
parent d3da0dbe14
commit adaeeed88c
+11 -3
View File
@@ -631,7 +631,15 @@ public class BRecipe {
@Nullable @Nullable
public List<String> getLoreForQuality(int quality) { public List<String> getLoreForQuality(int quality) {
if (lore == null) return null; return getStringForQuality(quality, lore);
}
/**
* Get a quality filtered list of supported attributes
*/
@Nullable
public List<String> getStringForQuality(int quality, List<Tuple<Integer, String>> source) {
if (source == null) return null;
int plus; int plus;
if (quality <= 3) { if (quality <= 3) {
plus = 1; plus = 1;
@@ -640,8 +648,8 @@ public class BRecipe {
} else { } else {
plus = 3; plus = 3;
} }
List<String> list = new ArrayList<>(lore.size()); List<String> list = new ArrayList<>(source.size());
for (Tuple<Integer, String> line : lore) { for (Tuple<Integer, String> line : source) {
if (line.first() == 0 || line.first() == plus) { if (line.first() == 0 || line.first() == plus) {
list.add(line.second()); list.add(line.second());
} }