Class IntSetting
A whole number, set with a slider or typed into a box (
IntSetting.Builder.typed()). Values are clamped to
min()..max(); the slider covers sliderMin()..sliderMax(), which may be narrower.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class Setting
Setting.Layer -
Field Summary
Fields inherited from class Setting
defaultValue, description, id, name, value -
Constructor Summary
ConstructorsConstructorDescriptionIntSetting(String name, @Nullable String description, int defaultValue, @Nullable Supplier<Boolean> visible, int min, int max, int sliderMin, int sliderMax) A setting as itsIntSetting.Buildermakes it; get one fromSettingGroup.integer(String), or call this from a subclass. -
Method Summary
Modifier and TypeMethodDescriptionvoidfromJson(com.google.gson.JsonElement json) Load from JSON; invalid input must leave the value unchanged rather than throw.intmax()The highest value it takes; anything higher is lowered to it.intmin()The lowest value it takes; anything lower is raised to it.booleanSets the player's value from what a player typed (a command, a text box).intThe slider's right end.intThe slider's left end.com.google.gson.JsonElementtoJson()The player's value as JSON, for config and shares.booleantyped()Whether it's typed into a box rather than set with a slider (seeIntSetting.Builder.typed()).protected IntegerClamps or normalises a candidate value before it's set or laid over; null gives the default.Methods inherited from class Setting
changed, copy, decode, decode, defaultValue, description, edit, editsTakeEffect, encode, get, group, id, isDefault, isOverridden, isProtected, isSerializable, isVisible, name, onChanged, overriddenBy, override, override, playerValue, release, reset, set, setGlobalChangeHook, suggestions, valueString
-
Constructor Details
-
IntSetting
public IntSetting(String name, @Nullable String description, int defaultValue, @Nullable Supplier<Boolean> visible, int min, int max, int sliderMin, int sliderMax) A setting as itsIntSetting.Buildermakes it; get one fromSettingGroup.integer(String), or call this from a subclass.
-
-
Method Details
-
min
public int min()The lowest value it takes; anything lower is raised to it. -
max
public int max()The highest value it takes; anything higher is lowered to it. -
sliderMin
public int sliderMin()The slider's left end. -
sliderMax
public int sliderMax()The slider's right end. -
typed
public boolean typed()Whether it's typed into a box rather than set with a slider (seeIntSetting.Builder.typed()). -
validate
-
toJson
-
fromJson
-
parse
-