Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,7 @@ String toText() {
lore.add(ChatColor.DARK_AQUA + "Fuel: " + ChatColor.GRAY + ItemUtils.getItemName(fccEgg.getFuel().getType()));
lore.add("");
lore.add(ChatColor.GOLD + String.valueOf(fccEgg.getRecipes().size() + " recipes:"));
for (IRecipe rec : fccEgg.getRecipes()) {
if (rec instanceof Upgraderecipe) {
lore.add(ChatColor.GRAY + " - " + ChatColor.GREEN + rec.getName());
} else {
lore.add(ChatColor.GRAY + " - " + ChatColor.AQUA + rec.getName());
}
}
lore.addAll(buildTruncatedList(fccEgg.getRecipes(), 15));
ItemUtils.addLore(is, lore);
clicks.add(new LClickable(is, p -> {
showForFactory(fccEgg);
Expand Down Expand Up @@ -370,6 +364,35 @@ private FurnCraftChestEgg getParent(FurnCraftChestEgg factory) {
return upgradeMapping.get(factory);
}

private List<String> buildTruncatedList(List<IRecipe> input, int maxSize) {
int totalElements = input.size();
List<String> loreList = new ArrayList<>();

if (totalElements <= maxSize) {
for (IRecipe item : input) {
if (item instanceof Upgraderecipe) {
loreList.add(ChatColor.GRAY + " - " + ChatColor.GREEN + item.getName());
} else {
loreList.add(ChatColor.GRAY + " - " + ChatColor.AQUA + item.getName());
}
}
} else {
List<IRecipe> subListForDisplay = input.subList(0, maxSize);

for (IRecipe item : subListForDisplay) {
if (item instanceof Upgraderecipe) {
loreList.add(ChatColor.GRAY + " - " + ChatColor.GREEN + item.getName());
} else {
loreList.add(ChatColor.GRAY + " - " + ChatColor.AQUA + item.getName());
}
}

int remainingCount = totalElements - maxSize;
loreList.add(ChatColor.GRAY + "... click for " + remainingCount + " other recipes");
}
return loreList;
}

private abstract class FMCHistoryItem implements HistoryItem {

abstract String toText();
Expand Down
Loading