Add a method on Registry to get the size (#12182)

This commit is contained in:
Glicz
2025-02-25 22:02:48 +01:00
committed by GitHub
parent 5f2ee83ed4
commit b00875f86d
3 changed files with 33 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 int size() {
return this.delegate().size();
}
@Override
public @Nullable NamespacedKey getKey(final T value) {
return this.delegate().getKey(value);

View File

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