Package net.minecraft.core
Class DefaultedMappedRegistry<T>
java.lang.Object
net.neoforged.neoforge.registries.BaseMappedRegistry<T>
net.minecraft.core.MappedRegistry<T>
net.minecraft.core.DefaultedMappedRegistry<T>
- All Implemented Interfaces:
com.mojang.serialization.Keyable
,Iterable<T>
,DefaultedRegistry<T>
,IdMap<T>
,Registry<T>
,WritableRegistry<T>
,IRegistryExtension<T>
-
Field Summary
FieldsFields inherited from class net.minecraft.core.MappedRegistry
key
Fields inherited from class net.neoforged.neoforge.registries.BaseMappedRegistry
addCallbacks, bakeCallbacks, clearCallbacks
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultedMappedRegistry
(String pDefaultKey, ResourceKey<? extends Registry<T>> pKey, com.mojang.serialization.Lifecycle pRegistryLifecycle, boolean pHasIntrusiveHolders) -
Method Summary
Modifier and TypeMethodDescriptionbyId
(int pId) get
(ResourceLocation pName) getAny()
int
getKeyOrNull
(T element) Returns the key of the element, or null if it is not present in this registry.getOptional
(ResourceLocation pName) getRandom
(RandomSource pRandom) register
(ResourceKey<T> pKey, T pValue, RegistrationInfo pRegistrationInfo) Methods inherited from class net.minecraft.core.MappedRegistry
asLookup, bindTags, clear, containsKey, containsKey, containsValue, createIntrusiveHolder, createRegistrationLookup, entrySet, freeze, get, getHolder, getHolder, getHolder, getId, getId, getOrCreateHolderOrThrow, getOrCreateTag, getResourceKey, getTag, getTagNames, getTags, holderOwner, holders, isEmpty, iterator, key, keySet, register, registerIdMapping, registrationInfo, registryKeySet, registryLifecycle, resetTags, size, toString, unfreeze, wrapAsHolder
Methods inherited from class net.neoforged.neoforge.registries.BaseMappedRegistry
addAlias, addCallback, doesSync, getData, getDataMap, getMaxId, resolve, resolve
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.core.IdMap
byIdOrThrow, getIdOrThrow, size
Methods inherited from interface net.neoforged.neoforge.registries.IRegistryExtension
addAlias, addCallback, addCallback, containsValue, doesSync, getData, getDataMap, getId, getId, getMaxId, resolve, resolve
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
Methods inherited from interface net.minecraft.core.Registry
asHolderIdMap, asLookup, asTagAddingLookup, bindTags, byNameCodec, containsKey, containsKey, createIntrusiveHolder, entrySet, freeze, get, getHolder, getHolder, getHolder, getHolderOrThrow, getOptional, getOrCreateTag, getOrThrow, getRandomElementOf, getResourceKey, getTag, getTagNames, getTagOrEmpty, getTags, holderByNameCodec, holderOwner, holders, key, keys, keySet, registrationInfo, registryKeySet, registryLifecycle, resetTags, stream, wrapAsHolder
-
Field Details
-
defaultKey
-
defaultValue
-
-
Constructor Details
-
DefaultedMappedRegistry
public DefaultedMappedRegistry(String pDefaultKey, ResourceKey<? extends Registry<T>> pKey, com.mojang.serialization.Lifecycle pRegistryLifecycle, boolean pHasIntrusiveHolders)
-
-
Method Details
-
register
public Holder.Reference<T> register(ResourceKey<T> pKey, T pValue, RegistrationInfo pRegistrationInfo) - Specified by:
register
in interfaceWritableRegistry<T>
- Overrides:
register
in classMappedRegistry<T>
-
getId
-
getKey
- Specified by:
getKey
in interfaceDefaultedRegistry<T>
- Specified by:
getKey
in interfaceRegistry<T>
- Overrides:
getKey
in classMappedRegistry<T>
- Returns:
- the name used to identify the given object within this registry or
null
if the object is not within this registry
-
getKeyOrNull
Description copied from interface:IRegistryExtension
Returns the key of the element, or null if it is not present in this registry.- Specified by:
getKeyOrNull
in interfaceIRegistryExtension<T>
- Returns:
- the key of the element, or null if it is not present in this registry
-
get
- Specified by:
get
in interfaceDefaultedRegistry<T>
- Specified by:
get
in interfaceRegistry<T>
- Overrides:
get
in classMappedRegistry<T>
-
getOptional
- Specified by:
getOptional
in interfaceRegistry<T>
-
getAny
-
byId
- Specified by:
byId
in interfaceDefaultedRegistry<T>
- Specified by:
byId
in interfaceIdMap<T>
- Overrides:
byId
in classMappedRegistry<T>
-
getRandom
-
getDefaultKey
- Specified by:
getDefaultKey
in interfaceDefaultedRegistry<T>
-