Interface ConfigType<T>
- Type Parameters:
T- the value's type; values are never null
- All Known Implementing Classes:
BooleanType,CodecType,ColorType,EnumType,IdentifierType,ListType,NumberType,StringType
public interface ConfigType<T>
What a config value is: how it's stored (a
Codec, so every file format and the network work alike), what
it may be, and how it's typed as text in the config screen and commands.
Types are immutable and carry their constraints (ConfigTypes.intRange(int, int)), so a list's elements are
checked the same way as a single value. ConfigTypes has the built-in ones; the config screen picks an
editor by type, and falls back to a text box using parse(java.lang.String)/format(T) for types it doesn't know.
-
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.Codec<T> codec()default List<net.minecraft.network.chat.Component> describe()The constraints in words, for the file's comments and the screen's tooltips ("Range: 0 ~ 10").default booleandefault StringThe value as a player would type it, the inverse ofparse(java.lang.String).default ValidationResult<T> Reads a value typed by a player, and validates it.Values to suggest in commands.Checks a value, possibly correcting it.
-
Method Details
-
codec
com.mojang.serialization.Codec<T> codec() -
validate
Checks a value, possibly correcting it. -
parse
Reads a value typed by a player, and validates it. By default the text is JSON for the codec. -
format
The value as a player would type it, the inverse ofparse(java.lang.String). By default compact JSON. -
describe
The constraints in words, for the file's comments and the screen's tooltips ("Range: 0 ~ 10"). -
suggestions
Values to suggest in commands. -
equals
-