Package net.minecraft.core
Class MappedRegistry<T>
java.lang.Object
net.neoforged.neoforge.registries.BaseMappedRegistry<T>
net.minecraft.core.MappedRegistry<T>
- All Implemented Interfaces:
- com.mojang.serialization.Keyable,- Iterable<T>,- IdMap<T>,- Registry<T>,- WritableRegistry<T>,- IRegistryExtension<T>
- Direct Known Subclasses:
- DefaultedMappedRegistry
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate final it.unimi.dsi.fastutil.objects.ObjectList<Holder.Reference<T>>private final Map<ResourceKey<T>,Holder.Reference<T>> private final Map<ResourceLocation,Holder.Reference<T>> private final Map<T,Holder.Reference<T>> private booleanprivate List<Holder.Reference<T>>(package private) final ResourceKey<? extends Registry<T>>private static final org.slf4j.Loggerprivate final HolderLookup.RegistryLookup<T>private intprivate com.mojang.serialization.Lifecycleprivate Map<TagKey<T>,HolderSet.Named<T>> private final it.unimi.dsi.fastutil.objects.Reference2IntMap<T>protected Map<T,Holder.Reference<T>> Fields inherited from class net.neoforged.neoforge.registries.BaseMappedRegistryaddCallbacks, bakeCallbacks, clearCallbacks
- 
Constructor SummaryConstructorsConstructorDescriptionMappedRegistry(ResourceKey<? extends Registry<T>> p_249899_, com.mojang.serialization.Lifecycle p_252249_) MappedRegistry(ResourceKey<? extends Registry<T>> p_252132_, com.mojang.serialization.Lifecycle p_249215_, boolean p_251014_) 
- 
Method SummaryModifier and TypeMethodDescriptionasLookup()voidbyId(int p_122684_) protected voidclear(boolean full) booleancontainsKey(ResourceKey<T> p_175392_) booleancontainsKey(ResourceLocation p_122761_) booleancontainsValue(T value) Returnstrueif this registry contains thevalue.createIntrusiveHolder(T p_205915_) private HolderSet.Named<T>Set<Map.Entry<ResourceKey<T>,T>> entrySet()freeze()get(ResourceKey<T> p_122714_) get(ResourceLocation p_122739_) getHolder(int p_205907_) getHolder(ResourceKey<T> p_205905_) intgetId(ResourceKey<T> key) Gets the integer id linked to the given key.intgetId(ResourceLocation name) Gets the integer id linked to the given name.int(package private) Holder.Reference<T>getOrCreateHolderOrThrow(ResourceKey<T> p_248831_) getOrCreateTag(TagKey<T> p_205895_) getRandom(RandomSource p_235716_) getResourceKey(T p_122755_) Stream<com.mojang.datafixers.util.Pair<TagKey<T>,HolderSet.Named<T>>> getTags()private static <T> TgetValueFromNullable(Holder.Reference<T> p_205866_) holders()private List<Holder.Reference<T>>booleanisEmpty()iterator()ResourceKey<? extends Registry<T>>key()keySet()com.mojang.serialization.Lifecycleregister(ResourceKey<T> p_256252_, T p_256591_, com.mojang.serialization.Lifecycle p_256255_) protected voidregisterIdMapping(ResourceKey<T> key, int id) Register a key invalid input: '<'-> ID mapping.registerMapping(int p_256563_, ResourceKey<T> p_256594_, T p_256374_, com.mojang.serialization.Lifecycle p_256469_) Set<ResourceKey<T>>com.mojang.serialization.Lifecyclevoidintsize()toString()voidunfreeze()Deprecated.Forge: For internal use only.private voidprivate voidvalidateWrite(ResourceKey<T> p_205922_) wrapAsHolder(T p_263356_) Methods inherited from class net.neoforged.neoforge.registries.BaseMappedRegistryaddAlias, addCallback, doesSync, getData, getDataMap, getMaxId, resolve, resolveMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.core.IdMapbyIdOrThrowMethods inherited from interface net.neoforged.neoforge.registries.IRegistryExtensionaddAlias, addCallback, addCallback, doesSync, getData, getDataMap, getMaxId, resolve, resolveMethods inherited from interface java.lang.IterableforEach, spliteratorMethods inherited from interface net.minecraft.core.RegistryasHolderIdMap, asTagAddingLookup, byNameCodec, getHolderOrThrow, getOptional, getOptional, getOrThrow, getTagOrEmpty, holderByNameCodec, keys, stream
- 
Field Details- 
LOGGERprivate static final org.slf4j.Logger LOGGER
- 
key
- 
byId
- 
toId
- 
byLocation
- 
byKey
- 
byValue
- 
lifecycles
- 
registryLifecycleprivate com.mojang.serialization.Lifecycle registryLifecycle
- 
tags
- 
frozenprivate boolean frozen
- 
unregisteredIntrusiveHolders
- 
holdersInOrder
- 
nextIdprivate int nextId
- 
lookup
 
