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
-
Nested Class Summary
-
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
(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) (package private) Holder.Reference<T>
getOrCreateTag
(TagKey<T> name) getRandom
(RandomSource rand) getResourceKey
(T p_122755_) private List<Holder.Reference<T>>
Stream<com.mojang.datafixers.util.Pair<TagKey<T>,
HolderSet.Named<T>>> getTags()
holders()
boolean
isEmpty()
(package private) boolean
isFrozen()
(package private) boolean
iterator()
keySet()
com.mojang.serialization.Lifecycle
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, com.mojang.serialization.Lifecycle lifecycle) registerMapping
(int id, ResourceKey<T> key, T value, com.mojang.serialization.Lifecycle lifecycle) Set<ResourceKey<T>>
com.mojang.serialization.Lifecycle
void
int
size()
void
unfreeze()
(package private) void
(package private) void
validateWrite
(ResourceKey<T> key) Methods inherited from class net.minecraft.core.MappedRegistry
asLookup, getKnownRegistries, holderOwner, key, markKnown, toString, wrapAsHolder
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, getOrThrow, 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
-
-
Constructor Details
-
NamespacedWrapper
NamespacedWrapper(ForgeRegistry<T> fowner, Function<T, Holder.Reference<T>> intrusiveHolderCallback, RegistryManager stage)
-
-
Method Details
-
registerMapping
public Holder.Reference<T> registerMapping(int id, ResourceKey<T> key, T value, com.mojang.serialization.Lifecycle lifecycle) - Specified by:
registerMapping
in interfaceWritableRegistry<T>
- Overrides:
registerMapping
in classMappedRegistry<T>
-
register
public Holder.Reference<T> register(ResourceKey<T> key, T value, com.mojang.serialization.Lifecycle lifecycle) - 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
-
lifecycle
-
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
-
getHolder
-
getHolder
-
createRegistrationLookup
- Specified by:
createRegistrationLookup
in interfaceWritableRegistry<T>
- Overrides:
createRegistrationLookup
in classMappedRegistry<T>
-
validateWrite
void validateWrite() -
validateWrite
-
getOrCreateHolderOrThrow
-
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
boolean isIntrusive() -
onAdded
@Nullable Holder.Reference<T> onAdded(RegistryManager stage, int id, ResourceKey<T> key, T newValue, T oldValue) -
createTag
-
getHolder
-
getSortedHolders
-