Refactor DebugHandlerWidget (#900)

This commit is contained in:
slprime authored and GitHub committed 2026-03-22 14:10:10 +02:00
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);
}
}