Interface WyckRegistry
- All Superinterfaces:
Wrapper
A minimal abstraction of Minecraft's registry with frozen registry utilities.
- Since:
- 2.3.0
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidfreeze()Unbinds all tags and freezes the registry.booleanisFrozen()Whether the registry is frozen.key()The key of the registry.static Lazy<WyckRegistry> lazy(ResourceKey key) Creates a lazy FrozenRegistry.static Lazy<WyckRegistry> lazy(RegistryId reference) Creates a lazy FrozenRegistry.static Lazy<WyckRegistry> Creates a lazy FrozenRegistry.static WyckRegistryof(ResourceKey key) Creates a FrozenRegistry from a ResourceKey.static WyckRegistryof(RegistryId reference) Creates a FrozenRegistry from a RegistryReference.static WyckRegistryCreates a FrozenRegistry from a Minecraft registry path.default voidregister(ResourceKey key, Wrapper wrappable) Registers a wrapper in the registry.<T> voidregister(ResourceKey key, T object) Registers an object in the registry.registry()The registry itself.<T> @Nullable Tretrieve(ResourceKey key) Retrieves an object from the registry.default <T> TRetrieves an object from the registry, or throws an exception if it is not present.default ObjectReturns the registry itself.voidunFreeze()Unfreezes the registry.voidwhileUnfrozen(Runnable action) Runs the given action while the registry is unfrozen.default voidwhileUnfrozen(Consumer<WyckRegistry> consumer) Runs the given consumer with the registry while it is unfrozen.
-
Method Details
-
key
-
registry
-
isFrozen
Whether the registry is frozen.- Returns:
- whether the registry is frozen
-
unFreeze
-
freeze
-
whileUnfrozen
-
whileUnfrozen
Runs the given consumer with the registry while it is unfrozen.- Parameters:
consumer- the consumer to run- Since:
- 2.4.0
-
retrieve
Retrieves an object from the registry.- Type Parameters:
T- the type of the object- Parameters:
key- the key of the object to retrieve- Returns:
- the object
- Since:
- 3.0.0
-
retrieveOrThrow
Retrieves an object from the registry, or throws an exception if it is not present.- Type Parameters:
T- the type of the object- Parameters:
key- the key of the object to retrieve- Returns:
- the object
- Since:
- 3.0.0
-
register
Registers an object in the registry.- Type Parameters:
T- the type of the object- Parameters:
key- the key of the object to registerobject- the minecraft object- Since:
- 3.0.0
-
register
Registers a wrapper in the registry.- Parameters:
key- the key of the object to registerwrappable- the wrapper to register- Since:
- 3.0.0
-
toMinecraft
Returns the registry itself.- Specified by:
toMinecraftin interfaceWrapper- Returns:
- the registry itself
- Since:
- 2.3.0
-
of
Creates a FrozenRegistry from a ResourceKey.- Parameters:
key- the key of the registry- Returns:
- a FrozenRegistry instance
- Since:
- 2.3.0
-
of
Creates a FrozenRegistry from a Minecraft registry path.- Parameters:
path- the path of the registry- Returns:
- a FrozenRegistry instance
- Since:
- 2.3.0
-
of
Creates a FrozenRegistry from a RegistryReference.- Parameters:
reference- the registry reference- Returns:
- a FrozenRegistry instance
- Since:
- 2.4.0
-
lazy
Creates a lazy FrozenRegistry.- Parameters:
key- the key of the registry- Returns:
- a lazy FrozenRegistry instance
- Since:
- 2.3.0
-
lazy
Creates a lazy FrozenRegistry.- Parameters:
path- the path of the registry- Returns:
- a lazy FrozenRegistry instance
- Since:
- 2.3.0
-
lazy
Creates a lazy FrozenRegistry.- Parameters:
reference- the registry reference- Returns:
- a lazy FrozenRegistry instance
- Since:
- 2.4.0
-