Class TImmutableRegistry<T>
java.lang.Object
io.github.thecsdev.tcdcommons.api.registry.TAbstractMappedRegistry<T>
io.github.thecsdev.tcdcommons.api.registry.TImmutableRegistry<T>
A
TRegistry
that does not allow for registering new entries
or unregistering existing entries.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class io.github.thecsdev.tcdcommons.api.registry.TAbstractMappedRegistry
TAbstractMappedRegistry.MappedRegistryEvent<T>
-
Field Summary
Fields inherited from class io.github.thecsdev.tcdcommons.api.registry.TAbstractMappedRegistry
eRegistered, eUnRegistered, map
-
Constructor Summary
ConstructorDescriptionTImmutableRegistry
(Collection<Map.Entry<net.minecraft.util.Identifier, T>> entries) Creates an instance ofTImmutableRegistry
. -
Method Summary
Methods inherited from class io.github.thecsdev.tcdcommons.api.registry.TAbstractMappedRegistry
containsKey, containsValue, forEach, getKey, getValue, iterator, size, spliterator
-
Constructor Details
-
TImmutableRegistry
Creates an instance ofTImmutableRegistry
.- Parameters:
entries
- TheCollection
of entries thisTRegistry
will contain.- Throws:
NullPointerException
- If a key or value in the entryCollection
is null.
-
-
Method Details
-
register
public final T register(net.minecraft.util.Identifier id, T entry) throws UnsupportedOperationException Description copied from interface:TRegistry
Registers an entry to thisTRegistry
.- Specified by:
register
in interfaceTRegistry<T>
- Overrides:
register
in classTAbstractMappedRegistry<T>
- Parameters:
id
- The uniqueIdentifier
of the entry being registered.entry
- The entry being registered.- Returns:
- The registered entry.
- Throws:
UnsupportedOperationException
- If thisTRegistry
does not support registering new entries.
-
unregister
Description copied from interface:TRegistry
UnRegisters an existing entry that is part of thisTRegistry
.- Specified by:
unregister
in interfaceTRegistry<T>
- Overrides:
unregister
in classTAbstractMappedRegistry<T>
- Parameters:
id
- The uniqueIdentifier
of the entry being unregistered.- Returns:
- The entry value that was previously associated with the given unique
Identifier
, or null if there was no such entry. - Throws:
UnsupportedOperationException
- If thisTRegistry
does not support unregistering existing entries.
-