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>
,HolderGetter<T>
,HolderLookup<T>
,HolderLookup.RegistryLookup<T>
,HolderOwner<T>
,IdMap<T>
,Registry<T>
,WritableRegistry<T>
,IRegistryExtension<T>
- Direct Known Subclasses:
DefaultedMappedRegistry
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface net.minecraft.core.HolderLookup
HolderLookup.Provider, HolderLookup.RegistryLookup<T>
Nested classes/interfaces inherited from interface net.minecraft.core.HolderLookup.RegistryLookup
HolderLookup.RegistryLookup.Delegate<T>
Nested classes/interfaces inherited from interface net.minecraft.core.Registry
Registry.PendingTags<T>
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) MappedRegistry.TagSet
<T> private 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 boolean
private final Map
<TagKey<T>, HolderSet.Named<T>> private final ResourceKey
<? extends Registry<T>> private final Map
<ResourceKey<T>, RegistrationInfo> private com.mojang.serialization.Lifecycle
private final it.unimi.dsi.fastutil.objects.Reference2IntMap
<T> private Map
<T, Holder.Reference<T>> Fields inherited from class net.neoforged.neoforge.registries.BaseMappedRegistry
addCallbacks, bakeCallbacks, clearCallbacks
-
Constructor Summary
ConstructorsConstructorDescriptionMappedRegistry
(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 Summary
Modifier and TypeMethodDescriptionvoid
void
byId
(int p_122684_) protected void
clear
(boolean full) boolean
containsKey
(ResourceKey<T> p_175392_) boolean
containsKey
(ResourceLocation p_122761_) boolean
containsValue
(T value) Returnstrue
if this registry contains thevalue
.createIntrusiveHolder
(T p_205915_) private HolderSet.Named
<T> Set
<Map.Entry<ResourceKey<T>, T>> entrySet()
freeze()
get
(int p_205907_) get
(ResourceKey<T> p_205905_) get
(ResourceLocation p_316743_) getAny()
int
getId
(ResourceKey<T> key) Gets the integer id linked to the given key.int
getId
(ResourceLocation name) Gets the integer id linked to the given name.int
(package private) Holder.Reference
<T> getOrCreateHolderOrThrow
(ResourceKey<T> p_248831_) (package private) HolderSet.Named
<T> getOrCreateTagForRegistration
(TagKey<T> p_364545_) getRandom
(RandomSource p_235716_) getResourceKey
(T p_122755_) getTags()
getValue
(ResourceKey<T> p_122714_) getValue
(ResourceLocation p_122739_) private static <T> T
getValueFromNullable
(Holder.Reference<T> p_205866_) boolean
isEmpty()
iterator()
ResourceKey
<? extends Registry<T>> key()
keySet()
listTags()
prepareTagReload
(TagLoader.LoadResult<T> p_364128_) (package private) void
register
(int id, ResourceKey<T> p_256252_, T p_256591_, RegistrationInfo p_326235_) register
(ResourceKey<T> p_256252_, T p_256591_, RegistrationInfo p_326235_) protected void
registerIdMapping
(ResourceKey<T> key, int id) Register a key invalid input: '<'-> ID mapping.registrationInfo
(ResourceKey<T> p_326067_) Set
<ResourceKey<T>> com.mojang.serialization.Lifecycle
int
size()
toString()
void
unfreeze
(boolean clearTags) Deprecated.Forge: For internal use only.private Holder.Reference
<T> validateAndUnwrapTagElement
(TagKey<T> p_361125_, Holder<T> p_363196_) private void
private void
validateWrite
(ResourceKey<T> p_205922_) wrapAsHolder
(T p_263356_) Methods inherited from class net.neoforged.neoforge.registries.BaseMappedRegistry
addAlias, addCallback, doesSync, getData, getDataMap, getDataMaps, 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.HolderGetter
getOrThrow, getOrThrow
Methods inherited from interface net.minecraft.core.HolderLookup
listElementIds, listTagIds
Methods inherited from interface net.minecraft.core.HolderLookup.RegistryLookup
filterElements, filterFeatures, getData
Methods inherited from interface net.minecraft.core.HolderOwner
canSerializeIn
Methods inherited from interface net.minecraft.core.IdMap
byIdOrThrow, getIdOrThrow
Methods inherited from interface net.neoforged.neoforge.registries.IRegistryExtension
addAlias, addCallback, addCallback, doesSync, getDataMap, getKeyOrNull, getMaxId, resolve, resolve
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface net.minecraft.core.Registry
asHolderIdMap, byNameCodec, getOptional, getOptional, getRandomElementOf, getTagOrEmpty, getValueOrThrow, holderByNameCodec, keys, stream
-
Field Details
-
key
-
byId
-
toId
-
byLocation
-
byKey
-
byValue
-
registrationInfos
-
registryLifecycle
private com.mojang.serialization.Lifecycle registryLifecycle -
frozenTags
-
allTags
MappedRegistry.TagSet<T> allTags -
frozen
private boolean frozen -
unregisteredIntrusiveHolders
-
-
Constructor Details
-
MappedRegistry
public MappedRegistry(ResourceKey<? extends Registry<T>> p_249899_, com.mojang.serialization.Lifecycle p_252249_) -
MappedRegistry
public MappedRegistry(ResourceKey<? extends Registry<T>> p_252132_, com.mojang.serialization.Lifecycle p_249215_, boolean p_251014_)
-
-
Method Details
-
listTags
- Specified by:
listTags
in interfaceHolderLookup<T>
-
key
-
toString
-
validateWrite
private void validateWrite() -
validateWrite
-
register
public Holder.Reference<T> register(ResourceKey<T> p_256252_, T p_256591_, RegistrationInfo p_326235_) - Specified by:
register
in interfaceWritableRegistry<T>
-
register
public Holder.Reference<T> register(int id, ResourceKey<T> p_256252_, T p_256591_, RegistrationInfo p_326235_) -
getKey
-
getResourceKey
- Specified by:
getResourceKey
in interfaceRegistry<T>
-
getId
-
getValue
-
byId
-
get
-
get
-
get
- Specified by:
get
in interfaceHolderGetter<T>
-
getAny
-
wrapAsHolder
- Specified by:
wrapAsHolder
in interfaceRegistry<T>
-
getOrCreateHolderOrThrow
-
size
public int size() -
registrationInfo
- Specified by:
registrationInfo
in interfaceRegistry<T>
-
registryLifecycle
public com.mojang.serialization.Lifecycle registryLifecycle()- Specified by:
registryLifecycle
in interfaceHolderLookup.RegistryLookup<T>
-
iterator
-
getValue
-
getValueFromNullable
-
keySet
-
registryKeySet
- Specified by:
registryKeySet
in interfaceRegistry<T>
-
entrySet
-
listElements
- Specified by:
listElements
in interfaceHolderLookup<T>
-
getTags
-
getOrCreateTagForRegistration
-
createTag
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceWritableRegistry<T>
-
getRandom
-
containsKey
- Specified by:
containsKey
in interfaceRegistry<T>
-
containsKey
- Specified by:
containsKey
in interfaceRegistry<T>
-
unfreeze
Deprecated.Forge: For internal use only. Use the Register events when registering values.- Specified by:
unfreeze
in classBaseMappedRegistry<T>
-
freeze
-
createIntrusiveHolder
- Specified by:
createIntrusiveHolder
in interfaceRegistry<T>
-
get
- Specified by:
get
in interfaceHolderGetter<T>
-
validateAndUnwrapTagElement
-
bindTag
- Specified by:
bindTag
in interfaceWritableRegistry<T>
-
refreshTagsInHolders
void refreshTagsInHolders() -
bindAllTagsToEmpty
public void bindAllTagsToEmpty() -
createRegistrationLookup
- Specified by:
createRegistrationLookup
in interfaceWritableRegistry<T>
-
prepareTagReload
- Specified by:
prepareTagReload
in interfaceRegistry<T>
-
clear
protected void clear(boolean full) - Overrides:
clear
in classBaseMappedRegistry<T>
-
registerIdMapping
Description copied from class:BaseMappedRegistry
Register a key invalid input: '<'-> ID mapping. The IDs must be registered in increasing order.- Specified by:
registerIdMapping
in classBaseMappedRegistry<T>
-
getId
Description copied from interface:IRegistryExtension
Gets 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-1
if the registry is not defaulted- Specified by:
getId
in interfaceIRegistryExtension<T>
- Overrides:
getId
in classBaseMappedRegistry<T>
- Parameters:
name
- the resource name to lookup- Returns:
- the integer id linked to the given name
-
getId
Description copied from interface:IRegistryExtension
Gets 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-1
if the registry is not defaulted- Specified by:
getId
in interfaceIRegistryExtension<T>
- Overrides:
getId
in classBaseMappedRegistry<T>
- Parameters:
key
- the resource key to lookup- Returns:
- the integer id linked to the given key
-
containsValue
Description copied from interface:IRegistryExtension
Returnstrue
if this registry contains thevalue
.- Specified by:
containsValue
in interfaceIRegistryExtension<T>
- Parameters:
value
- the object whose existence to check for- Returns:
true
if this registry contains thevalue
-