Filter fixes
This commit is contained in:
@@ -373,7 +373,7 @@ toolmode.drawteams.description = Draw teams instead of blocks.
|
||||
filters.empty = [lightgray]No filters! Add one with the button below.
|
||||
filter.distort = Distort
|
||||
filter.noise = Noise
|
||||
filter.enemyspawn = Spawn Select
|
||||
filter.enemyspawn = Enemy Spawn Select
|
||||
filter.corespawn = Core Select
|
||||
filter.median = Median
|
||||
filter.oremedian = Ore Median
|
||||
|
||||
@@ -15,7 +15,7 @@ public class CoreSpawnFilter extends GenerateFilter{
|
||||
@Override
|
||||
public FilterOption[] options(){
|
||||
return Structs.arr(
|
||||
new SliderOption("amount", () -> amount, f -> amount = (int)f, 1, 10)
|
||||
new SliderOption("amount", () -> amount, f -> amount = (int)f, 1, 10).display()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ public class EnemySpawnFilter extends GenerateFilter{
|
||||
@Override
|
||||
public FilterOption[] options(){
|
||||
return Structs.arr(
|
||||
new SliderOption("amount", () -> amount, f -> amount = (int)f, 1, 10)
|
||||
new SliderOption("amount", () -> amount, f -> amount = (int)f, 1, 10).display()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@ public abstract class FilterOption{
|
||||
final Floatc setter;
|
||||
final float min, max, step;
|
||||
|
||||
boolean display;
|
||||
|
||||
SliderOption(String name, Floatp getter, Floatc setter, float min, float max){
|
||||
this(name, getter, setter, min, max, (max - min) / 200);
|
||||
}
|
||||
@@ -47,9 +49,18 @@ public abstract class FilterOption{
|
||||
this.step = step;
|
||||
}
|
||||
|
||||
public SliderOption display(){
|
||||
display = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(Table table){
|
||||
table.add("$filter.option." + name);
|
||||
if(!display){
|
||||
table.add("$filter.option." + name);
|
||||
}else{
|
||||
table.label(() -> Core.bundle.get("filter.option." + name) + ": " + (int)getter.get());
|
||||
}
|
||||
table.row();
|
||||
Slider slider = table.addSlider(min, max, step, setter).growX().get();
|
||||
slider.setValue(getter.get());
|
||||
|
||||
Reference in New Issue
Block a user