Package me.hackware.api.setting.impl
Class NumberSetting<N extends Number & Comparable<N>>
java.lang.Object
me.hackware.api.setting.Setting<N>
me.hackware.api.setting.impl.NumberSetting<N>
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionNumberSetting(String name) NumberSetting(String name, String description) NumberSetting(String name, String description, N defaultValue) NumberSetting(String name, N defaultValue) -
Method Summary
Modifier and TypeMethodDescriptionSlider drags preview live but only commit the value on mouse release.defaultValue(N defaultValue) description(String description) displayName(String displayName) doubleConvenience accessors returning primitives for UI / arithmetic.Enables fractional snapping/display (GUI-scale-aware fractions like2/3).fractional(boolean fractional) getMax()getMin()double[]Current allowed snap values, ornullif unconstrained.getStep()booleanbooleandoubledoublevoidsetFromDouble(double d) Sets the value from a double primitive (used by UI sliders).voiddoublesnap(double v) Nearest allowed snap value tov(returnsvunchanged if no snap set).snapValues(Supplier<double[]> snapValues) Snap the value to the nearest of this dynamic set (evaluated live) instead of the step grid.doubleAppends a unit to the displayed value (e.g.visible(boolean visible) visible(BooleanSupplier visible) Methods inherited from class me.hackware.api.setting.Setting
get, getDefaultValue, getDescription, getDisplayName, getGroup, getName, getOwner, isBulkLoading, isVisible, setBulkLoadProbe, setOwner
-
Constructor Details
-
NumberSetting
-
NumberSetting
-
NumberSetting
-
NumberSetting
-
-
Method Details
-
min
-
max
-
step
-
range
-
suffix
Appends a unit to the displayed value (e.g."x"). -
fractional
Enables fractional snapping/display (GUI-scale-aware fractions like2/3). -
fractional
-
commitOnRelease
Slider drags preview live but only commit the value on mouse release. -
snapValues
Snap the value to the nearest of this dynamic set (evaluated live) instead of the step grid. -
displayName
- Overrides:
displayNamein classSetting<N extends Number & Comparable<N>>
-
defaultValue
- Overrides:
defaultValuein classSetting<N extends Number & Comparable<N>>
-
description
- Overrides:
descriptionin classSetting<N extends Number & Comparable<N>>
-
group
-
visible
-
visible
-
onChanged
-
getMin
-
getMax
-
getStep
-
getSuffix
-
isFractional
public boolean isFractional() -
isCommitOnRelease
public boolean isCommitOnRelease() -
getSnapValues
public double[] getSnapValues()Current allowed snap values, ornullif unconstrained. -
snap
public double snap(double v) Nearest allowed snap value tov(returnsvunchanged if no snap set). -
doubleValue
public double doubleValue()Convenience accessors returning primitives for UI / arithmetic. -
minDouble
public double minDouble() -
maxDouble
public double maxDouble() -
stepDouble
public double stepDouble() -
setValue
-
setFromDouble
public void setFromDouble(double d) Sets the value from a double primitive (used by UI sliders).
-