mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-19 20:00:00 +00:00
Refactor DebugHandlerWidget (#900)
This commit is contained in:
1 parent
6ed0be7961
commit
0ba14091fb
16 files changed
+890
-743
No files matched your search
@@ -0,0 +1,37 @@
|
||||
package codechicken.nei.recipe.debug;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import codechicken.nei.Button;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
|
||||
public class CheckboxWidget extends Button implements IUpdatableWidget {
|
||||
|
||||
protected Consumer<CheckboxWidget> onChange;
|
||||
protected boolean value;
|
||||
|
||||
public CheckboxWidget(Consumer<CheckboxWidget> onChange) {
|
||||
super();
|
||||
this.onChange = onChange;
|
||||
this.h = 16;
|
||||
this.z = 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRenderLabel() {
|
||||
return this.value ? NEIClientUtils.translate("debug.RecipeHandler.checkbox.on")
|
||||
: NEIClientUtils.translate("debug.RecipeHandler.checkbox.off");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onButtonPress(boolean rightclick) {
|
||||
this.value = !this.value;
|
||||
onChange.accept(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void updateValue(String newValue) {
|
||||
this.value = Boolean.parseBoolean(newValue);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user