Package io.papermc.paper.registry
Interface RegistryBuilderFactory<T,B extends RegistryBuilder<T>>
- Type Parameters:
T
- The type of the registryB
- The type of the registry builder
@NullMarked
@Experimental
@NonExtendable
public interface RegistryBuilderFactory<T,B extends RegistryBuilder<T>>
A factory to create a
RegistryBuilder
for a given TypedKey
. For
each instance of this class, once either empty()
or copyFrom(TypedKey)
is called once, any future calls to either method will throw an IllegalStateException
.-
Method Summary
Modifier and TypeMethodDescriptionCreates a newRegistryBuilder
with the same properties as the givenTypedKey
.empty()
Creates a new emptyRegistryBuilder
.
-
Method Details
-
empty
Creates a new emptyRegistryBuilder
.- Returns:
- A new empty
RegistryBuilder
- Throws:
IllegalStateException
- if this method orcopyFrom(TypedKey)
) has already been called once
-
copyFrom
Creates a newRegistryBuilder
with the same properties as the givenTypedKey
.- Parameters:
key
- The key to copy properties from- Returns:
- A new
RegistryBuilder
with the same properties as the given key - Throws:
IllegalStateException
- if this method orempty()
has already been called onceIllegalArgumentException
- if key doesn't exist
-