Class NumberType<N extends Number & Comparable<N>>
java.lang.Object
net.ixdarklord.coolcatcore.api.config.type.NumberType<N>
- All Implemented Interfaces:
ConfigType<N>
public final class NumberType<N extends Number & Comparable<N>>
extends Object
implements ConfigType<N>
An
int, long, float or double, optionally within a range. Out-of-range values are
clamped when a file is read. A bounded number can be shown as a slider.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classNumberType.Kind<N extends Number & Comparable<N>> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NumberType.Kind<Double>static final NumberType.Kind<Float>static final NumberType.Kind<Integer>static final NumberType.Kind<Long> -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.Codec<N>codec()List<net.minecraft.network.chat.Component>describe()The constraints in words, for the file's comments and the screen's tooltips ("Range: 0 ~ 10").booleanThe value as a player would type it, the inverse ofConfigType.parse(java.lang.String).fromDouble(double value) The number nearest to a double, clamped into the range.inthashCode()booleanWhether a range narrower than the whole type was set.booleanbooleanisSlider()Whether the config screen shows a slider rather than a text box.kind()max()min()Reads a value typed by a player, and validates it.Checks a value, possibly correcting it.withSlider(boolean slider) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.ixdarklord.coolcatcore.api.config.type.ConfigType
equals, suggestions
-
Field Details
-
INT
-
LONG
-
FLOAT
-
DOUBLE
-
-
Method Details
-
kind
-
min
-
max
-
isSlider
public boolean isSlider()Whether the config screen shows a slider rather than a text box. -
isBounded
public boolean isBounded()Whether a range narrower than the whole type was set. -
isIntegral
public boolean isIntegral() -
withRange
-
withSlider
-
fromDouble
The number nearest to a double, clamped into the range. -
codec
- Specified by:
codecin interfaceConfigType<N extends Number & Comparable<N>>
-
validate
Description copied from interface:ConfigTypeChecks a value, possibly correcting it.- Specified by:
validatein interfaceConfigType<N extends Number & Comparable<N>>
-
parse
Description copied from interface:ConfigTypeReads a value typed by a player, and validates it. By default the text is JSON for the codec.- Specified by:
parsein interfaceConfigType<N extends Number & Comparable<N>>
-
format
Description copied from interface:ConfigTypeThe value as a player would type it, the inverse ofConfigType.parse(java.lang.String). By default compact JSON.- Specified by:
formatin interfaceConfigType<N extends Number & Comparable<N>>
-
describe
Description copied from interface:ConfigTypeThe constraints in words, for the file's comments and the screen's tooltips ("Range: 0 ~ 10").- Specified by:
describein interfaceConfigType<N extends Number & Comparable<N>>
-
equals
-
hashCode
public int hashCode()
-