package net.darkhax.bookshelf.api.registry;

import net.minecraft.resources.ResourceLocation;

import javax.annotation.Nullable;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

public interface IRegistryReader<T> extends Iterable<T> {

    @Nullable
    T get(ResourceLocation id);

    @Nullable
    ResourceLocation getId(T value);

    default Stream<T> streamValues() {

        return StreamSupport.stream(spliterator(), false);
    }

    default Stream<T> parallelStreamValues() {

        return StreamSupport.stream(spliterator(), true);
    }
}

@@ -348,24 +348,203 @@
 (T value);%0A%0A
+    default ResourceLocation getId(T value, ResourceLocation fallback) %7B%0A%0A        final ResourceLocation id = this.getId(value);%0A        return id != null ? id : fallback;%0A    %7D%0A%0A
     default 

Add a registry reader method that gets an ID with an optional fallback.