Interface Registrar<T>

All Superinterfaces:
Iterable<T>

public interface Registrar<T> extends Iterable<T>
  • Method Summary

    Modifier and Type
    Method
    Description
    byRawId(int rawId)
     
    boolean
    contains(net.minecraft.resources.ResourceLocation id)
     
    boolean
     
    delegate(net.minecraft.resources.ResourceLocation id)
     
    Set<Map.Entry<net.minecraft.resources.ResourceKey<T>,T>>
     
    get(net.minecraft.resources.ResourceLocation id)
     
    @Nullable net.minecraft.resources.ResourceLocation
    getId(T obj)
     
    Set<net.minecraft.resources.ResourceLocation>
     
    Optional<net.minecraft.resources.ResourceKey<T>>
    getKey(T obj)
     
    int
    getRawId(T obj)
     
    net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>>
    key()
     
    default <R extends T>
    void
    listen(RegistrySupplier<R> supplier, Consumer<R> callback)
    Listens to when the registry entry is registered, and calls the given action.
    void
    listen(net.minecraft.resources.ResourceLocation id, Consumer<T> callback)
    Listens to when the registry entry is registered, and calls the given action.
    <E extends T>
    RegistrySupplier<E>
    register(net.minecraft.resources.ResourceLocation id, Supplier<E> supplier)
     
    default <R extends T>
    RegistrySupplier<R>
    wrap(R obj)
     

    Methods inherited from interface java.lang.Iterable

    forEach, iterator, spliterator
  • Method Details

    • delegate

      RegistrySupplier<T> delegate(net.minecraft.resources.ResourceLocation id)
    • wrap

      default <R extends T> RegistrySupplier<R> wrap(R obj)
    • register

      <E extends T> RegistrySupplier<E> register(net.minecraft.resources.ResourceLocation id, Supplier<E> supplier)
    • getId

      @Nullable @Nullable net.minecraft.resources.ResourceLocation getId(T obj)
    • getRawId

      int getRawId(T obj)
    • getKey

      Optional<net.minecraft.resources.ResourceKey<T>> getKey(T obj)
    • get

      @Nullable T get(net.minecraft.resources.ResourceLocation id)
    • byRawId

      @Nullable T byRawId(int rawId)
    • contains

      boolean contains(net.minecraft.resources.ResourceLocation id)
    • containsValue

      boolean containsValue(T obj)
    • getIds

      Set<net.minecraft.resources.ResourceLocation> getIds()
    • entrySet

      Set<Map.Entry<net.minecraft.resources.ResourceKey<T>,T>> entrySet()
    • key

      net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> key()
    • listen

      default <R extends T> void listen(RegistrySupplier<R> supplier, Consumer<R> callback)
      Listens to when the registry entry is registered, and calls the given action. Evaluates immediately if the entry is already registered.

      Whenever the callback is called is dependent on the registry implementation. On fabric, this will be called when the registry entry is registered. On forge, this will be called when the registry entry is registered or when Minecraft has started.

      Parameters:
      supplier - the entry to listen to
      callback - the action to call when the registry entry is registered
    • listen

      void listen(net.minecraft.resources.ResourceLocation id, Consumer<T> callback)
      Listens to when the registry entry is registered, and calls the given action. Evaluates immediately if the entry is already registered.

      Whenever the callback is called is dependent on the registry implementation. On fabric, this will be called when the registry entry is registered. On forge, this will be called when the registry entry is registered or when Minecraft has started.

      Parameters:
      id - the entry to listen to
      callback - the action to call when the registry entry is registered