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 registry
V - attached value type
Enclosing interface:
RegistryEntryAttachment<R,V>

public static final class RegistryEntryAttachment.Builder<R,V> extends Object
Builder for attachments.
  • Method Details

    • side

      Sets what side this attachment should exist on.
      Parameters:
      side - attachment side
      Returns:
      this builder
    • defaultValue

      public RegistryEntryAttachment.Builder<R,V> defaultValue(@Nullable V 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

      public RegistryEntryAttachment<R,V> build()
      Builds a new attachment.
      Returns:
      new attachment