public abstract class Registry<T> extends Object implements com.mojang.serialization.Codec<T>, com.mojang.serialization.Keyable, IndexedIterable<T>
Modifier | Constructor and Description |
---|---|
protected |
Registry(RegistryKey<? extends Registry<T>> key,
com.mojang.serialization.Lifecycle lifecycle) |
Modifier and Type | Method and 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,R extends MutableRegistry<T>> |
create(RegistryKey<? extends Registry<T>> registryKey,
R registry,
Supplier<T> defaultEntry,
com.mojang.serialization.Lifecycle lifecycle) |
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> 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> |
register(Registry<V> registry,
Identifier id,
T entry) |
static <V,T extends V> |
register(Registry<V> registry,
int rawId,
String id,
T entry) |
Stream<T> |
stream() |
String |
toString() |
static <T extends MutableRegistry<?>> |
validate(MutableRegistry<T> registry) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
checkRange, comapFlatMap, compoundList, deprecated, dispatch, dispatch, dispatchMap, dispatchMap, dispatchStable, doubleRange, either, fieldOf, flatComapMap, flatXmap, floatRange, intRange, list, listOf, mapEither, mapPair, mapResult, of, of, of, of, optionalField, optionalFieldOf, optionalFieldOf, optionalFieldOf, optionalFieldOf, orElse, orElse, orElse, orElseGet, orElseGet, orElseGet, pair, partialDispatch, promotePartial, simpleMap, stable, unboundedMap, unit, unit, withLifecycle, xmap
comap, empty, encodeStart, error, flatComap
boxed, decode, error, flatMap, map, ofBoxed, ofSimple, ofTerminal, parse, parse, simple, terminal
get
forEach, iterator, spliterator
protected static final Logger LOGGER
private static final Map<Identifier,Supplier<?>> DEFAULT_ENTRIES
public static final Identifier ROOT_KEY
protected static final MutableRegistry<MutableRegistry<?>> ROOT
public static final RegistryKey<Registry<SoundEvent>> SOUND_EVENT_KEY
public static final RegistryKey<Registry<Fluid>> FLUID_KEY
public static final RegistryKey<Registry<StatusEffect>> MOB_EFFECT_KEY
public static final RegistryKey<Registry<Block>> BLOCK_KEY
public static final RegistryKey<Registry<Enchantment>> ENCHANTMENT_KEY
public static final RegistryKey<Registry<EntityType<?>>> ENTITY_TYPE_KEY
public static final RegistryKey<Registry<Item>> ITEM_KEY
public static final RegistryKey<Registry<Potion>> POTION_KEY
public static final RegistryKey<Registry<ParticleType<?>>> PARTICLE_TYPE_KEY
public static final RegistryKey<Registry<BlockEntityType<?>>> BLOCK_ENTITY_TYPE_KEY
public static final RegistryKey<Registry<PaintingMotive>> MOTIVE_KEY
public static final RegistryKey<Registry<Identifier>> CUSTOM_STAT_KEY
public static final RegistryKey<Registry<ChunkStatus>> CHUNK_STATUS_KEY
public static final RegistryKey<Registry<RuleTestType<?>>> RULE_TEST_KEY
public static final RegistryKey<Registry<PosRuleTestType<?>>> POS_RULE_TEST_KEY
public static final RegistryKey<Registry<ScreenHandlerType<?>>> MENU_KEY
public static final RegistryKey<Registry<RecipeType<?>>> RECIPE_TYPE_KEY
public static final RegistryKey<Registry<RecipeSerializer<?>>> RECIPE_SERIALIZER_KEY
public static final RegistryKey<Registry<EntityAttribute>> ATTRIBUTE_KEY
public static final RegistryKey<Registry<StatType<?>>> STAT_TYPE_KEY
public static final RegistryKey<Registry<VillagerType>> VILLAGER_TYPE_KEY
public static final RegistryKey<Registry<VillagerProfession>> VILLAGER_PROFESSION_KEY
public static final RegistryKey<Registry<PointOfInterestType>> POINT_OF_INTEREST_TYPE_KEY
public static final RegistryKey<Registry<MemoryModuleType<?>>> MEMORY_MODULE_TYPE_KEY
public static final RegistryKey<Registry<SensorType<?>>> SENSOR_TYPE_KEY
public static final RegistryKey<Registry<Schedule>> SCHEDULE_KEY
public static final RegistryKey<Registry<Activity>> ACTIVITY_KEY
public static final RegistryKey<Registry<LootPoolEntryType>> LOOT_POOL_ENTRY_TYPE_KEY
public static final RegistryKey<Registry<LootFunctionType>> LOOT_FUNCTION_TYPE_KEY
public static final RegistryKey<Registry<LootConditionType>> LOOT_CONDITION_TYPE_KEY
public static final RegistryKey<Registry<DimensionType>> DIMENSION_TYPE_KEY
public static final RegistryKey<Registry<World>> DIMENSION
public static final RegistryKey<Registry<DimensionOptions>> DIMENSION_OPTIONS
public static final Registry<SoundEvent> SOUND_EVENT
public static final DefaultedRegistry<Fluid> FLUID
public static final Registry<StatusEffect> STATUS_EFFECT
public static final DefaultedRegistry<Block> BLOCK
public static final Registry<Enchantment> ENCHANTMENT
public static final DefaultedRegistry<EntityType<?>> ENTITY_TYPE
public static final DefaultedRegistry<Item> ITEM
public static final DefaultedRegistry<Potion> POTION
public static final Registry<ParticleType<?>> PARTICLE_TYPE
public static final Registry<BlockEntityType<?>> BLOCK_ENTITY_TYPE
public static final DefaultedRegistry<PaintingMotive> PAINTING_MOTIVE
public static final Registry<Identifier> CUSTOM_STAT
public static final DefaultedRegistry<ChunkStatus> CHUNK_STATUS
public static final Registry<RuleTestType<?>> RULE_TEST
public static final Registry<PosRuleTestType<?>> POS_RULE_TEST
public static final Registry<ScreenHandlerType<?>> SCREEN_HANDLER
public static final Registry<RecipeType<?>> RECIPE_TYPE
public static final Registry<RecipeSerializer<?>> RECIPE_SERIALIZER
public static final Registry<EntityAttribute> ATTRIBUTE
public static final DefaultedRegistry<VillagerType> VILLAGER_TYPE
public static final DefaultedRegistry<VillagerProfession> VILLAGER_PROFESSION
public static final DefaultedRegistry<PointOfInterestType> POINT_OF_INTEREST_TYPE
public static final DefaultedRegistry<MemoryModuleType<?>> MEMORY_MODULE_TYPE
public static final DefaultedRegistry<SensorType<?>> SENSOR_TYPE
public static final Registry<LootPoolEntryType> LOOT_POOL_ENTRY_TYPE
public static final Registry<LootFunctionType> LOOT_FUNCTION_TYPE
public static final Registry<LootConditionType> LOOT_CONDITION_TYPE
public static final RegistryKey<Registry<ChunkGeneratorSettings>> NOISE_SETTINGS_WORLDGEN
public static final RegistryKey<Registry<ConfiguredSurfaceBuilder<?>>> CONFIGURED_SURFACE_BUILDER_WORLDGEN
public static final RegistryKey<Registry<ConfiguredCarver<?>>> CONFIGURED_CARVER_WORLDGEN
public static final RegistryKey<Registry<ConfiguredFeature<?,?>>> CONFIGURED_FEATURE_WORLDGEN
public static final RegistryKey<Registry<ConfiguredStructureFeature<?,?>>> CONFIGURED_STRUCTURE_FEATURE_WORLDGEN
public static final RegistryKey<Registry<StructureProcessorList>> PROCESSOR_LIST_WORLDGEN
public static final RegistryKey<Registry<StructurePool>> TEMPLATE_POOL_WORLDGEN
public static final RegistryKey<Registry<Biome>> BIOME_KEY
public static final RegistryKey<Registry<SurfaceBuilder<?>>> SURFACE_BUILD_KEY
public static final Registry<SurfaceBuilder<?>> SURFACE_BUILDER
public static final RegistryKey<Registry<Carver<?>>> CARVER_KEY
public static final RegistryKey<Registry<Feature<?>>> FEATURE_KEY
public static final RegistryKey<Registry<StructureFeature<?>>> STRUCTURE_FEATURE_KEY
public static final Registry<StructureFeature<?>> STRUCTURE_FEATURE
public static final RegistryKey<Registry<StructurePieceType>> STRUCTURE_PIECE_KEY
public static final Registry<StructurePieceType> STRUCTURE_PIECE
public static final RegistryKey<Registry<Decorator<?>>> DECORATOR_KEY
public static final RegistryKey<Registry<BlockStateProviderType<?>>> BLOCK_STATE_PROVIDER_TYPE_KEY
public static final RegistryKey<Registry<BlockPlacerType<?>>> BLOCK_PLACER_TYPE_KEY
public static final RegistryKey<Registry<FoliagePlacerType<?>>> FOLIAGE_PLACER_TYPE_KEY
public static final RegistryKey<Registry<TrunkPlacerType<?>>> TRUNK_PLACER_TYPE_KEY
public static final RegistryKey<Registry<TreeDecoratorType<?>>> TREE_DECORATOR_TYPE_KEY
public static final RegistryKey<Registry<FeatureSizeType<?>>> FEATURE_SIZE_TYPE_KEY
public static final RegistryKey<Registry<com.mojang.serialization.Codec<? extends BiomeSource>>> BIOME_SOURCE_KEY
public static final RegistryKey<Registry<com.mojang.serialization.Codec<? extends ChunkGenerator>>> CHUNK_GENERATOR_KEY
public static final RegistryKey<Registry<StructureProcessorType<?>>> STRUCTURE_PROCESSOR_KEY
public static final RegistryKey<Registry<StructurePoolElementType<?>>> STRUCTURE_POOL_ELEMENT_KEY
public static final Registry<BlockStateProviderType<?>> BLOCK_STATE_PROVIDER_TYPE
public static final Registry<BlockPlacerType<?>> BLOCK_PLACER_TYPE
public static final Registry<FoliagePlacerType<?>> FOLIAGE_PLACER_TYPE
public static final Registry<TrunkPlacerType<?>> TRUNK_PLACER_TYPE
public static final Registry<TreeDecoratorType<?>> TREE_DECORATOR_TYPE
public static final Registry<FeatureSizeType<?>> FEATURE_SIZE_TYPE
public static final Registry<com.mojang.serialization.Codec<? extends BiomeSource>> BIOME_SOURCE
public static final Registry<com.mojang.serialization.Codec<? extends ChunkGenerator>> CHUNK_GENERATOR
public static final Registry<StructureProcessorType<?>> STRUCTURE_PROCESSOR
public static final Registry<StructurePoolElementType<?>> STRUCTURE_POOL_ELEMENT
private final RegistryKey<? extends Registry<T>> registryKey
private final com.mojang.serialization.Lifecycle lifecycle
protected Registry(RegistryKey<? extends Registry<T>> key, com.mojang.serialization.Lifecycle lifecycle)
private static <T> RegistryKey<Registry<T>> createRegistryKey(String registryId)
public static <T extends MutableRegistry<?>> void validate(MutableRegistry<T> registry)
private static <T> Registry<T> create(RegistryKey<? extends Registry<T>> registryKey, 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, 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,R extends MutableRegistry<T>> R create(RegistryKey<? extends Registry<T>> registryKey, R registry, Supplier<T> defaultEntry, com.mojang.serialization.Lifecycle lifecycle)
public RegistryKey<? extends Registry<T>> getKey()
public <U> com.mojang.serialization.DataResult<com.mojang.datafixers.util.Pair<T,U>> decode(com.mojang.serialization.DynamicOps<U> dynamicOps, U u)
decode
in interface com.mojang.serialization.Decoder<T>
public <U> com.mojang.serialization.DataResult<U> encode(T t, com.mojang.serialization.DynamicOps<U> dynamicOps, U u)
encode
in interface com.mojang.serialization.Encoder<T>
public <U> Stream<U> keys(com.mojang.serialization.DynamicOps<U> dynamicOps)
keys
in interface com.mojang.serialization.Keyable
@Nullable public abstract Identifier getId(T entry)
public abstract Optional<RegistryKey<T>> getKey(T entry)
public abstract int getRawId(@Nullable T entry)
getRawId
in interface IndexedIterable<T>
@Nullable public abstract T get(@Nullable RegistryKey<T> key)
@Nullable public abstract T get(@Nullable Identifier id)
protected abstract com.mojang.serialization.Lifecycle getEntryLifecycle(T t)
public abstract com.mojang.serialization.Lifecycle getLifecycle()
public Optional<T> getOrEmpty(@Nullable Identifier id)
@Environment(value=CLIENT) public Optional<T> getOrEmpty(@Nullable RegistryKey<T> key)
public T getOrThrow(RegistryKey<T> key)
IllegalStateException
- if the entry was not present in the registrypublic abstract Set<Identifier> getIds()
public abstract Set<Map.Entry<RegistryKey<T>,T>> getEntries()
@Environment(value=CLIENT) public abstract boolean containsId(Identifier id)
public static <V,T extends V> T register(Registry<V> registry, Identifier id, T entry)