Package net.minecraft.core
Class MappedRegistry<T>
java.lang.Object
net.minecraft.core.MappedRegistry<T>
- All Implemented Interfaces:
com.mojang.serialization.Keyable
,Iterable<T>
,IdMap<T>
,Registry<T>
,WritableRegistry<T>
- Direct Known Subclasses:
DefaultedMappedRegistry
,NamespacedWrapper
-
Field Summary
Modifier 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 boolean
private List<Holder.Reference<T>>
(package private) final ResourceKey<? extends Registry<T>>
private static final Set<ResourceLocation>
private static final org.slf4j.Logger
private final HolderLookup.RegistryLookup<T>
private int
private com.mojang.serialization.Lifecycle
private Map<TagKey<T>,
HolderSet.Named<T>> private final it.unimi.dsi.fastutil.objects.Object2IntMap<T>
protected Map<T,
Holder.Reference<T>> -
Constructor Summary
ConstructorDescriptionMappedRegistry
(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 TypeMethodDescriptionasLookup()
void
byId
(int p_122684_) boolean
containsKey
(ResourceKey<T> p_175392_) boolean
containsKey
(ResourceLocation p_122761_) 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_) int
static Set<ResourceLocation>
(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> T
getValueFromNullable
(Holder.Reference<T> p_205866_) holders()
private List<Holder.Reference<T>>
boolean
isEmpty()
iterator()
ResourceKey<? extends Registry<T>>
key()
keySet()
com.mojang.serialization.Lifecycle
protected final void
register
(ResourceKey<T> p_256252_, T p_256591_, com.mojang.serialization.Lifecycle p_256255_) registerMapping
(int p_256563_, ResourceKey<T> p_256594_, T p_256374_, com.mojang.serialization.Lifecycle p_256469_) Set<ResourceKey<T>>
com.mojang.serialization.Lifecycle
void
int
size()
toString()
void
unfreeze()
Deprecated.Forge: For internal use only.private void
private void
validateWrite
(ResourceKey<T> p_205922_) wrapAsHolder
(T p_263356_) 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
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface net.minecraft.core.Registry
asHolderIdMap, asTagAddingLookup, byNameCodec, getHolderOrThrow, getOptional, getOptional, getOrThrow, getTagOrEmpty, holderByNameCodec, keys, stream
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
key
-
byId
-
toId
-
byLocation
-
byKey
-
byValue
-
lifecycles
-
registryLifecycle
private com.mojang.serialization.Lifecycle registryLifecycle -
tags
-
frozen
private boolean frozen -
unregisteredIntrusiveHolders
-
holdersInOrder
-
nextId
private int nextId -
lookup
-
KNOWN
-
-
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
-
key
-
toString
-
holdersInOrder
-
validateWrite
private void validateWrite() -
validateWrite
-
getKnownRegistries
-
markKnown
protected final void markKnown() -
registerMapping
public Holder.Reference<T> registerMapping(int p_256563_, ResourceKey<T> p_256594_, T p_256374_, com.mojang.serialization.Lifecycle p_256469_) - Specified by:
registerMapping
in interfaceWritableRegistry<T>
-
register
public Holder.Reference<T> register(ResourceKey<T> p_256252_, T p_256591_, com.mojang.serialization.Lifecycle p_256255_) - Specified by:
register
in interfaceWritableRegistry<T>
-
getKey
-
getResourceKey
- Specified by:
getResourceKey
in interfaceRegistry<T>
-
getId
-
get
-
byId
-
getHolder
-
getHolder
-
wrapAsHolder
- Specified by:
wrapAsHolder
in interfaceRegistry<T>
-
getOrCreateHolderOrThrow
-
size
public int size() -
lifecycle
-
registryLifecycle
public com.mojang.serialization.Lifecycle registryLifecycle()- Specified by:
registryLifecycle
in interfaceRegistry<T>
-
iterator
-
get
-
getValueFromNullable
-
keySet
-
registryKeySet
- Specified by:
registryKeySet
in interfaceRegistry<T>
-
entrySet
-
holders
-
getTags
-
getOrCreateTag
- Specified by:
getOrCreateTag
in interfaceRegistry<T>
-
createTag
-
getTagNames
- Specified by:
getTagNames
in interfaceRegistry<T>
-
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. -
freeze
-
createIntrusiveHolder
- Specified by:
createIntrusiveHolder
in interfaceRegistry<T>
-
getTag
-
bindTags
-
resetTags
public void resetTags() -
createRegistrationLookup
- Specified by:
createRegistrationLookup
in interfaceWritableRegistry<T>
-
holderOwner
- Specified by:
holderOwner
in interfaceRegistry<T>
-
asLookup
-