public class SimpleRegistry<T> extends MutableRegistry<T>
Modifier and Type | Class and Description |
---|---|
static class |
SimpleRegistry.RegistryManagerEntry<T> |
Modifier and Type | Field and Description |
---|---|
private Map<T,com.mojang.serialization.Lifecycle> |
entryToLifecycle |
private it.unimi.dsi.fastutil.objects.Object2IntMap<T> |
entryToRawId |
private BiMap<Identifier,T> |
idToEntry |
private BiMap<RegistryKey<T>,T> |
keyToEntry |
private com.mojang.serialization.Lifecycle |
lifecycle |
protected static Logger |
LOGGER |
private int |
nextId |
protected Object[] |
randomEntries |
private it.unimi.dsi.fastutil.objects.ObjectList<T> |
rawIdToEntry |
ACTIVITY, ACTIVITY_KEY, ATTRIBUTE, ATTRIBUTE_KEY, BIOME_KEY, BIOME_SOURCE, BIOME_SOURCE_KEY, BLOCK, BLOCK_ENTITY_TYPE, BLOCK_ENTITY_TYPE_KEY, BLOCK_KEY, BLOCK_PLACER_TYPE, BLOCK_PLACER_TYPE_KEY, BLOCK_STATE_PROVIDER_TYPE, BLOCK_STATE_PROVIDER_TYPE_KEY, CARVER, CARVER_KEY, CHUNK_GENERATOR, CHUNK_GENERATOR_KEY, CHUNK_STATUS, CHUNK_STATUS_KEY, CONFIGURED_CARVER_WORLDGEN, CONFIGURED_FEATURE_WORLDGEN, CONFIGURED_STRUCTURE_FEATURE_WORLDGEN, CONFIGURED_SURFACE_BUILDER_WORLDGEN, CUSTOM_STAT, CUSTOM_STAT_KEY, DECORATOR, DECORATOR_KEY, DIMENSION, DIMENSION_OPTIONS, DIMENSION_TYPE_KEY, ENCHANTMENT, ENCHANTMENT_KEY, ENTITY_TYPE, ENTITY_TYPE_KEY, FEATURE, FEATURE_KEY, FEATURE_SIZE_TYPE, FEATURE_SIZE_TYPE_KEY, FLUID, FLUID_KEY, FOLIAGE_PLACER_TYPE, FOLIAGE_PLACER_TYPE_KEY, ITEM, ITEM_KEY, LOOT_CONDITION_TYPE, LOOT_CONDITION_TYPE_KEY, LOOT_FUNCTION_TYPE, LOOT_FUNCTION_TYPE_KEY, LOOT_POOL_ENTRY_TYPE, LOOT_POOL_ENTRY_TYPE_KEY, MEMORY_MODULE_TYPE, MEMORY_MODULE_TYPE_KEY, MENU_KEY, MOB_EFFECT_KEY, MOTIVE_KEY, NOISE_SETTINGS_WORLDGEN, PAINTING_MOTIVE, PARTICLE_TYPE, PARTICLE_TYPE_KEY, POINT_OF_INTEREST_TYPE, POINT_OF_INTEREST_TYPE_KEY, POS_RULE_TEST, POS_RULE_TEST_KEY, POTION, POTION_KEY, PROCESSOR_LIST_WORLDGEN, RECIPE_SERIALIZER, RECIPE_SERIALIZER_KEY, RECIPE_TYPE, RECIPE_TYPE_KEY, REGISTRIES, ROOT, ROOT_KEY, RULE_TEST, RULE_TEST_KEY, SCHEDULE, SCHEDULE_KEY, SCREEN_HANDLER, SENSOR_TYPE, SENSOR_TYPE_KEY, SOUND_EVENT, SOUND_EVENT_KEY, STAT_TYPE, STAT_TYPE_KEY, STATUS_EFFECT, STRUCTURE_FEATURE, STRUCTURE_FEATURE_KEY, STRUCTURE_PIECE, STRUCTURE_PIECE_KEY, STRUCTURE_POOL_ELEMENT, STRUCTURE_POOL_ELEMENT_KEY, STRUCTURE_PROCESSOR, STRUCTURE_PROCESSOR_KEY, SURFACE_BUILD_KEY, SURFACE_BUILDER, TEMPLATE_POOL_WORLDGEN, TREE_DECORATOR_TYPE, TREE_DECORATOR_TYPE_KEY, TRUNK_PLACER_TYPE, TRUNK_PLACER_TYPE_KEY, VILLAGER_PROFESSION, VILLAGER_PROFESSION_KEY, VILLAGER_TYPE, VILLAGER_TYPE_KEY
Constructor and Description |
---|
SimpleRegistry(RegistryKey<? extends Registry<T>> key,
com.mojang.serialization.Lifecycle lifecycle) |
Modifier and Type | Method and Description |
---|---|
<V extends T> |
add(RegistryKey<T> key,
V entry,
com.mojang.serialization.Lifecycle lifecycle) |
boolean |
containsId(Identifier id) |
static <T> com.mojang.serialization.Codec<SimpleRegistry<T>> |
createCodec(RegistryKey<? extends Registry<T>> registryKey,
com.mojang.serialization.Lifecycle lifecycle,
com.mojang.serialization.Codec<T> entryCodec) |
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) |
static <T> com.mojang.serialization.Codec<SimpleRegistry<T>> |
createRegistryManagerCodec(RegistryKey<? extends Registry<T>> registryKey,
com.mojang.serialization.Lifecycle lifecycle,
com.mojang.serialization.Codec<T> entryCodec) |
static <T> com.mojang.serialization.MapCodec<SimpleRegistry.RegistryManagerEntry<T>> |
createRegistryManagerEntryCodec(RegistryKey<? extends Registry<T>> registryKey,
com.mojang.serialization.MapCodec<T> entryCodec) |
T |
get(Identifier id) |
T |
get(int index) |
T |
get(RegistryKey<T> key) |
Set<Map.Entry<RegistryKey<T>,T>> |
getEntries() |
com.mojang.serialization.Lifecycle |
getEntryLifecycle(T t)
Gets the lifecycle of a registry entry.
|
Identifier |
getId(T entry) |
Set<Identifier> |
getIds() |
Optional<RegistryKey<T>> |
getKey(T entry) |
com.mojang.serialization.Lifecycle |
getLifecycle() |
T |
getRandom(Random random) |
int |
getRawId(T entry) |
Iterator<T> |
iterator() |
<V extends T> |
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.
|
<V extends T> |
set(int rawId,
RegistryKey<T> key,
V entry,
com.mojang.serialization.Lifecycle lifecycle) |
private <V extends T> |
set(int rawId,
RegistryKey<T> key,
V entry,
com.mojang.serialization.Lifecycle lifecycle,
boolean checkDuplicateKeys) |
decode, encode, getKey, getOrEmpty, getOrEmpty, getOrThrow, keys, register, register, register, stream, toString, validate
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
forEach, spliterator
protected static final Logger LOGGER
private final it.unimi.dsi.fastutil.objects.ObjectList<T> rawIdToEntry
private final it.unimi.dsi.fastutil.objects.Object2IntMap<T> entryToRawId
private final BiMap<Identifier,T> idToEntry
private final BiMap<RegistryKey<T>,T> keyToEntry
private com.mojang.serialization.Lifecycle lifecycle
protected Object[] randomEntries
private int nextId
public SimpleRegistry(RegistryKey<? extends Registry<T>> key, com.mojang.serialization.Lifecycle lifecycle)
public static <T> com.mojang.serialization.MapCodec<SimpleRegistry.RegistryManagerEntry<T>> createRegistryManagerEntryCodec(RegistryKey<? extends Registry<T>> registryKey, com.mojang.serialization.MapCodec<T> entryCodec)
public <V extends T> V set(int rawId, RegistryKey<T> key, V entry, com.mojang.serialization.Lifecycle lifecycle)
set
in class MutableRegistry<T>
private <V extends T> V set(int rawId, RegistryKey<T> key, V entry, com.mojang.serialization.Lifecycle lifecycle, boolean checkDuplicateKeys)
public <V extends T> V add(RegistryKey<T> key, V entry, com.mojang.serialization.Lifecycle lifecycle)
add
in class MutableRegistry<T>
public <V extends T> V replace(OptionalInt rawId, RegistryKey<T> key, V newEntry, com.mojang.serialization.Lifecycle lifecycle)
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.
replace
in class MutableRegistry<T>
public com.mojang.serialization.Lifecycle getEntryLifecycle(T t)
getEntryLifecycle
in class Registry<T>
public com.mojang.serialization.Lifecycle getLifecycle()
getLifecycle
in class Registry<T>
public Set<Identifier> getIds()
public Set<Map.Entry<RegistryKey<T>,T>> getEntries()
getEntries
in class Registry<T>
@Environment(value=CLIENT) public boolean containsId(Identifier id)
containsId
in class Registry<T>
public static <T> com.mojang.serialization.Codec<SimpleRegistry<T>> createRegistryManagerCodec(RegistryKey<? extends Registry<T>> registryKey, com.mojang.serialization.Lifecycle lifecycle, com.mojang.serialization.Codec<T> entryCodec)
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)
public static <T> com.mojang.serialization.Codec<SimpleRegistry<T>> createCodec(RegistryKey<? extends Registry<T>> registryKey, com.mojang.serialization.Lifecycle lifecycle, com.mojang.serialization.Codec<T> entryCodec)