Filter fixes

This commit is contained in:
Anuken
2019-11-16 13:07:40 -05:00
parent aa6229be4b
commit 0c0573a7b1
4 changed files with 15 additions and 4 deletions

View File

@@ -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

View File

@@ -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()
);
}

View File

@@ -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()
);
}

View File

@@ -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());