Interface TRegistry<T>

All Superinterfaces:
Iterable<Map.Entry<net.minecraft.util.Identifier,T>>
All Known Implementing Classes:
TAbstractMappedRegistry, TImmutableRegistry, TMutableRegistry, TSimpleRegistry

public interface TRegistry<T> extends Iterable<Map.Entry<net.minecraft.util.Identifier,T>>
A custom implementation of Minecraft's Registry system that aims to be simpler and more convenient to use.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    containsKey(net.minecraft.util.Identifier id)
     
    boolean
     
    Optional<net.minecraft.util.Identifier>
    getKey(T entry)
    Returns the unique Identifier that corresponds to a registered entry, wrapped in an Optional.
    getValue(net.minecraft.util.Identifier id)
    Returns a registered entry, wrapped in an Optional.
    register(net.minecraft.util.Identifier id, T entry)
    Registers an entry to this TRegistry.
    default int
    Returns the number of registered entries in this TRegistry.
    unregister(net.minecraft.util.Identifier id)
    UnRegisters an existing entry that is part of this TRegistry.

    Methods inherited from interface java.lang.Iterable

    forEach, iterator, spliterator
  • Method Details

    • size

      default int size()
      Returns the number of registered entries in this TRegistry.
    • register

      T register(net.minecraft.util.Identifier id, T entry) throws UnsupportedOperationException, NullPointerException, IllegalStateException
      Registers an entry to this TRegistry.
      Parameters:
      id - The unique Identifier of the entry being registered.
      entry - The entry being registered.
      Returns:
      The registered entry.
      Throws:
      UnsupportedOperationException - If this TRegistry does not support registering new entries.
      NullPointerException - If any given argument is null.
      IllegalStateException - If the entry is already registered, and this TRegistry doesn't support overriding existing entries.
    • unregister

      T unregister(net.minecraft.util.Identifier id) throws UnsupportedOperationException, NullPointerException
      UnRegisters an existing entry that is part of this TRegistry.
      Parameters:
      id - The unique Identifier of the entry being unregistered.
      Returns:
      The entry value that was previously associated with the given unique Identifier, or null if there was no such entry.
      Throws:
      UnsupportedOperationException - If this TRegistry does not support unregistering existing entries.
      NullPointerException - If any given argument is null.
    • getKey

      Optional<net.minecraft.util.Identifier> getKey(T entry)
      Returns the unique Identifier that corresponds to a registered entry, wrapped in an Optional.
      Parameters:
      entry - The registered entry.
    • getValue

      Optional<T> getValue(net.minecraft.util.Identifier id)
      Returns a registered entry, wrapped in an Optional.
      Parameters:
      id - The unique Identifier of the entry that was registered.
    • containsKey

      boolean containsKey(net.minecraft.util.Identifier id)
    • containsValue

      boolean containsValue(T entry)