blob: 904b3230475a4a2c8d6d4ee54b3edb09e47ceed6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
package dev.isxander.yacl3.impl.controller;
import dev.isxander.yacl3.api.Controller;
import dev.isxander.yacl3.api.Option;
import dev.isxander.yacl3.api.controller.FloatFieldControllerBuilder;
import dev.isxander.yacl3.api.controller.ValueFormatter;
import dev.isxander.yacl3.gui.controllers.slider.FloatSliderController;
import dev.isxander.yacl3.gui.controllers.string.number.FloatFieldController;
import net.minecraft.network.chat.Component;
import java.util.function.Function;
public class FloatFieldControllerBuilderImpl extends AbstractControllerBuilderImpl<Float> implements FloatFieldControllerBuilder {
private float min = -Float.MAX_VALUE;
private float max = Float.MAX_VALUE;
private ValueFormatter<Float> formatter = FloatSliderController.DEFAULT_FORMATTER::apply;
public FloatFieldControllerBuilderImpl(Option<Float> option) {
super(option);
}
@Override
public FloatFieldControllerBuilder min(Float min) {
this.min = min;
return this;
}
@Override
public FloatFieldControllerBuilder max(Float max) {
this.max = max;
return this;
}
@Override
public FloatFieldControllerBuilder range(Float min, Float max) {
this.min = min;
this.max = max;
return this;
}
@Override
public FloatFieldControllerBuilder formatValue(ValueFormatter<Float> formatter) {
this.formatter = formatter;
return this;
}
@Override
public Controller<Float> build() {
return FloatFieldController.createInternal(option, min, max, formatter);
}
}
|