Package net.minecraft.util.registry
Class Registry<T>
java.lang.Object
net.minecraft.util.registry.Registry<T>
- All Implemented Interfaces:
com.mojang.serialization.Codec<T>
,com.mojang.serialization.Decoder<T>
,com.mojang.serialization.Encoder<T>
,com.mojang.serialization.Keyable
,Iterable<T>
,IndexedIterable<T>
- Direct Known Subclasses:
MutableRegistry
public abstract class Registry<T> extends Object implements com.mojang.serialization.Codec<T>, com.mojang.serialization.Keyable, IndexedIterable<T>
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.mojang.serialization.Codec
com.mojang.serialization.Codec.ResultFunction<A extends Object>
-
Field Summary
Fields inherited from interface com.mojang.serialization.Codec
BOOL, BYTE, BYTE_BUFFER, DOUBLE, EMPTY, FLOAT, INT, INT_STREAM, LONG, LONG_STREAM, PASSTHROUGH, SHORT, STRING
-
Constructor Summary
Constructors Modifier Constructor Description protected
Registry(RegistryKey<? extends Registry<T>> key, com.mojang.serialization.Lifecycle lifecycle)
-
Method Summary
Modifier and Type Method Description abstract boolean
containsId(Identifier id)
private static <T> Registry<T>
create(RegistryKey<? extends Registry<T>> registryKey, com.mojang.serialization.Lifecycle lifecycle, Supplier<T> defaultEntry)
private static <T> DefaultedRegistry<T>
create(RegistryKey<? extends Registry<T>> registryKey, String defaultId, com.mojang.serialization.Lifecycle lifecycle, Supplier<T> defaultEntry)
private static <T> DefaultedRegistry<T>
create(RegistryKey<? extends Registry<T>> registryKey, String defaultId, Supplier<T> defaultEntry)
private static <T> Registry<T>
create(RegistryKey<? extends Registry<T>> registryKey, Supplier<T> defaultEntry)
private static <T, R extends MutableRegistry<T>>
Rcreate(RegistryKey<? extends Registry<T>> registryKey, R registry, Supplier<T> defaultEntry, com.mojang.serialization.Lifecycle lifecycle)
private static <T> RegistryKey<Registry<T>>
createRegistryKey(String registryId)
<U> com.mojang.serialization.DataResult<com.mojang.datafixers.util.Pair<T,U>>
decode(com.mojang.serialization.DynamicOps<U> dynamicOps, U u)
<U> com.mojang.serialization.DataResult<U>
encode(T t, com.mojang.serialization.DynamicOps<U> dynamicOps, U u)
abstract T
get(Identifier id)
abstract T
get(RegistryKey<T> key)
abstract Set<Map.Entry<RegistryKey<T>,T>>
getEntries()
protected abstract com.mojang.serialization.Lifecycle
getEntryLifecycle(T t)
Gets the lifecycle of a registry entry.abstract Identifier
getId(T entry)
abstract Set<Identifier>
getIds()
RegistryKey<? extends Registry<T>>
getKey()
abstract Optional<RegistryKey<T>>
getKey(T entry)
abstract com.mojang.serialization.Lifecycle
getLifecycle()
Optional<T>
getOrEmpty(Identifier id)
Optional<T>
getOrEmpty(RegistryKey<T> key)
T
getOrThrow(RegistryKey<T> key)
Gets an entry from the registry.abstract int
getRawId(T entry)
<U> Stream<U>
keys(com.mojang.serialization.DynamicOps<U> dynamicOps)
static <T> T
register(Registry<? super T> registry, String id, T entry)
static <V, T extends V>
Tregister(Registry<V> registry, int rawId, String id, T entry)
static <V, T extends V>
Tregister(Registry<V> registry, Identifier id, T entry)
Stream<T>
stream()
String
toString()
static <T extends MutableRegistry<?>>
voidvalidate(MutableRegistry<T> registry)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.mojang.serialization.Codec
comapFlatMap, deprecated, dispatch, dispatch, dispatchMap, dispatchMap, dispatchStable, fieldOf, flatComapMap, flatXmap, listOf, mapResult, optionalFieldOf, optionalFieldOf, optionalFieldOf, optionalFieldOf, orElse, orElse, orElse, orElseGet, orElseGet, orElseGet, partialDispatch, promotePartial, stable, withLifecycle, xmap
Methods inherited from interface com.mojang.serialization.Decoder
boxed, decode, flatMap, map, parse, parse, simple, terminal
Methods inherited from interface com.mojang.serialization.Encoder
comap, encodeStart, flatComap
Methods inherited from interface net.minecraft.util.collection.IndexedIterable
get
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Field Details
-
LOGGER
-
DEFAULT_ENTRIES
-
ROOT_KEY
-
ROOT
-
REGISTRIES
-
SOUND_EVENT_KEY
-
FLUID_KEY
-
MOB_EFFECT_KEY
-
BLOCK_KEY
-
ENCHANTMENT_KEY
-
ENTITY_TYPE_KEY
-
ITEM_KEY
-
POTION_KEY
-
PARTICLE_TYPE_KEY
-
BLOCK_ENTITY_TYPE_KEY
-
MOTIVE_KEY
-
CUSTOM_STAT_KEY
-
CHUNK_STATUS_KEY
-
RULE_TEST_KEY
-
POS_RULE_TEST_KEY
-
MENU_KEY
-
RECIPE_TYPE_KEY
-
RECIPE_SERIALIZER_KEY
-
ATTRIBUTE_KEY
-
STAT_TYPE_KEY
-
VILLAGER_TYPE_KEY
-
VILLAGER_PROFESSION_KEY
-
POINT_OF_INTEREST_TYPE_KEY
-
MEMORY_MODULE_TYPE_KEY
-
SENSOR_TYPE_KEY
-
SCHEDULE_KEY
-
ACTIVITY_KEY
-
LOOT_POOL_ENTRY_TYPE_KEY
-
LOOT_FUNCTION_TYPE_KEY
-
LOOT_CONDITION_TYPE_KEY
-
DIMENSION_TYPE_KEY
-
DIMENSION
-
DIMENSION_OPTIONS
-
SOUND_EVENT
-
FLUID
-
STATUS_EFFECT
-
BLOCK
-
ENCHANTMENT
-
ENTITY_TYPE
-
ITEM
-
POTION
-
PARTICLE_TYPE
-
BLOCK_ENTITY_TYPE
-
PAINTING_MOTIVE
-
CUSTOM_STAT
-
CHUNK_STATUS
-
RULE_TEST
-
POS_RULE_TEST
-
SCREEN_HANDLER
-
RECIPE_TYPE
-
RECIPE_SERIALIZER
-
ATTRIBUTE
-
STAT_TYPE
-
VILLAGER_TYPE
-
VILLAGER_PROFESSION
-
POINT_OF_INTEREST_TYPE
-
MEMORY_MODULE_TYPE
-
SENSOR_TYPE
-
SCHEDULE
-
ACTIVITY
-
LOOT_POOL_ENTRY_TYPE
-
LOOT_FUNCTION_TYPE
-
LOOT_CONDITION_TYPE
-
NOISE_SETTINGS_WORLDGEN
-
CONFIGURED_SURFACE_BUILDER_WORLDGEN
public static final RegistryKey<Registry<ConfiguredSurfaceBuilder<?>>> CONFIGURED_SURFACE_BUILDER_WORLDGEN -
CONFIGURED_CARVER_WORLDGEN
-
CONFIGURED_FEATURE_WORLDGEN
-
CONFIGURED_STRUCTURE_FEATURE_WORLDGEN
public static final RegistryKey<Registry<ConfiguredStructureFeature<?,?>>> CONFIGURED_STRUCTURE_FEATURE_WORLDGEN -
PROCESSOR_LIST_WORLDGEN
-
TEMPLATE_POOL_WORLDGEN
-
BIOME_KEY
-
SURFACE_BUILD_KEY
-
SURFACE_BUILDER
-
CARVER_KEY
-
CARVER
-
FEATURE_KEY
-
FEATURE
-
STRUCTURE_FEATURE_KEY
-
STRUCTURE_FEATURE
-
STRUCTURE_PIECE_KEY
-
STRUCTURE_PIECE
-
DECORATOR_KEY
-
DECORATOR
-
BLOCK_STATE_PROVIDER_TYPE_KEY
-
BLOCK_PLACER_TYPE_KEY
-
FOLIAGE_PLACER_TYPE_KEY
-
TRUNK_PLACER_TYPE_KEY
-
TREE_DECORATOR_TYPE_KEY
-
FEATURE_SIZE_TYPE_KEY
-
BIOME_SOURCE_KEY
public static final RegistryKey<Registry<com.mojang.serialization.Codec<? extends BiomeSource>>> BIOME_SOURCE_KEY -
CHUNK_GENERATOR_KEY
public static final RegistryKey<Registry<com.mojang.serialization.Codec<? extends ChunkGenerator>>> CHUNK_GENERATOR_KEY -
STRUCTURE_PROCESSOR_KEY
-
STRUCTURE_POOL_ELEMENT_KEY
-
BLOCK_STATE_PROVIDER_TYPE
-
BLOCK_PLACER_TYPE
-
FOLIAGE_PLACER_TYPE
-
TRUNK_PLACER_TYPE
-
TREE_DECORATOR_TYPE
-
FEATURE_SIZE_TYPE
-
BIOME_SOURCE
-
CHUNK_GENERATOR
public static final Registry<com.mojang.serialization.Codec<? extends ChunkGenerator>> CHUNK_GENERATOR -
STRUCTURE_PROCESSOR
-
STRUCTURE_POOL_ELEMENT
-
registryKey
The RegistryKey representing the ID of the actual registry. -
lifecycle
private final com.mojang.serialization.Lifecycle lifecycle
-
-
Constructor Details
-
Registry
protected Registry(RegistryKey<? extends Registry<T>> key, com.mojang.serialization.Lifecycle lifecycle)
-
-
Method Details
-
createRegistryKey
-
validate
-
create
private static <T> Registry<T> create(RegistryKey<? extends Registry<T>> registryKey, Supplier<T> defaultEntry) -
create
private static <T> DefaultedRegistry<T> create(RegistryKey<? extends Registry<T>> registryKey, String defaultId, Supplier<T> defaultEntry) -
create
private static <T> Registry<T> create(RegistryKey<? extends Registry<T>> registryKey, com.mojang.serialization.Lifecycle lifecycle, Supplier<T> defaultEntry) -
create
private static <T> DefaultedRegistry<T> create(RegistryKey<? extends Registry<T>> registryKey, String defaultId, com.mojang.serialization.Lifecycle lifecycle, Supplier<T> defaultEntry) -
create
private static <T, R extends MutableRegistry<T>> R create(RegistryKey<? extends Registry<T>> registryKey, R registry, Supplier<T> defaultEntry, com.mojang.serialization.Lifecycle lifecycle) -
getKey
-
toString
-
decode
public <U> com.mojang.serialization.DataResult<com.mojang.datafixers.util.Pair<T,U>> decode(com.mojang.serialization.DynamicOps<U> dynamicOps, U u)- Specified by:
decode
in interfacecom.mojang.serialization.Decoder<T>
-
encode
public <U> com.mojang.serialization.DataResult<U> encode(T t, com.mojang.serialization.DynamicOps<U> dynamicOps, U u)- Specified by:
encode
in interfacecom.mojang.serialization.Encoder<T>
-
keys
- Specified by:
keys
in interfacecom.mojang.serialization.Keyable
-
getId
-
getKey
-
getRawId
- Specified by:
getRawId
in interfaceIndexedIterable<T>
-
get
-
get
-
getEntryLifecycle
Gets the lifecycle of a registry entry. -
getLifecycle
public abstract com.mojang.serialization.Lifecycle getLifecycle() -
getOrEmpty
-
getOrEmpty
-
getOrThrow
Gets an entry from the registry.- Throws:
IllegalStateException
- if the entry was not present in the registry
-
getIds
-
getEntries
-
stream
-
containsId
-
register
-
register
-
register
-