Interface PlatformRegistry<T>

Type Parameters:
T - the value type
All Known Implementing Classes:
PlatformRegistryImpl

@API(status=STABLE, since="2.0.0-milestone.2.0") public interface PlatformRegistry<T>
  • Method Summary

    Modifier and Type
    Method
    Description
    com.mojang.serialization.Codec<T>
     
    get(net.minecraft.resources.ResourceLocation id)
     
     
    Optional<net.minecraft.resources.ResourceLocation>
    getId(T value)
     
    Returns the next value in the ordered list.
    void
    register(net.minecraft.resources.ResourceLocation id, T value)
    Registers a value in the registry, identified by the id.
    net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,T>
     
  • Method Details

    • register

      void register(net.minecraft.resources.ResourceLocation id, T value)
      Registers a value in the registry, identified by the id. Duplicate IDs or values are not allowed.
      Parameters:
      id - the id
      value - the value
    • getId

      Optional<net.minecraft.resources.ResourceLocation> getId(T value)
      Parameters:
      value - the value
      Returns:
      the id of the value, if present
    • get

      Optional<T> get(net.minecraft.resources.ResourceLocation id)
      Parameters:
      id - the id
      Returns:
      the value, if present
    • getAll

      List<T> getAll()
      Returns:
      an unmodifiable list of all values
    • nextOrNullIfLast

      @Nullable T nextOrNullIfLast(T value)
      Returns the next value in the ordered list. If the value is not found, it will return the first value. If the value is the last value in the ordered list, it will return null.
      Parameters:
      value - the given value
      Returns:
      the next value after the given value, or null if it's the last value
    • codec

      com.mojang.serialization.Codec<T> codec()
      Returns:
      a Codec for this registry
    • streamCodec

      net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,T> streamCodec()
      Returns:
      a StreamCodec for this registry