Class SimpleRegistry<T>

All Implemented Interfaces:
com.mojang.serialization.Keyable, Iterable<T>, IndexedIterable<T>
Direct Known Subclasses:
DefaultedRegistry

public class SimpleRegistry<T> extends MutableRegistry<T>
Mappings:
Namespace Name
official gs
intermediary net/minecraft/class_2370
named net/minecraft/util/registry/SimpleRegistry
  • Field Details

    • LOGGER

      protected static final Logger LOGGER
      Mappings:
      Namespace Name Mixin selector
      official b Lgs;b:Lorg/apache/logging/log4j/Logger;
      intermediary field_11111 Lnet/minecraft/class_2370;field_11111:Lorg/apache/logging/log4j/Logger;
      named LOGGER Lnet/minecraft/util/registry/SimpleRegistry;LOGGER:Lorg/apache/logging/log4j/Logger;
    • rawIdToEntry

      private final ObjectList<T> rawIdToEntry
      Mappings:
      Namespace Name Mixin selector
      official bz Lgs;bz:Lit/unimi/dsi/fastutil/objects/ObjectList;
      intermediary field_26682 Lnet/minecraft/class_2370;field_26682:Lit/unimi/dsi/fastutil/objects/ObjectList;
      named rawIdToEntry Lnet/minecraft/util/registry/SimpleRegistry;rawIdToEntry:Lit/unimi/dsi/fastutil/objects/ObjectList;
    • entryToRawId

      private final Object2IntMap<T> entryToRawId
      Mappings:
      Namespace Name Mixin selector
      official bA Lgs;bA:Lit/unimi/dsi/fastutil/objects/Object2IntMap;
      intermediary field_26683 Lnet/minecraft/class_2370;field_26683:Lit/unimi/dsi/fastutil/objects/Object2IntMap;
      named entryToRawId Lnet/minecraft/util/registry/SimpleRegistry;entryToRawId:Lit/unimi/dsi/fastutil/objects/Object2IntMap;
    • idToEntry

      private final BiMap<Identifier,T> idToEntry
      Mappings:
      Namespace Name Mixin selector
      official bB Lgs;bB:Lcom/google/common/collect/BiMap;
      intermediary field_11107 Lnet/minecraft/class_2370;field_11107:Lcom/google/common/collect/BiMap;
      named idToEntry Lnet/minecraft/util/registry/SimpleRegistry;idToEntry:Lcom/google/common/collect/BiMap;
    • keyToEntry

      private final BiMap<RegistryKey<T>,T> keyToEntry
      Mappings:
      Namespace Name Mixin selector
      official bC Lgs;bC:Lcom/google/common/collect/BiMap;
      intermediary field_25067 Lnet/minecraft/class_2370;field_25067:Lcom/google/common/collect/BiMap;
      named keyToEntry Lnet/minecraft/util/registry/SimpleRegistry;keyToEntry:Lcom/google/common/collect/BiMap;
    • entryToLifecycle

      private final Map<T,com.mojang.serialization.Lifecycle> entryToLifecycle
      Mappings:
      Namespace Name Mixin selector
      official bD Lgs;bD:Ljava/util/Map;
      intermediary field_26731 Lnet/minecraft/class_2370;field_26731:Ljava/util/Map;
      named entryToLifecycle Lnet/minecraft/util/registry/SimpleRegistry;entryToLifecycle:Ljava/util/Map;
    • lifecycle

      private com.mojang.serialization.Lifecycle lifecycle
      Mappings:
      Namespace Name Mixin selector
      official bE Lgs;bE:Lcom/mojang/serialization/Lifecycle;
      intermediary field_26732 Lnet/minecraft/class_2370;field_26732:Lcom/mojang/serialization/Lifecycle;
      named lifecycle Lnet/minecraft/util/registry/SimpleRegistry;lifecycle:Lcom/mojang/serialization/Lifecycle;
    • randomEntries

      @Nullable protected @Nullable Object[] randomEntries
      Mappings:
      Namespace Name Mixin selector
      official c Lgs;c:[Ljava/lang/Object;
      intermediary field_11108 Lnet/minecraft/class_2370;field_11108:[Ljava/lang/Object;
      named randomEntries Lnet/minecraft/util/registry/SimpleRegistry;randomEntries:[Ljava/lang/Object;
    • nextId

      private int nextId
      Mappings:
      Namespace Name Mixin selector
      official bF Lgs;bF:I
      intermediary field_11109 Lnet/minecraft/class_2370;field_11109:I
      named nextId Lnet/minecraft/util/registry/SimpleRegistry;nextId:I
  • Constructor Details

    • SimpleRegistry

      public SimpleRegistry(RegistryKey<? extends Registry<T>> key, com.mojang.serialization.Lifecycle lifecycle)
      Mappings:
      Namespace Name Mixin selector
      official <init> Lgx;<init>(Lya;Lcom/mojang/serialization/Lifecycle;)V
      intermediary <init> Lnet/minecraft/class_2378;<init>(Lnet/minecraft/class_5321;Lcom/mojang/serialization/Lifecycle;)V
      named <init> Lnet/minecraft/util/registry/Registry;<init>(Lnet/minecraft/util/registry/RegistryKey;Lcom/mojang/serialization/Lifecycle;)V
  • Method Details

    • createRegistryManagerEntryCodec

      public static <T> com.mojang.serialization.MapCodec<SimpleRegistry.RegistryManagerEntry<T>> createRegistryManagerEntryCodec(RegistryKey<? extends Registry<T>> key, com.mojang.serialization.MapCodec<T> entryCodec)
      Mappings:
      Namespace Name Mixin selector
      official a Lgs;a(Lya;Lcom/mojang/serialization/MapCodec;)Lcom/mojang/serialization/MapCodec;
      intermediary method_30929 Lnet/minecraft/class_2370;method_30929(Lnet/minecraft/class_5321;Lcom/mojang/serialization/MapCodec;)Lcom/mojang/serialization/MapCodec;
      named createRegistryManagerEntryCodec Lnet/minecraft/util/registry/SimpleRegistry;createRegistryManagerEntryCodec(Lnet/minecraft/util/registry/RegistryKey;Lcom/mojang/serialization/MapCodec;)Lcom/mojang/serialization/MapCodec;
    • set

      public <V extends T> V set(int rawId, RegistryKey<T> key, V entry, com.mojang.serialization.Lifecycle lifecycle)
      Specified by:
      set in class MutableRegistry<T>
      Mappings:
      Namespace Name Mixin selector
      official a Lhd;a(ILya;Ljava/lang/Object;Lcom/mojang/serialization/Lifecycle;)Ljava/lang/Object;
      intermediary method_10273 Lnet/minecraft/class_2385;method_10273(ILnet/minecraft/class_5321;Ljava/lang/Object;Lcom/mojang/serialization/Lifecycle;)Ljava/lang/Object;
      named set Lnet/minecraft/util/registry/MutableRegistry;set(ILnet/minecraft/util/registry/RegistryKey;Ljava/lang/Object;Lcom/mojang/serialization/Lifecycle;)Ljava/lang/Object;
    • set

      private <V extends T> V set(int rawId, RegistryKey<T> key, V entry, com.mojang.serialization.Lifecycle lifecycle, boolean checkDuplicateKeys)
      Mappings:
      Namespace Name Mixin selector
      official a Lgs;a(ILya;Ljava/lang/Object;Lcom/mojang/serialization/Lifecycle;Z)Ljava/lang/Object;
      intermediary method_31051 Lnet/minecraft/class_2370;method_31051(ILnet/minecraft/class_5321;Ljava/lang/Object;Lcom/mojang/serialization/Lifecycle;Z)Ljava/lang/Object;
      named set Lnet/minecraft/util/registry/SimpleRegistry;set(ILnet/minecraft/util/registry/RegistryKey;Ljava/lang/Object;Lcom/mojang/serialization/Lifecycle;Z)Ljava/lang/Object;
    • add

      public <V extends T> V add(RegistryKey<T> key, V entry, com.mojang.serialization.Lifecycle lifecycle)
      Specified by:
      add in class MutableRegistry<T>
      Mappings:
      Namespace Name Mixin selector
      official a Lhd;a(Lya;Ljava/lang/Object;Lcom/mojang/serialization/Lifecycle;)Ljava/lang/Object;
      intermediary method_10272 Lnet/minecraft/class_2385;method_10272(Lnet/minecraft/class_5321;Ljava/lang/Object;Lcom/mojang/serialization/Lifecycle;)Ljava/lang/Object;
      named add Lnet/minecraft/util/registry/MutableRegistry;add(Lnet/minecraft/util/registry/RegistryKey;Ljava/lang/Object;Lcom/mojang/serialization/Lifecycle;)Ljava/lang/Object;
    • replace

      public <V extends T> V replace(OptionalInt rawId, RegistryKey<T> key, V newEntry, com.mojang.serialization.Lifecycle lifecycle)
      If the given key is already present in the registry, replaces the entry associated with the given key with the new entry. This method asserts that the raw ID is equal to the value already in the registry. The raw ID not being present may lead to buggy behavior.

      If the given key is not already present in the registry, adds the entry to the registry. If rawId is present, then this method gives the entry this raw ID. Otherwise, uses the next available ID.

      Specified by:
      replace in class MutableRegistry<T>
      Mappings:
      Namespace Name Mixin selector
      official a Lhd;a(Ljava/util/OptionalInt;Lya;Ljava/lang/Object;Lcom/mojang/serialization/Lifecycle;)Ljava/lang/Object;
      intermediary method_31062 Lnet/minecraft/class_2385;method_31062(Ljava/util/OptionalInt;Lnet/minecraft/class_5321;Ljava/lang/Object;Lcom/mojang/serialization/Lifecycle;)Ljava/lang/Object;
      named replace Lnet/minecraft/util/registry/MutableRegistry;replace(Ljava/util/OptionalInt;Lnet/minecraft/util/registry/RegistryKey;Ljava/lang/Object;Lcom/mojang/serialization/Lifecycle;)Ljava/lang/Object;
    • getId

      @Nullable public @Nullable Identifier getId(T entry)
      Specified by:
      getId in class Registry<T>
      Mappings:
      Namespace Name Mixin selector
      official b Lgx;b(Ljava/lang/Object;)Lyb;
      intermediary method_10221 Lnet/minecraft/class_2378;method_10221(Ljava/lang/Object;)Lnet/minecraft/class_2960;
      named getId Lnet/minecraft/util/registry/Registry;getId(Ljava/lang/Object;)Lnet/minecraft/util/Identifier;
    • getKey

      public Optional<RegistryKey<T>> getKey(T entry)
      Specified by:
      getKey in class Registry<T>
      Mappings:
      Namespace Name Mixin selector
      official c Lgx;c(Ljava/lang/Object;)Ljava/util/Optional;
      intermediary method_29113 Lnet/minecraft/class_2378;method_29113(Ljava/lang/Object;)Ljava/util/Optional;
      named getKey Lnet/minecraft/util/registry/Registry;getKey(Ljava/lang/Object;)Ljava/util/Optional;
    • getRawId

      public int getRawId(@Nullable T entry)
      Specified by:
      getRawId in interface IndexedIterable<T>
      Specified by:
      getRawId in class Registry<T>
      Mappings:
      Namespace Name Mixin selector
      official a Lgq;a(Ljava/lang/Object;)I
      intermediary method_10206 Lnet/minecraft/class_2359;method_10206(Ljava/lang/Object;)I
      named getRawId Lnet/minecraft/util/collection/IndexedIterable;getRawId(Ljava/lang/Object;)I
    • get

      Specified by:
      get in class Registry<T>
      Mappings:
      Namespace Name Mixin selector
      official a Lgx;a(Lya;)Ljava/lang/Object;
      intermediary method_29107 Lnet/minecraft/class_2378;method_29107(Lnet/minecraft/class_5321;)Ljava/lang/Object;
      named get Lnet/minecraft/util/registry/Registry;get(Lnet/minecraft/util/registry/RegistryKey;)Ljava/lang/Object;
    • get

      @Nullable public T get(int index)
      Mappings:
      Namespace Name Mixin selector
      official a Lgq;a(I)Ljava/lang/Object;
      intermediary method_10200 Lnet/minecraft/class_2359;method_10200(I)Ljava/lang/Object;
      named get Lnet/minecraft/util/collection/IndexedIterable;get(I)Ljava/lang/Object;
    • size

      public int size()
      Mappings:
      Namespace Name Mixin selector
      official b Lgq;b()I
      intermediary method_10204 Lnet/minecraft/class_2359;method_10204()I
      named size Lnet/minecraft/util/collection/IndexedIterable;size()I
    • getEntryLifecycle

      public com.mojang.serialization.Lifecycle getEntryLifecycle(T entry)
      Gets the lifecycle of a registry entry.
      Specified by:
      getEntryLifecycle in class Registry<T>
      Mappings:
      Namespace Name Mixin selector
      official d Lgx;d(Ljava/lang/Object;)Lcom/mojang/serialization/Lifecycle;
      intermediary method_31139 Lnet/minecraft/class_2378;method_31139(Ljava/lang/Object;)Lcom/mojang/serialization/Lifecycle;
      named getEntryLifecycle Lnet/minecraft/util/registry/Registry;getEntryLifecycle(Ljava/lang/Object;)Lcom/mojang/serialization/Lifecycle;
    • getLifecycle

      public com.mojang.serialization.Lifecycle getLifecycle()
      Specified by:
      getLifecycle in class Registry<T>
      Mappings:
      Namespace Name Mixin selector
      official c Lgx;c()Lcom/mojang/serialization/Lifecycle;
      intermediary method_31138 Lnet/minecraft/class_2378;method_31138()Lcom/mojang/serialization/Lifecycle;
      named getLifecycle Lnet/minecraft/util/registry/Registry;getLifecycle()Lcom/mojang/serialization/Lifecycle;
    • iterator

      public Iterator<T> iterator()
    • get

      Specified by:
      get in class Registry<T>
      Mappings:
      Namespace Name Mixin selector
      official a Lgx;a(Lyb;)Ljava/lang/Object;
      intermediary method_10223 Lnet/minecraft/class_2378;method_10223(Lnet/minecraft/class_2960;)Ljava/lang/Object;
      named get Lnet/minecraft/util/registry/Registry;get(Lnet/minecraft/util/Identifier;)Ljava/lang/Object;
    • getIds

      public Set<Identifier> getIds()
      Specified by:
      getIds in class Registry<T>
      Mappings:
      Namespace Name Mixin selector
      official d Lgx;d()Ljava/util/Set;
      intermediary method_10235 Lnet/minecraft/class_2378;method_10235()Ljava/util/Set;
      named getIds Lnet/minecraft/util/registry/Registry;getIds()Ljava/util/Set;
    • getEntries

      public Set<Map.Entry<RegistryKey<T>,T>> getEntries()
      Specified by:
      getEntries in class Registry<T>
      Mappings:
      Namespace Name Mixin selector
      official e Lgx;e()Ljava/util/Set;
      intermediary method_29722 Lnet/minecraft/class_2378;method_29722()Ljava/util/Set;
      named getEntries Lnet/minecraft/util/registry/Registry;getEntries()Ljava/util/Set;
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in class MutableRegistry<T>
      Mappings:
      Namespace Name Mixin selector
      official f Lhd;f()Z
      intermediary method_35863 Lnet/minecraft/class_2385;method_35863()Z
      named isEmpty Lnet/minecraft/util/registry/MutableRegistry;isEmpty()Z
    • getRandom

      @Nullable public T getRandom(Random random)
      Specified by:
      getRandom in class Registry<T>
      Mappings:
      Namespace Name Mixin selector
      official a Lgx;a(Ljava/util/Random;)Ljava/lang/Object;
      intermediary method_10240 Lnet/minecraft/class_2378;method_10240(Ljava/util/Random;)Ljava/lang/Object;
      named getRandom Lnet/minecraft/util/registry/Registry;getRandom(Ljava/util/Random;)Ljava/lang/Object;
    • containsId

      public boolean containsId(Identifier id)
      Specified by:
      containsId in class Registry<T>
      Mappings:
      Namespace Name Mixin selector
      official c Lgx;c(Lyb;)Z
      intermediary method_10250 Lnet/minecraft/class_2378;method_10250(Lnet/minecraft/class_2960;)Z
      named containsId Lnet/minecraft/util/registry/Registry;containsId(Lnet/minecraft/util/Identifier;)Z
    • contains

      public boolean contains(RegistryKey<T> key)
      Specified by:
      contains in class Registry<T>
      Mappings:
      Namespace Name Mixin selector
      official b Lgx;b(Lya;)Z
      intermediary method_35842 Lnet/minecraft/class_2378;method_35842(Lnet/minecraft/class_5321;)Z
      named contains Lnet/minecraft/util/registry/Registry;contains(Lnet/minecraft/util/registry/RegistryKey;)Z
    • createRegistryManagerCodec

      public static <T> com.mojang.serialization.Codec<SimpleRegistry<T>> createRegistryManagerCodec(RegistryKey<? extends Registry<T>> key, com.mojang.serialization.Lifecycle lifecycle, com.mojang.serialization.Codec<T> entryCodec)
      Mappings:
      Namespace Name Mixin selector
      official a Lgs;a(Lya;Lcom/mojang/serialization/Lifecycle;Lcom/mojang/serialization/Codec;)Lcom/mojang/serialization/Codec;
      intermediary method_29098 Lnet/minecraft/class_2370;method_29098(Lnet/minecraft/class_5321;Lcom/mojang/serialization/Lifecycle;Lcom/mojang/serialization/Codec;)Lcom/mojang/serialization/Codec;
      named createRegistryManagerCodec Lnet/minecraft/util/registry/SimpleRegistry;createRegistryManagerCodec(Lnet/minecraft/util/registry/RegistryKey;Lcom/mojang/serialization/Lifecycle;Lcom/mojang/serialization/Codec;)Lcom/mojang/serialization/Codec;
    • createRegistryCodec

      public static <T> com.mojang.serialization.Codec<SimpleRegistry<T>> createRegistryCodec(RegistryKey<? extends Registry<T>> registryRef, com.mojang.serialization.Lifecycle lifecycle, com.mojang.serialization.Codec<T> entryCodec)
      Mappings:
      Namespace Name Mixin selector
      official b Lgs;b(Lya;Lcom/mojang/serialization/Lifecycle;Lcom/mojang/serialization/Codec;)Lcom/mojang/serialization/Codec;
      intermediary method_29721 Lnet/minecraft/class_2370;method_29721(Lnet/minecraft/class_5321;Lcom/mojang/serialization/Lifecycle;Lcom/mojang/serialization/Codec;)Lcom/mojang/serialization/Codec;
      named createRegistryCodec Lnet/minecraft/util/registry/SimpleRegistry;createRegistryCodec(Lnet/minecraft/util/registry/RegistryKey;Lcom/mojang/serialization/Lifecycle;Lcom/mojang/serialization/Codec;)Lcom/mojang/serialization/Codec;
    • createCodec

      public static <T> com.mojang.serialization.Codec<SimpleRegistry<T>> createCodec(RegistryKey<? extends Registry<T>> key, com.mojang.serialization.Lifecycle lifecycle, com.mojang.serialization.Codec<T> entryCodec)
      Mappings:
      Namespace Name Mixin selector
      official c Lgs;c(Lya;Lcom/mojang/serialization/Lifecycle;Lcom/mojang/serialization/Codec;)Lcom/mojang/serialization/Codec;
      intermediary method_31059 Lnet/minecraft/class_2370;method_31059(Lnet/minecraft/class_5321;Lcom/mojang/serialization/Lifecycle;Lcom/mojang/serialization/Codec;)Lcom/mojang/serialization/Codec;
      named createCodec Lnet/minecraft/util/registry/SimpleRegistry;createCodec(Lnet/minecraft/util/registry/RegistryKey;Lcom/mojang/serialization/Lifecycle;Lcom/mojang/serialization/Codec;)Lcom/mojang/serialization/Codec;