Class RegistryEntryAttachment.Builder<R,V>
java.lang.Object
org.quiltmc.qsl.registry.attachment.api.RegistryEntryAttachment.Builder<R,V>
- Type Parameters:
R- type of the entries in the registryV- attached value type
- Enclosing interface:
RegistryEntryAttachment<R,V>
Builder for attachments.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a new attachment.defaultValue(V defaultValue) Sets the default value of this attachment.defaultValueProvider(@Nullable DefaultValueProvider<R, V> defaultValueProvider) Sets the default value provider of this attachment, which will be used to compute a value for a specific entry, should it be missing.Sets what side this attachment should exist on.
-
Method Details
-
side
Sets what side this attachment should exist on.- Parameters:
side- attachment side- Returns:
- this builder
-
defaultValue
Sets the default value of this attachment.Setting this will remove the currently set default value provider!
- Parameters:
defaultValue- default value- Returns:
- this builder
-
defaultValueProvider
public RegistryEntryAttachment.Builder<R,V> defaultValueProvider(@Nullable @Nullable DefaultValueProvider<R, V> defaultValueProvider) Sets the default value provider of this attachment, which will be used to compute a value for a specific entry, should it be missing.Note that this will be computed on both sides and the computation result will not be synchronized.
Setting this will remove the currently set default value!
- Parameters:
defaultValueProvider- function to compute otherwise-missing value- Returns:
- this builder
-
build
Builds a new attachment.- Returns:
- new attachment
-