From 77493827f892f9c970db0ed7c070d36e9c079c76 Mon Sep 17 00:00:00 2001 From: winterflyt <36+winterflyt@noreply.skidsolutions.xyz> Date: Mon, 30 Nov 2026 06:01:06 +0200 Subject: [PATCH] Upload files to "src/openonyx/history/internal" --- .../history/internal/ItemListSetting.java | 171 ++++++++++ .../history/internal/ItemMappingSetting.java | 319 ++++++++++++++++++ .../history/internal/KeybindSetting.java | 157 +++++++++ .../history/internal/MultiEnumSetting.java | 158 +++++++++ .../history/internal/MultiSelectSetting.java | 145 ++++++++ 5 files changed, 950 insertions(+) create mode 100644 src/openonyx/history/internal/ItemListSetting.java create mode 100644 src/openonyx/history/internal/ItemMappingSetting.java create mode 100644 src/openonyx/history/internal/KeybindSetting.java create mode 100644 src/openonyx/history/internal/MultiEnumSetting.java create mode 100644 src/openonyx/history/internal/MultiSelectSetting.java diff --git a/src/openonyx/history/internal/ItemListSetting.java b/src/openonyx/history/internal/ItemListSetting.java new file mode 100644 index 0000000..98db100 --- /dev/null +++ b/src/openonyx/history/internal/ItemListSetting.java @@ -0,0 +1,171 @@ +package openonyx.history.internal; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonPrimitive; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.function.BooleanSupplier; +import java.util.function.Consumer; +import java.util.function.Predicate; +import net.minecraft.item.ItemStack; +import openonyx.history.SettingValue; +import openonyx.utilities.ItemSpec; + +public class ItemListSetting extends SettingValue> { + public ItemListSetting describe(String string) { + super.describe(string); + return this; + } + + public void D(ItemSpec itemSpec) { + if (this.L(itemSpec)) { + this.L(itemSpec); + } else { + this.d(itemSpec); + } + } + + public ItemListSetting visibleWhen(SettingValue settingValue) { + super.visibleWhen(settingValue); + return this; + } + + public ItemListSetting(String string, String... strings) { + super(string, L(strings)); + } + + public boolean L(ItemStack itemStack) { + ItemListSetting itemListSetting1 = this; + Iterator iterator = itemListSetting1.getValue().iterator(); + + while (iterator.hasNext()) { + if (((ItemSpec)iterator.next()).L(itemStack)) { + return true; + } + } + + return false; + } + + public void d(ItemSpec itemSpec) { + if (itemSpec != null && !this.L(itemSpec)) { + ArrayList arrayList; + (arrayList = new ArrayList<>(this.getValue())).add(itemSpec); + this.setValue(arrayList); + } + } + + private static List L(String... strings) { + String[] strings1 = strings; + ArrayList arrayList = new ArrayList(); + String[] strings2 = strings1; + int j = strings1.length; + + int i; + for (int k = i = 0; k < j; k = ++i) { + ItemSpec itemSpec; + if ((itemSpec = ItemSpec.d(strings2[i])) != null && !arrayList.contains(itemSpec)) { + arrayList.add(itemSpec); + } + } + + return arrayList; + } + + public ItemListSetting visibleWhen(BooleanSupplier booleanSupplier) { + super.visibleWhen(booleanSupplier); + return this; + } + + public ItemListSetting onChange(Consumer> consumer) { + super.onChange(consumer); + return this; + } + + @Override + public JsonElement toJson() { + ItemListSetting itemListSetting1 = this; + JsonArray jsonArray = new JsonArray(); + Iterator iterator; + Iterator iterator1 = iterator = itemListSetting1.getValue().iterator(); + + while (iterator1.hasNext()) { + ItemSpec itemSpec = (ItemSpec)iterator.next(); + iterator1 = iterator; + jsonArray.add(new JsonPrimitive(itemSpec.L())); + } + + return jsonArray; + } + + protected List L(List list) { + ArrayList arrayList = new ArrayList(); + if (list == null) { + return arrayList; + } + + Iterator iterator = list.iterator(); + + while (iterator.hasNext()) { + ItemSpec itemSpec; + if ((itemSpec = (ItemSpec)iterator.next()) != null && !arrayList.contains(itemSpec)) { + arrayList.add(itemSpec); + } + } + + return arrayList; + } + + public ItemListSetting visibleWhen(SettingValue settingValue, Predicate predicate) { + super.visibleWhen(settingValue, predicate); + return this; + } + + @Override + public void fromJson(JsonElement jsonElement) { + ItemListSetting itemListSetting1 = this; + if (jsonElement.isJsonArray()) { + ArrayList arrayList = new ArrayList(); + Iterator iterator = jsonElement.getAsJsonArray().iterator(); + + label31: + while (true) { + for (Iterator iterator1 = iterator; iterator1.hasNext(); iterator1 = iterator) { + JsonElement jsonElement1; + if (!(jsonElement1 = (JsonElement)iterator.next()).isJsonPrimitive()) { + continue label31; + } + + if (jsonElement1.getAsJsonPrimitive().isString()) { + ItemSpec itemSpec; + if ((itemSpec = ItemSpec.d(jsonElement1.getAsString())) != null && !arrayList.contains(itemSpec)) { + arrayList.add(itemSpec); + } + continue label31; + } + } + + itemListSetting1.setValue(arrayList); + return; + } + } + } + + public void L(ItemSpec itemSpec) { + if (itemSpec != null && this.L(itemSpec)) { + ArrayList arrayList; + (arrayList = new ArrayList<>(this.getValue())).remove(itemSpec); + this.setValue(arrayList); + } + } + + public boolean L(ItemSpec itemSpec) { + return this.getValue().contains(itemSpec); + } + + public void D() { + this.setValue(new ArrayList<>()); + } +} diff --git a/src/openonyx/history/internal/ItemMappingSetting.java b/src/openonyx/history/internal/ItemMappingSetting.java new file mode 100644 index 0000000..61cee10 --- /dev/null +++ b/src/openonyx/history/internal/ItemMappingSetting.java @@ -0,0 +1,319 @@ +package openonyx.history.internal; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonPrimitive; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.function.BooleanSupplier; +import java.util.function.Consumer; +import java.util.function.Predicate; +import net.minecraft.item.ItemStack; +import openonyx.history.SettingValue; +import openonyx.utilities.ItemSpec; + +public class ItemMappingSetting extends SettingValue>> { + public static final int e = 9; + + public void D() { + this.setValue(new LinkedHashMap<>()); + } + + public ItemMappingSetting describe(String string) { + super.describe(string); + return this; + } + + public void d(int i, ItemSpec itemSpec) { + ItemMappingSetting itemMappingSetting1 = this; + if (itemSpec != null && itemMappingSetting1.L(i).contains(itemSpec)) { + List list; + Map map; + if ((list = (List)(map = itemMappingSetting1.L()).get(i)) != null) { + list.remove(itemSpec); + if (list.isEmpty()) { + map.remove(i); + } + + itemMappingSetting1.setValue(map); + } + } + } + + public void L(int i) { + ItemMappingSetting itemMappingSetting1 = this; + if (!itemMappingSetting1.L(i).isEmpty()) { + Map map; + (map = itemMappingSetting1.L()).remove(i); + itemMappingSetting1.setValue(map); + } + } + + public int L(ItemStack itemStack) { + ItemMappingSetting itemMappingSetting1 = this; + int i = -1; + + label34: + for (int k = j = 0; k < 9; k = ++j) { + Iterator iterator = itemMappingSetting1.L(j).iterator(); + + while (true) { + Iterator iterator1 = iterator; + + while (true) { + if (!iterator1.hasNext()) { + continue label34; + } + + ItemSpec itemSpec; + if ((itemSpec = (ItemSpec)iterator.next()).L(itemStack)) { + if (itemSpec.L()) { + return j; + } + + if (i < 0) { + i = j; + } + break; + } + + iterator1 = iterator; + } + } + } + + return i; + } + + public boolean L(int i, ItemStack itemStack) { + Iterator iterator = this.L(i).iterator(); + + while (iterator.hasNext()) { + if (((ItemSpec)iterator.next()).L(itemStack)) { + return true; + } + } + + return false; + } + + private Map> L() { + ItemMappingSetting itemMappingSetting1 = this; + LinkedHashMap linkedHashMap = new LinkedHashMap(); + + Iterator iterator; + for (Iterator iterator1 = iterator = itemMappingSetting1.getValue().entrySet().iterator(); iterator1.hasNext(); iterator1 = iterator) { + Entry entry = (Entry)iterator.next(); + linkedHashMap.put((Integer)entry.getKey(), new ArrayList((Collection)entry.getValue())); + } + + return linkedHashMap; + } + + public ItemMappingSetting onChange(Consumer>> consumer) { + super.onChange(consumer); + return this; + } + + protected Map> L(Map> map) { + LinkedHashMap linkedHashMap = new LinkedHashMap(); + if (map == null) { + return linkedHashMap; + } + + int i; + for (int j = i = 0; j < 9; j = ++i) { + List list; + if ((list = (List)map.get(i)) != null) { + ArrayList arrayList = new ArrayList(); + Iterator iterator = list.iterator(); + + while (iterator.hasNext()) { + ItemSpec itemSpec; + if ((itemSpec = (ItemSpec)iterator.next()) != null && !arrayList.contains(itemSpec)) { + arrayList.add(itemSpec); + } + } + + if (!arrayList.isEmpty()) { + linkedHashMap.put(i, arrayList); + } + } + } + + return linkedHashMap; + } + + public List L(int i) { + List list; + return (list = this.getValue().get(i)) == null ? List.of() : list; + } + + public void L(int i, ItemSpec itemSpec) { + if (itemSpec != null && i >= 0 && i < 9) { + if (!this.L(i).contains(itemSpec)) { + Map map; + (map = this.L()).computeIfAbsent(i, integer -> new ArrayList<>()).add(itemSpec); + this.setValue(map); + } + } + } + + @Override + public void fromJson(JsonElement jsonElement) { + ItemMappingSetting itemMappingSetting1 = this; + if (jsonElement.isJsonObject()) { + LinkedHashMap linkedHashMap = new LinkedHashMap(); + Iterator iterator1 = jsonElement.getAsJsonObject().entrySet().iterator(); + + label65: + while (true) { + Iterator iterator3 = iterator1; + + while (iterator3.hasNext()) { + Entry entry = (Entry)iterator1.next(); + + int i; + try { + i = Integer.parseInt((String)entry.getKey()); + } catch (NumberFormatException numberFormatException) { + iterator3 = iterator1; + continue; + } + + if (i < 0 || i >= 9) { + continue label65; + } + + if (((JsonElement)entry.getValue()).isJsonArray()) { + ArrayList arrayList = new ArrayList(); + Iterator iterator = ((JsonElement)entry.getValue()).getAsJsonArray().iterator(); + + label54: + while (true) { + for (Iterator iterator2 = iterator; iterator2.hasNext(); iterator2 = iterator) { + JsonElement jsonElement1; + if (!(jsonElement1 = (JsonElement)iterator.next()).isJsonPrimitive()) { + continue label54; + } + + if (jsonElement1.getAsJsonPrimitive().isString()) { + ItemSpec itemSpec; + if ((itemSpec = ItemSpec.d(jsonElement1.getAsString())) != null && !arrayList.contains(itemSpec)) { + arrayList.add(itemSpec); + } + continue label54; + } + } + + if (!arrayList.isEmpty()) { + linkedHashMap.put(i, arrayList); + } + continue label65; + } + } + + iterator3 = iterator1; + } + + itemMappingSetting1.setValue(linkedHashMap); + return; + } + } + } + + public boolean d() { + return this.getValue().isEmpty(); + } + + public static Map> L(Object... objects) { + Object[] objects1 = objects; + LinkedHashMap linkedHashMap = new LinkedHashMap(); + + byte b; + for (byte c = b = 0; c + 1 < objects1.length; c = b) { + int i = (Integer)objects1[b]; + ItemSpec itemSpec; + if ((itemSpec = ItemSpec.d(String.valueOf(objects1[b + 1]))) != null && i >= 0 && i < 9) { + linkedHashMap.computeIfAbsent(i, integer -> new ArrayList<>()).add(itemSpec); + } + + b += 2; + } + + return linkedHashMap; + } + + public ItemMappingSetting visibleWhen(SettingValue settingValue) { + super.visibleWhen(settingValue); + return this; + } + + public ItemMappingSetting visibleWhen(SettingValue settingValue, Predicate predicate) { + super.visibleWhen(settingValue, predicate); + return this; + } + + public ItemMappingSetting visibleWhen(BooleanSupplier booleanSupplier) { + super.visibleWhen(booleanSupplier); + return this; + } + + public ItemMappingSetting(String string, Map> map) { + super(string, map); + } + + @Override + public JsonElement toJson() { + ItemMappingSetting itemMappingSetting1 = this; + JsonObject jsonObject = new JsonObject(); + + int i; + for (int j = i = 0; j < 9; j = ++i) { + List list; + if (!(list = itemMappingSetting1.L(i)).isEmpty()) { + JsonArray jsonArray = new JsonArray(); + Iterator iterator; + Iterator iterator1 = iterator = list.iterator(); + + while (iterator1.hasNext()) { + ItemSpec itemSpec = (ItemSpec)iterator.next(); + iterator1 = iterator; + jsonArray.add(new JsonPrimitive(itemSpec.L())); + } + + jsonObject.add(String.valueOf(i), jsonArray); + } + } + + return jsonObject; + } + + public void L(int i, int j, ItemSpec itemSpec) { + if (itemSpec != null && i != j && j >= 0 && j < 9) { + if (this.L(i).contains(itemSpec)) { + Map map; + List list; + if ((list = (List)(map = this.L()).get(i)) != null) { + list.remove(itemSpec); + if (list.isEmpty()) { + map.remove(i); + } + } + + List list1; + if (!(list1 = map.computeIfAbsent(j, integer -> new ArrayList())).contains(itemSpec)) { + list1.add(itemSpec); + } + + this.setValue(map); + } + } + } +} diff --git a/src/openonyx/history/internal/KeybindSetting.java b/src/openonyx/history/internal/KeybindSetting.java new file mode 100644 index 0000000..f733872 --- /dev/null +++ b/src/openonyx/history/internal/KeybindSetting.java @@ -0,0 +1,157 @@ +package openonyx.history.internal; + +import com.google.gson.JsonElement; +import com.google.gson.JsonPrimitive; +import java.util.function.BooleanSupplier; +import java.util.function.Consumer; +import java.util.function.Predicate; +import openonyx.features.ModuleState; +import openonyx.history.SettingValue; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; + +public class KeybindSetting extends SettingValue { + public static final int H = 0; + private EnumSetting bindMode; + + public boolean matchesMouse(int i) { + return this.isBound() && this.getValue() < 0 && this.getValue() == -i - 1; + } + + public KeybindSetting visibleWhen(BooleanSupplier booleanSupplier) { + super.visibleWhen(booleanSupplier); + return this; + } + + public boolean matchesKey(int i) { + return this.isBound() && this.getValue() == i; + } + + public KeybindSetting visibleWhen(SettingValue settingValue, Predicate predicate) { + super.visibleWhen(settingValue, predicate); + return this; + } + + public int getMouseButton() { + return this.isMouse() ? -this.getValue() - 1 : -1; + } + + @Override + public JsonElement toJson() { + return new JsonPrimitive(this.getValue()); + } + + public KeybindSetting onChange(Consumer consumer) { + super.onChange(consumer); + return this; + } + + public boolean isPressed() { + if (this.isKey()) { + return Keyboard.isKeyDown(this.getKeyCode()); + } else { + return this.isMouse() ? Mouse.isButtonDown(this.getMouseButton()) : false; + } + } + + public void clear() { + this.setValue(0); + } + + public int getKeyCode() { + return this.isKey() ? this.getValue() : 0; + } + + public KeybindSetting(String string, int i) { + super(string, i); + } + + public KeybindSetting withBindMode(EnumSetting enumSetting) { + this.bindMode = enumSetting; + return this; + } + + public KeybindSetting describe(String string) { + super.describe(string); + return this; + } + + public EnumSetting getBindMode() { + return this.bindMode; + } + + public void bind(int i) { + if (i == 0) { + this.clear(); + } else { + if (i > 0) { + this.setValue(i); + } + } + } + + public boolean isKey() { + return this.isBound() && this.getValue() > 0; + } + + public boolean isBound() { + return this.getValue() != 0; + } + + public String getDisplayName() { + KeybindSetting keybindSetting1 = this; + if (!keybindSetting1.isBound()) { + return "None"; + } + + if (keybindSetting1.isKey()) { + String string; + return (string = Keyboard.getKeyName(keybindSetting1.getValue())) == null ? "None" : string; + } + + int i; + switch (i = keybindSetting1.getMouseButton()) { + case 0: + while (false) { + } + + return "LMB"; + case 1: + return "RMB"; + case 2: + return "MMB"; + case 3: + return "Mouse 4"; + case 4: + return "Mouse 5"; + default: + return new StringBuilder().insert(0, "Mouse ").append(i + 1).toString(); + } + } + + public KeybindSetting(String string) { + this(string, 0); + } + + public boolean isMouse() { + return this.isBound() && this.getValue() < 0; + } + + @Override + public void fromJson(JsonElement jsonElement) { + if (jsonElement.isJsonPrimitive() && jsonElement.getAsJsonPrimitive().isNumber()) { + this.setValue(jsonElement.getAsInt()); + } + } + + public KeybindSetting visibleWhen(SettingValue settingValue) { + super.visibleWhen(settingValue); + return this; + } + + public void bindMouse(int i) { + if (i >= 0) { + this.setValue(-i - 1); + } + } +} diff --git a/src/openonyx/history/internal/MultiEnumSetting.java b/src/openonyx/history/internal/MultiEnumSetting.java new file mode 100644 index 0000000..fbdccc7 --- /dev/null +++ b/src/openonyx/history/internal/MultiEnumSetting.java @@ -0,0 +1,158 @@ +package openonyx.history.internal; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonPrimitive; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.function.BooleanSupplier; +import java.util.function.Consumer; +import java.util.function.Predicate; +import openonyx.history.SettingValue; + +public class MultiEnumSetting> extends SettingValue> { + private final Class enumClass; + private final List values; + + @SafeVarargs + public MultiEnumSetting(String string, Class class_, E... enums) { + super(string, List.of((E[])enums)); + this.enumClass = class_; + this.values = List.of((E[])class_.getEnumConstants()); + } + + public MultiEnumSetting visibleWhen(SettingValue settingValue) { + super.visibleWhen(settingValue); + return this; + } + + public boolean isEmpty() { + return this.getValue().isEmpty(); + } + + public Class getEnumClass() { + return this.enumClass; + } + + @Override + public JsonElement toJson() { + MultiEnumSetting multiEnumSetting1 = this; + JsonArray jsonArray = new JsonArray(); + Iterator iterator; + Iterator iterator1 = iterator = multiEnumSetting1.getValue().iterator(); + + while (iterator1.hasNext()) { + Enum enum_ = (Enum)iterator.next(); + iterator1 = iterator; + jsonArray.add(new JsonPrimitive(enum_.name())); + } + + return jsonArray; + } + + public void toggle(E enum_) { + MultiEnumSetting multiEnumSetting1 = this; + ArrayList arrayList; + if (!(arrayList = new ArrayList<>(multiEnumSetting1.getValue())).remove(enum_)) { + arrayList.add(enum_); + } + + multiEnumSetting1.setValue(arrayList); + } + + public void set(E enum_, boolean bl) { + if (this.contains((E)enum_) != bl) { + this.toggle((E)enum_); + } + } + + @Override + public void fromJson(JsonElement jsonElement) { + if (jsonElement.isJsonArray()) { + ArrayList arrayList = new ArrayList(); + Iterator iterator1 = jsonElement.getAsJsonArray().iterator(); + + label37: + while (true) { + for (Iterator iterator2 = iterator1; iterator2.hasNext(); iterator2 = iterator1) { + JsonElement jsonElement1; + if (!(jsonElement1 = (JsonElement)iterator1.next()).isJsonPrimitive()) { + continue label37; + } + + if (jsonElement1.getAsJsonPrimitive().isString()) { + String string = jsonElement1.getAsString(); + Iterator iterator = this.values.iterator(); + + while (iterator.hasNext()) { + Enum enum_; + if ((enum_ = (Enum)iterator.next()).name().equals(string)) { + arrayList.add(enum_); + } + } + continue label37; + } + } + + this.setValue(arrayList); + return; + } + } + } + + public boolean contains(E enum_) { + return this.getValue().contains(enum_); + } + + public List getValues() { + return this.values; + } + + public MultiEnumSetting visibleWhen(BooleanSupplier booleanSupplier) { + super.visibleWhen(booleanSupplier); + return this; + } + + public void move(int i, int j) { + MultiEnumSetting multiEnumSetting1 = this; + List list = multiEnumSetting1.getValue(); + if (i >= 0 && i < list.size()) { + if ((j = Math.clamp(j, 0, list.size() - 1)) != i) { + ArrayList arrayList; + Enum enum_ = (Enum)(arrayList = new ArrayList<>(list)).remove(i); + arrayList.add(j, enum_); + multiEnumSetting1.setValue(arrayList); + } + } + } + + public MultiEnumSetting visibleWhen(SettingValue settingValue, Predicate predicate) { + super.visibleWhen(settingValue, predicate); + return this; + } + + protected List sanitize(List list) { + ArrayList arrayList = new ArrayList(); + Iterator iterator = list.iterator(); + + while (iterator.hasNext()) { + Enum enum_; + if ((enum_ = (Enum)iterator.next()) != null && !arrayList.contains(enum_)) { + arrayList.add(enum_); + } + } + + return List.copyOf(arrayList); + } + + public MultiEnumSetting describe(String string) { + super.describe(string); + return this; + } + + public MultiEnumSetting onChange(Consumer> consumer) { + super.onChange(consumer); + return this; + } +} diff --git a/src/openonyx/history/internal/MultiSelectSetting.java b/src/openonyx/history/internal/MultiSelectSetting.java new file mode 100644 index 0000000..f0cae2e --- /dev/null +++ b/src/openonyx/history/internal/MultiSelectSetting.java @@ -0,0 +1,145 @@ +package openonyx.history.internal; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonPrimitive; +import java.util.EnumSet; +import java.util.Iterator; +import java.util.List; +import java.util.function.BooleanSupplier; +import java.util.function.Consumer; +import java.util.function.Predicate; +import openonyx.history.SettingValue; + +public class MultiSelectSetting> extends SettingValue> { + private final Class enumClass; + private final List values; + private boolean allowEmpty = true; + + public MultiSelectSetting allowEmpty(boolean bl) { + this.allowEmpty = bl; + return this; + } + + @Override + public void fromJson(JsonElement jsonElement) { + if (jsonElement.isJsonArray()) { + EnumSet enumSet = EnumSet.noneOf(this.enumClass); + Iterator iterator1 = jsonElement.getAsJsonArray().iterator(); + + label37: + while (true) { + for (Iterator iterator2 = iterator1; iterator2.hasNext(); iterator2 = iterator1) { + JsonElement jsonElement1; + if (!(jsonElement1 = (JsonElement)iterator1.next()).isJsonPrimitive()) { + continue label37; + } + + if (jsonElement1.getAsJsonPrimitive().isString()) { + String string = jsonElement1.getAsString(); + Iterator iterator = this.values.iterator(); + + while (iterator.hasNext()) { + Enum enum_; + if ((enum_ = (Enum)iterator.next()).name().equals(string)) { + enumSet.add((E)enum_); + } + } + continue label37; + } + } + + this.setValue(enumSet); + return; + } + } + } + + public void set(E enum_, boolean bl) { + if (this.contains((E)enum_) != bl) { + this.toggle((E)enum_); + } + } + + public MultiSelectSetting visibleWhen(SettingValue settingValue, Predicate predicate) { + super.visibleWhen(settingValue, predicate); + return this; + } + + public boolean contains(E enum_) { + return this.getValue().contains(enum_); + } + + public MultiSelectSetting visibleWhen(BooleanSupplier booleanSupplier) { + super.visibleWhen(booleanSupplier); + return this; + } + + public boolean isEmpty() { + return this.getValue().isEmpty(); + } + + public Class getEnumClass() { + return this.enumClass; + } + + public MultiSelectSetting onChange(Consumer> consumer) { + super.onChange(consumer); + return this; + } + + public void toggle(E enum_) { + MultiSelectSetting multiSelectSetting1 = this; + EnumSet enumSet; + if (!(enumSet = EnumSet.copyOf(multiSelectSetting1.getValue())).remove(enum_)) { + enumSet.add((E)enum_); + } + + multiSelectSetting1.setValue(enumSet); + } + + protected EnumSet sanitize(EnumSet enumSet) { + return !this.allowEmpty && enumSet.isEmpty() && this.getValue() != null ? this.getValue() : EnumSet.copyOf(enumSet); + } + + @Override + public JsonElement toJson() { + MultiSelectSetting multiSelectSetting1 = this; + JsonArray jsonArray = new JsonArray(); + Iterator iterator; + Iterator iterator1 = iterator = multiSelectSetting1.getValue().iterator(); + + while (iterator1.hasNext()) { + Enum enum_ = (Enum)iterator.next(); + iterator1 = iterator; + jsonArray.add(new JsonPrimitive(enum_.name())); + } + + return jsonArray; + } + + public boolean isEmptyAllowed() { + return this.allowEmpty; + } + + @SafeVarargs + public MultiSelectSetting(String string, Class class_, E... enums) { + super(string, enums.length == 0 ? EnumSet.noneOf(class_) : EnumSet.copyOf(List.of((E[])enums))); + this.enumClass = class_; + this.values = List.of((E[])class_.getEnumConstants()); + } + + public List getValues() { + return this.values; + } + + public MultiSelectSetting visibleWhen(SettingValue settingValue) { + super.visibleWhen(settingValue); + return this; + } + + public MultiSelectSetting describe(String string) { + super.describe(string); + return this; + } +}