3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-17 12:00:07 +01:00

#753: RecipeIterator#hasNext will now accurately represent if the current iterator has a next item.

Dieser Commit ist enthalten in:
Martoph 2020-09-18 18:43:48 +10:00 committet von md_5
Ursprung 890130b460
Commit da9bb3ea92
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: E8E901AC7C617C11

Datei anzeigen

@ -19,13 +19,23 @@ public class RecipeIterator implements Iterator<Recipe> {
@Override
public boolean hasNext() {
return (current != null && current.hasNext()) || recipes.hasNext();
if (current != null && current.hasNext()) {
return true;
}
if (recipes.hasNext()) {
current = recipes.next().getValue().values().iterator();
return hasNext();
}
return false;
}
@Override
public Recipe next() {
if (current == null || !current.hasNext()) {
current = recipes.next().getValue().values().iterator();
return next();
}
return current.next().toBukkitRecipe();