Class TAbstractMappedRegistry<T>
java.lang.Object
io.github.thecsdev.tcdcommons.api.registry.TAbstractMappedRegistry<T>
- Direct Known Subclasses:
TImmutableRegistry
,TMutableRegistry
,TSimpleRegistry
A
TRegistry
that uses HashBiMap
s to store data about registered entries.- See Also:
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescription -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
containsKey
(net.minecraft.util.Identifier id) final boolean
containsValue
(T entry) final void
final Optional
<net.minecraft.util.Identifier> Returns the uniqueIdentifier
that corresponds to a registered entry, wrapped in anOptional
.getValue
(net.minecraft.util.Identifier id) Returns a registered entry, wrapped in anOptional
.iterator()
Registers an entry to thisTRegistry
.final int
size()
Returns the number of registered entries in thisTRegistry
.final Spliterator
<Map.Entry<net.minecraft.util.Identifier, T>> unregister
(net.minecraft.util.Identifier id) UnRegisters an existing entry that is part of thisTRegistry
.
-
Field Details
-
map
-
eRegistered
-
eUnRegistered
-
-
Constructor Details
-
TAbstractMappedRegistry
public TAbstractMappedRegistry()
-
-
Method Details
-
iterator
-
size
public final int size()Description copied from interface:TRegistry
Returns the number of registered entries in thisTRegistry
. -
register
public T register(net.minecraft.util.Identifier id, T entry) throws UnsupportedOperationException, NullPointerException, IllegalStateException Description copied from interface:TRegistry
Registers an entry to thisTRegistry
.- Specified by:
register
in interfaceTRegistry<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.NullPointerException
- If any given argument is null.IllegalStateException
- If the entry is already registered, and thisTRegistry
doesn't support overriding existing entries.
-
unregister
public T unregister(net.minecraft.util.Identifier id) throws UnsupportedOperationException, NullPointerException Description copied from interface:TRegistry
UnRegisters an existing entry that is part of thisTRegistry
.- Specified by:
unregister
in interfaceTRegistry<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.NullPointerException
- If any given argument is null.
-
getKey
Description copied from interface:TRegistry
Returns the uniqueIdentifier
that corresponds to a registered entry, wrapped in anOptional
. -
getValue
Description copied from interface:TRegistry
Returns a registered entry, wrapped in anOptional
. -
containsKey
public final boolean containsKey(net.minecraft.util.Identifier id) - Specified by:
containsKey
in interfaceTRegistry<T>
-
containsValue
- Specified by:
containsValue
in interfaceTRegistry<T>
-
forEach
-
spliterator
- Specified by:
spliterator
in interfaceIterable<T>
-