aboutsummaryrefslogtreecommitdiff
path: root/common/src/main/java/dev/isxander/yacl3/impl
diff options
context:
space:
mode:
Diffstat (limited to 'common/src/main/java/dev/isxander/yacl3/impl')
-rw-r--r--common/src/main/java/dev/isxander/yacl3/impl/controller/DropdownStringControllerBuilderImpl.java49
-rw-r--r--common/src/main/java/dev/isxander/yacl3/impl/controller/ItemControllerBuilderImpl.java18
2 files changed, 67 insertions, 0 deletions
diff --git a/common/src/main/java/dev/isxander/yacl3/impl/controller/DropdownStringControllerBuilderImpl.java b/common/src/main/java/dev/isxander/yacl3/impl/controller/DropdownStringControllerBuilderImpl.java
new file mode 100644
index 0000000..b300a6a
--- /dev/null
+++ b/common/src/main/java/dev/isxander/yacl3/impl/controller/DropdownStringControllerBuilderImpl.java
@@ -0,0 +1,49 @@
+package dev.isxander.yacl3.impl.controller;
+
+import dev.isxander.yacl3.api.Controller;
+import dev.isxander.yacl3.api.Option;
+import dev.isxander.yacl3.api.controller.DropdownStringControllerBuilder;
+import dev.isxander.yacl3.gui.controllers.dropdown.DropdownStringController;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class DropdownStringControllerBuilderImpl extends StringControllerBuilderImpl implements DropdownStringControllerBuilder {
+ private List<String> values;
+ private boolean allowEmptyValue = false;
+ private boolean allowAnyValue = false;
+
+ public DropdownStringControllerBuilderImpl(Option<String> option) {
+ super(option);
+ }
+
+ @Override
+ public DropdownStringControllerBuilder values(List<String> values) {
+ this.values = values;
+ return this;
+ }
+
+ @Override
+ public DropdownStringControllerBuilderImpl values(String... values) {
+ this.values = Arrays.asList(values);
+ return this;
+ }
+
+ @Override
+ public DropdownStringControllerBuilderImpl allowEmptyValue(boolean allowEmptyValue) {
+ this.allowEmptyValue = allowEmptyValue;
+ return this;
+ }
+
+ @Override
+ public DropdownStringControllerBuilderImpl allowAnyValue(boolean allowAnyValue) {
+ this.allowAnyValue = allowAnyValue;
+ return this;
+ }
+
+ @Override
+ public Controller<String> build() {
+ return new DropdownStringController(option, values, allowEmptyValue, allowAnyValue);
+ }
+
+}
diff --git a/common/src/main/java/dev/isxander/yacl3/impl/controller/ItemControllerBuilderImpl.java b/common/src/main/java/dev/isxander/yacl3/impl/controller/ItemControllerBuilderImpl.java
new file mode 100644
index 0000000..9a817fb
--- /dev/null
+++ b/common/src/main/java/dev/isxander/yacl3/impl/controller/ItemControllerBuilderImpl.java
@@ -0,0 +1,18 @@
+package dev.isxander.yacl3.impl.controller;
+
+import dev.isxander.yacl3.api.Controller;
+import dev.isxander.yacl3.api.Option;
+import dev.isxander.yacl3.api.controller.ItemControllerBuilder;
+import dev.isxander.yacl3.gui.controllers.dropdown.ItemController;
+import net.minecraft.world.item.Item;
+
+public class ItemControllerBuilderImpl extends AbstractControllerBuilderImpl<Item> implements ItemControllerBuilder {
+ public ItemControllerBuilderImpl(Option<Item> option) {
+ super(option);
+ }
+
+ @Override
+ public Controller<Item> build() {
+ return new ItemController(option);
+ }
+}