Class ListType<E>

java.lang.Object
net.ixdarklord.coolcatcore.api.config.type.ListType<E>
All Implemented Interfaces:
ConfigType<List<E>>

public final class ListType<E> extends Object implements ConfigType<List<E>>
A list whose elements are all of one type (itself possibly constrained), optionally limited in size. Values are immutable lists. Reading a file drops invalid elements and corrects the rest; typed values must be valid as a whole. Typed as JSON: [1, 2, 3], ["a", "b"].
  • Method Details

    • elementType

      public ConfigType<E> elementType()
    • minSize

      public int minSize()
    • maxSize

      public int maxSize()
    • withSize

      public ListType<E> withSize(int minSize, int maxSize)
    • codec

      public com.mojang.serialization.Codec<List<E>> codec()
      Specified by:
      codec in interface ConfigType<E>
    • validate

      public ValidationResult<List<E>> validate(List<E> value)
      Description copied from interface: ConfigType
      Checks a value, possibly correcting it.
      Specified by:
      validate in interface ConfigType<E>
    • parse

      public ValidationResult<List<E>> parse(String text)
      Description copied from interface: ConfigType
      Reads a value typed by a player, and validates it. By default the text is JSON for the codec.
      Specified by:
      parse in interface ConfigType<E>
    • describe

      public List<net.minecraft.network.chat.Component> describe()
      Description copied from interface: ConfigType
      The constraints in words, for the file's comments and the screen's tooltips ("Range: 0 ~ 10").
      Specified by:
      describe in interface ConfigType<E>