Interface VariableValueParameters.RegistryEntryBuilder<T>

All Superinterfaces:
AbstractBuilder<ValueParameter<T>>, Builder<ValueParameter<T>,VariableValueParameters.RegistryEntryBuilder<T>>, ResettableBuilder<ValueParameter<T>,VariableValueParameters.RegistryEntryBuilder<T>>
Enclosing class:
VariableValueParameters

public static interface VariableValueParameters.RegistryEntryBuilder<T> extends Builder<ValueParameter<T>,VariableValueParameters.RegistryEntryBuilder<T>>
A builder that creates a ValueParameter that attempts to get a specific registry entry by the supplied ID.
  • Field Details

  • Method Details

    • addHolderFunction

      Adds an alternative function that retrieves a RegistryHolder to attempt to get the selected RegistryType.

      The order that these functions are added determines their priority if there are multiple registries, specifically, the first function that is provided will have the highest priority.

      Standard functions are available on VariableValueParameters.RegistryEntryBuilder.

      Parameters:
      holderFunction - The holder function
      Returns:
      This, for chaining
    • defaultNamespace

      Adds a prefix that could be prepended to the input argument if it initially does not match any of the chosen RegistryKeys. Any prefixes that are prepended will include the ":" identifier, this should not be part of the supplied prefix in this method.

      Consider the following example. Assume that we have a catalog type that this element targets with the following IDs currently registered:

      • sponge:test
      • minecraft:test
      • test:test

      Now consider that the argument "test:test" is passed (with any capitalization thereof). It's an exact match, so there is no bother, it's returned by the parameter.

      Then consider that the argument "test" is passed - this is NOT an exact match. Without specifying any prefixes - this parameter will fail to parse the argument. Sometimes, this isn't desired, and plugins will want to allow players to not have to specify a prefix. So, if the prefix "sponge" is specified here, then "test" will match "sponge:test".

      Multiple prefixes can be specified. They will be tested in order - in the example above, if the following is specified:

      prefix("sponge").prefix("minecraft").prefix("test")

      then if the argument "test" is passed to the parameter, it will check "test", "sponge:test", "minecraft:test" then "test:test". In the above example, this would match "sponge:test" and return that element.

      Parameters:
      prefix - The prefix, without the ":" suffix, to add to the argument if the parameter fails to find a catalog type without such a prefix
      Returns:
      This builder, for chaining.
    • build

      ValueParameter<T> build()
      Tests for validity and creates this ValueParameter
      Specified by:
      build in interface AbstractBuilder<T>
      Returns:
      The ValueParameter