Package net.minecraftforge.registries
Class NamespacedWrapper<T>
java.lang.Object
net.minecraft.core.MappedRegistry<T>
net.minecraftforge.registries.NamespacedWrapper<T>
- All Implemented Interfaces:
com.mojang.serialization.Keyable
,Iterable<T>
,IdMap<T>
,Registry<T>
,WritableRegistry<T>
,ILockableRegistry
- Direct Known Subclasses:
NamespacedDefaultedWrapper
-
Field Summary
Modifier and TypeFieldDescriptionprivate final ForgeRegistry
<T> private boolean
private Map
<T, Holder.Reference<T>> private it.unimi.dsi.fastutil.objects.ObjectList
<Holder.Reference<T>> private Map
<ResourceLocation, Holder.Reference<T>> private List
<Holder.Reference<T>> private final @Nullable Function
<T, Holder.Reference<T>> (package private) boolean
(package private) static final org.slf4j.Logger
private final Map
<ResourceKey<T>, RegistrationInfo> (package private) com.mojang.serialization.Lifecycle
private RegistryManager
private Map
<TagKey<T>, HolderSet.Named<T>> Fields inherited from class net.minecraft.core.MappedRegistry
unregisteredIntrusiveHolders
-
Constructor Summary
ConstructorDescriptionNamespacedWrapper
(ForgeRegistry<T> fowner, Function<T, Holder.Reference<T>> intrusiveHolderCallback, RegistryManager stage) -
Method Summary
Modifier and TypeMethodDescription(package private) void
private void
addTagToHolder
(Map<Holder.Reference<T>, List<TagKey<T>>> holderToTag, TagKey<T> name, Holder<T> holder) void
byId
(int id) boolean
containsKey
(ResourceKey<T> key) boolean
createIntrusiveHolder
(T value) private HolderSet.Named
<T> Set
<Map.Entry<ResourceKey<T>, T>> entrySet()
freeze()
get
(@Nullable ResourceKey<T> name) get
(@Nullable ResourceLocation name) getHolder
(int id) getHolder
(ResourceKey<T> key) private Holder.Reference
<T> getHolder
(ResourceKey<T> key, T value) getHolder
(ResourceLocation location) int
@Nullable ResourceLocation
getOptional
(@Nullable ResourceLocation name) protected Holder.Reference
<T> getOrCreateTag
(TagKey<T> name) getRandom
(RandomSource rand) getResourceKey
(T value) private List
<Holder.Reference<T>> Stream
<com.mojang.datafixers.util.Pair<TagKey<T>, HolderSet.Named<T>>> getTags()
holders()
boolean
isEmpty()
(package private) boolean
isFrozen()
boolean
iterator()
keySet()
void
lock()
Deprecated.Forge: For internal use only.(package private) Holder.Reference
<T> onAdded
(RegistryManager stage, int id, ResourceKey<T> key, T newValue, T oldValue) register
(ResourceKey<T> key, T value, RegistrationInfo info) registrationInfo
(ResourceKey<T> p_331530_) Set
<ResourceKey<T>> com.mojang.serialization.Lifecycle
void
int
size()
void
unfreeze()
(package private) void
(package private) void
validateWrite
(ResourceKey<T> key) wrapAsHolder
(T value) Methods inherited from class net.minecraft.core.MappedRegistry
asLookup, getKnownRegistries, holderOwner, key, markKnown, toString
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
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface net.minecraft.core.Registry
asHolderIdMap, asTagAddingLookup, byNameCodec, getHolderOrThrow, getOptional, getOrThrow, getRandomElementOf, getTagOrEmpty, holderByNameCodec, keys, stream
-
Field Details
-
LOGGER
static final org.slf4j.Logger LOGGER -
delegate
-
intrusiveHolderCallback
-
optionalTags
-
locked
boolean locked -
registryLifecycle
com.mojang.serialization.Lifecycle registryLifecycle -
frozen
private boolean frozen -
holdersSorted
-
holdersById
-
holdersByName
-
holders
-
stage
-
tags
-
registrationInfos
-
-
Constructor Details
-
NamespacedWrapper
NamespacedWrapper(ForgeRegistry<T> fowner, Function<T, Holder.Reference<T>> intrusiveHolderCallback, RegistryManager stage)
-
-
Method Details
-
register
- Specified by:
register
in interfaceWritableRegistry<T>
- Overrides:
register
in classMappedRegistry<T>
-
get
-
getOptional
- Specified by:
getOptional
in interfaceRegistry<T>
-
get
-
getKey
-
getResourceKey
- Specified by:
getResourceKey
in interfaceRegistry<T>
- Overrides:
getResourceKey
in classMappedRegistry<T>
-
containsKey
- Specified by:
containsKey
in interfaceRegistry<T>
- Overrides:
containsKey
in classMappedRegistry<T>
-
containsKey
- Specified by:
containsKey
in interfaceRegistry<T>
- Overrides:
containsKey
in classMappedRegistry<T>
-
getId
-
byId
-
registryLifecycle
public com.mojang.serialization.Lifecycle registryLifecycle()- Specified by:
registryLifecycle
in interfaceRegistry<T>
- Overrides:
registryLifecycle
in classMappedRegistry<T>
-
iterator
-
keySet
-
registryKeySet
- Specified by:
registryKeySet
in interfaceRegistry<T>
- Overrides:
registryKeySet
in classMappedRegistry<T>
-
entrySet
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceWritableRegistry<T>
- Overrides:
isEmpty
in classMappedRegistry<T>
-
size
public int size() -
lock
Deprecated.Forge: For internal use only. Use the Register events when registering values.- Specified by:
lock
in interfaceILockableRegistry
-
getHolder
-
getHolder
-
wrapAsHolder
- Specified by:
wrapAsHolder
in interfaceRegistry<T>
- Overrides:
wrapAsHolder
in classMappedRegistry<T>
-
registrationInfo
- Specified by:
registrationInfo
in interfaceRegistry<T>
- Overrides:
registrationInfo
in classMappedRegistry<T>
-
getHolder
-
getHolder
-
createRegistrationLookup
- Specified by:
createRegistrationLookup
in interfaceWritableRegistry<T>
- Overrides:
createRegistrationLookup
in classMappedRegistry<T>
-
validateWrite
void validateWrite() -
validateWrite
-
getOrCreateHolderOrThrow
- Overrides:
getOrCreateHolderOrThrow
in classMappedRegistry<T>
-
getRandom
-
holders
-
getTags
-
getOrCreateTag
- Specified by:
getOrCreateTag
in interfaceRegistry<T>
- Overrides:
getOrCreateTag
in classMappedRegistry<T>
-
addOptionalTag
-
getTagNames
- Specified by:
getTagNames
in interfaceRegistry<T>
- Overrides:
getTagNames
in classMappedRegistry<T>
-
freeze
-
createIntrusiveHolder
- Specified by:
createIntrusiveHolder
in interfaceRegistry<T>
- Overrides:
createIntrusiveHolder
in classMappedRegistry<T>
-
getTag
-
bindTags
-
addTagToHolder
-
resetTags
public void resetTags() -
unfreeze
public void unfreeze()- Overrides:
unfreeze
in classMappedRegistry<T>
-
isFrozen
boolean isFrozen() -
isIntrusive
public boolean isIntrusive()- Overrides:
isIntrusive
in classMappedRegistry<T>
-
onAdded
@Nullable Holder.Reference<T> onAdded(RegistryManager stage, int id, ResourceKey<T> key, T newValue, T oldValue) -
createTag
-
getHolder
-
getSortedHolders
-