Interface TRegistry<T>
- All Known Implementing Classes:
TAbstractMappedRegistry
,TImmutableRegistry
,TMutableRegistry
,TSimpleRegistry
A custom implementation of Minecraft's
Registry
system
that aims to be simpler and more convenient to use.-
Method Summary
Modifier and TypeMethodDescriptionboolean
containsKey
(net.minecraft.util.Identifier id) boolean
containsValue
(T entry) 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
.Registers an entry to thisTRegistry
.default int
size()
Returns the number of registered entries in thisTRegistry
.unregister
(net.minecraft.util.Identifier id) UnRegisters an existing entry that is part of thisTRegistry
.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
size
default int size()Returns the number of registered entries in thisTRegistry
. -
register
T register(net.minecraft.util.Identifier id, T entry) throws UnsupportedOperationException, NullPointerException, IllegalStateException Registers an entry to thisTRegistry
.- 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
T unregister(net.minecraft.util.Identifier id) throws UnsupportedOperationException, NullPointerException UnRegisters an existing entry that is part of thisTRegistry
.- 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
Returns the uniqueIdentifier
that corresponds to a registered entry, wrapped in anOptional
.- Parameters:
entry
- The registered entry.
-
getValue
Returns a registered entry, wrapped in anOptional
.- Parameters:
id
- The uniqueIdentifier
of the entry that was registered.
-
containsKey
boolean containsKey(net.minecraft.util.Identifier id) -
containsValue
-