- 
- 
Constructor Details- 
MappedRegistrypublic MappedRegistry(ResourceKey<? extends Registry<T>> p_249899_, com.mojang.serialization.Lifecycle p_252249_) 
- 
MappedRegistrypublic MappedRegistry(ResourceKey<? extends Registry<T>> p_252132_, com.mojang.serialization.Lifecycle p_249215_, boolean p_251014_) 
 
- 
- 
Method Details- 
key
- 
toString
- 
holdersInOrder
- 
validateWriteprivate void validateWrite()
- 
validateWrite
- 
registerMappingpublic Holder.Reference<T> registerMapping(int p_256563_, ResourceKey<T> p_256594_, T p_256374_, com.mojang.serialization.Lifecycle p_256469_) 
- 
registerpublic Holder.Reference<T> register(ResourceKey<T> p_256252_, T p_256591_, com.mojang.serialization.Lifecycle p_256255_) - Specified by:
- registerin interface- WritableRegistry<T>
 
- 
getKey
- 
getResourceKey- Specified by:
- getResourceKeyin interface- Registry<T>
 
- 
getId
- 
get
- 
byId
- 
getHolder
- 
getHolder
- 
wrapAsHolder- Specified by:
- wrapAsHolderin interface- Registry<T>
 
- 
getOrCreateHolderOrThrow
- 
sizepublic int size()
- 
lifecycle
- 
registryLifecyclepublic com.mojang.serialization.Lifecycle registryLifecycle()- Specified by:
- registryLifecyclein interface- Registry<T>
 
- 
iterator
- 
get
- 
getValueFromNullable
- 
keySet
- 
registryKeySet- Specified by:
- registryKeySetin interface- Registry<T>
 
- 
entrySet
- 
holders
- 
getTags
- 
getOrCreateTag- Specified by:
- getOrCreateTagin interface- Registry<T>
 
- 
createTag
- 
getTagNames- Specified by:
- getTagNamesin interface- Registry<T>
 
- 
isEmptypublic boolean isEmpty()- Specified by:
- isEmptyin interface- WritableRegistry<T>
 
- 
getRandom
- 
containsKey- Specified by:
- containsKeyin interface- Registry<T>
 
- 
containsKey- Specified by:
- containsKeyin interface- Registry<T>
 
- 
unfreezeDeprecated.Forge: For internal use only. Use the Register events when registering values.- Specified by:
- unfreezein class- BaseMappedRegistry<T>
 
- 
freeze
- 
createIntrusiveHolder- Specified by:
- createIntrusiveHolderin interface- Registry<T>
 
- 
getTag
- 
bindTags
- 
resetTagspublic void resetTags()
- 
createRegistrationLookup- Specified by:
- createRegistrationLookupin interface- WritableRegistry<T>
 
- 
holderOwner- Specified by:
- holderOwnerin interface- Registry<T>
 
- 
asLookup
- 
clearprotected void clear(boolean full) - Overrides:
- clearin class- BaseMappedRegistry<T>
 
- 
registerIdMappingDescription copied from class:BaseMappedRegistryRegister a key invalid input: '<'-> ID mapping. The IDs must be registered in increasing order.- Specified by:
- registerIdMappingin class- BaseMappedRegistry<T>
 
- 
getIdDescription copied from interface:IRegistryExtensionGets the integer id linked to the given name. If the name is not present in the registry, the default entry's integer id is returned if the registry is defaulted or-1if the registry is not defaulted- Specified by:
- getIdin interface- IRegistryExtension<T>
- Overrides:
- getIdin class- BaseMappedRegistry<T>
- Parameters:
- name- the resource name to lookup
- Returns:
- the integer id linked to the given name
 
- 
getIdDescription copied from interface:IRegistryExtensionGets the integer id linked to the given key. If the key is not present in the registry, the default entry's integer id is returned if the registry is defaulted or-1if the registry is not defaulted- Specified by:
- getIdin interface- IRegistryExtension<T>
- Overrides:
- getIdin class- BaseMappedRegistry<T>
- Parameters:
- key- the resource key to lookup
- Returns:
- the integer id linked to the given key
 
- 
containsValueDescription copied from interface:IRegistryExtensionReturnstrueif this registry contains thevalue.- Specified by:
- containsValuein interface- IRegistryExtension<T>
- Parameters:
- value- the object whose existence to check for
- Returns:
- trueif this registry contains the- value
 
 
-