Add keyStream() API to registries (#12479)

This commit is contained in:
Maddy Miller
2025-04-25 22:26:56 +10:00
committed by GitHub
parent 3409e2d73f
commit 1cfc96bcf7
3 changed files with 28 additions and 0 deletions

View File

@@ -49,6 +49,11 @@ public final class DelayedRegistry<T extends Keyed, R extends Registry<T>> imple
return this.delegate().stream();
}
@Override
public Stream<NamespacedKey> keyStream() {
return this.delegate().keyStream();
}
@Override
public int size() {
return this.delegate().size();

View File

@@ -233,6 +233,12 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> {
return this.minecraftRegistry.keySet().stream().map(minecraftKey -> this.get(CraftNamespacedKey.fromMinecraft(minecraftKey)));
}
@NotNull
@Override
public Stream<NamespacedKey> keyStream() {
return this.minecraftRegistry.keySet().stream().map(CraftNamespacedKey::fromMinecraft);
}
@Override
public int size() {
return this.minecraftRegistry.size();