aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/java/dev/isxander/yacl/api/Binding.java64
-rw-r--r--src/client/java/dev/isxander/yacl/api/ButtonOption.java66
-rw-r--r--src/client/java/dev/isxander/yacl/api/ConfigCategory.java94
-rw-r--r--src/client/java/dev/isxander/yacl/api/Controller.java28
-rw-r--r--src/client/java/dev/isxander/yacl/api/LabelOption.java41
-rw-r--r--src/client/java/dev/isxander/yacl/api/ListOption.java152
-rw-r--r--src/client/java/dev/isxander/yacl/api/ListOptionEntry.java23
-rw-r--r--src/client/java/dev/isxander/yacl/api/NameableEnum.java10
-rw-r--r--src/client/java/dev/isxander/yacl/api/Option.java227
-rw-r--r--src/client/java/dev/isxander/yacl/api/OptionAddable.java19
-rw-r--r--src/client/java/dev/isxander/yacl/api/OptionFlag.java23
-rw-r--r--src/client/java/dev/isxander/yacl/api/OptionGroup.java94
-rw-r--r--src/client/java/dev/isxander/yacl/api/PlaceholderCategory.java52
-rw-r--r--src/client/java/dev/isxander/yacl/api/YetAnotherConfigLib.java107
-rw-r--r--src/client/java/dev/isxander/yacl/api/utils/OptionUtils.java39
-rw-r--r--src/client/java/dev/isxander/yacl/gui/AbstractWidget.java107
-rw-r--r--src/client/java/dev/isxander/yacl/gui/CategoryListWidget.java99
-rw-r--r--src/client/java/dev/isxander/yacl/gui/CategoryWidget.java38
-rw-r--r--src/client/java/dev/isxander/yacl/gui/ElementListWidgetExt.java179
-rw-r--r--src/client/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java29
-rw-r--r--src/client/java/dev/isxander/yacl/gui/OptionListWidget.java568
-rw-r--r--src/client/java/dev/isxander/yacl/gui/RequireRestartScreen.java21
-rw-r--r--src/client/java/dev/isxander/yacl/gui/SearchFieldWidget.java66
-rw-r--r--src/client/java/dev/isxander/yacl/gui/TextScaledButtonWidget.java34
-rw-r--r--src/client/java/dev/isxander/yacl/gui/TooltipButtonWidget.java34
-rw-r--r--src/client/java/dev/isxander/yacl/gui/YACLScreen.java316
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/ActionController.java120
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/BooleanController.java157
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/ColorController.java221
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/ControllerWidget.java170
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/LabelController.java193
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/ListEntryWidget.java133
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/TickBoxController.java120
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/cycling/CyclingControllerElement.java60
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/cycling/CyclingListController.java79
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/cycling/EnumController.java60
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/cycling/ICyclingController.java38
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/package-info.java12
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/slider/DoubleSliderController.java114
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/slider/FloatSliderController.java114
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/slider/ISliderController.java54
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/slider/IntegerSliderController.java111
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/slider/LongSliderController.java111
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/slider/SliderControllerElement.java164
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/slider/package-info.java10
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/string/IStringController.java44
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/string/StringController.java40
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/string/StringControllerElement.java408
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/string/number/DoubleFieldController.java104
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/string/number/FloatFieldController.java104
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/string/number/IntegerFieldController.java109
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/string/number/LongFieldController.java109
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/string/number/NumberFieldController.java69
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/string/number/package-info.java10
-rw-r--r--src/client/java/dev/isxander/yacl/gui/utils/GuiUtils.java41
-rw-r--r--src/client/java/dev/isxander/yacl/impl/ButtonOptionImpl.java218
-rw-r--r--src/client/java/dev/isxander/yacl/impl/ConfigCategoryImpl.java137
-rw-r--r--src/client/java/dev/isxander/yacl/impl/GenericBindingImpl.java35
-rw-r--r--src/client/java/dev/isxander/yacl/impl/LabelOptionImpl.java154
-rw-r--r--src/client/java/dev/isxander/yacl/impl/ListOptionEntryImpl.java149
-rw-r--r--src/client/java/dev/isxander/yacl/impl/ListOptionImpl.java338
-rw-r--r--src/client/java/dev/isxander/yacl/impl/OptionGroupImpl.java129
-rw-r--r--src/client/java/dev/isxander/yacl/impl/OptionImpl.java304
-rw-r--r--src/client/java/dev/isxander/yacl/impl/PlaceholderCategoryImpl.java99
-rw-r--r--src/client/java/dev/isxander/yacl/impl/YetAnotherConfigLibImpl.java122
-rw-r--r--src/client/java/dev/isxander/yacl/mixin/client/AbstractSelectionListMixin.java26
-rw-r--r--src/client/java/dev/isxander/yacl/mixin/client/OptionInstanceAccessor.java13
-rw-r--r--src/client/resources/yet-another-config-lib.client.mixins.json14
-rw-r--r--src/main/java/dev/isxander/yacl/api/utils/Dimension.java33
-rw-r--r--src/main/java/dev/isxander/yacl/api/utils/MutableDimension.java11
-rw-r--r--src/main/java/dev/isxander/yacl/config/ConfigEntry.java11
-rw-r--r--src/main/java/dev/isxander/yacl/config/ConfigInstance.java48
-rw-r--r--src/main/java/dev/isxander/yacl/config/GsonConfigInstance.java212
-rw-r--r--src/main/java/dev/isxander/yacl/impl/utils/DimensionIntegerImpl.java115
-rw-r--r--src/main/java/dev/isxander/yacl/impl/utils/YACLConstants.java8
-rw-r--r--src/main/resources/assets/yet-another-config-lib/lang/el_gr.json23
-rw-r--r--src/main/resources/assets/yet-another-config-lib/lang/en_us.json29
-rw-r--r--src/main/resources/assets/yet-another-config-lib/lang/et_ee.json18
-rw-r--r--src/main/resources/assets/yet-another-config-lib/lang/fr_fr.json29
-rw-r--r--src/main/resources/assets/yet-another-config-lib/lang/pl_pl.json23
-rw-r--r--src/main/resources/assets/yet-another-config-lib/lang/pt_br.json18
-rw-r--r--src/main/resources/assets/yet-another-config-lib/lang/ru_ru.json24
-rw-r--r--src/main/resources/assets/yet-another-config-lib/lang/sl_si.json22
-rw-r--r--src/main/resources/assets/yet-another-config-lib/lang/zh_cn.json29
-rw-r--r--src/main/resources/assets/yet-another-config-lib/lang/zh_tw.json23
-rw-r--r--src/main/resources/fabric.mod.json39
-rw-r--r--src/main/resources/yacl-128x.pngbin13813 -> 0 bytes
-rw-r--r--src/main/resources/yacl.accesswidener6
-rw-r--r--src/testmod/java/dev/isxander/yacl/test/ExampleMod.java11
-rw-r--r--src/testmod/java/dev/isxander/yacl/test/config/ExampleConfig.java44
-rw-r--r--src/testmod/java/dev/isxander/yacl/test/config/GuiTest.java449
-rw-r--r--src/testmod/java/dev/isxander/yacl/test/mixins/TitleScreenMixin.java30
-rw-r--r--src/testmod/resources/fabric.mod.json22
-rw-r--r--src/testmod/resources/yet-another-config-lib.test.mixins.json11
94 files changed, 0 insertions, 8635 deletions
diff --git a/src/client/java/dev/isxander/yacl/api/Binding.java b/src/client/java/dev/isxander/yacl/api/Binding.java
deleted file mode 100644
index ba5a2c0..0000000
--- a/src/client/java/dev/isxander/yacl/api/Binding.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package dev.isxander.yacl.api;
-
-import dev.isxander.yacl.impl.GenericBindingImpl;
-import dev.isxander.yacl.mixin.client.OptionInstanceAccessor;
-import net.minecraft.client.OptionInstance;
-import org.apache.commons.lang3.Validate;
-
-import java.util.function.Consumer;
-import java.util.function.Supplier;
-
-/**
- * Controls modifying the bound option.
- * Provides the default value, a setter and a getter.
- */
-public interface Binding<T> {
- void setValue(T value);
-
- T getValue();
-
- T defaultValue();
-
- /**
- * Creates a generic binding.
- *
- * @param def default value of the option, used to reset
- * @param getter should return the current value of the option
- * @param setter should set the option to the supplied value
- */
- static <T> Binding<T> generic(T def, Supplier<T> getter, Consumer<T> setter) {
- Validate.notNull(def, "`def` must not be null");
- Validate.notNull(getter, "`getter` must not be null");
- Validate.notNull(setter, "`setter` must not be null");
-
- return new GenericBindingImpl<>(def, getter, setter);
- }
-
- /**
- * Creates a {@link Binding} for Minecraft's {@link OptionInstance}
- */
- static <T> Binding<T> minecraft(OptionInstance<T> minecraftOption) {
- Validate.notNull(minecraftOption, "`minecraftOption` must not be null");
-
- return new GenericBindingImpl<>(
- ((OptionInstanceAccessor<T>) (Object) minecraftOption).getInitialValue(),
- minecraftOption::get,
- minecraftOption::set
- );
- }
-
- /**
- * Creates an immutable binding that has no default and cannot be modified.
- *
- * @param value the value for the binding
- */
- static <T> Binding<T> immutable(T value) {
- Validate.notNull(value, "`value` must not be null");
-
- return new GenericBindingImpl<>(
- value,
- () -> value,
- changed -> {}
- );
- }
-}
diff --git a/src/client/java/dev/isxander/yacl/api/ButtonOption.java b/src/client/java/dev/isxander/yacl/api/ButtonOption.java
deleted file mode 100644
index 88e1c4b..0000000
--- a/src/client/java/dev/isxander/yacl/api/ButtonOption.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package dev.isxander.yacl.api;
-
-import dev.isxander.yacl.gui.YACLScreen;
-import dev.isxander.yacl.impl.ButtonOptionImpl;
-import net.minecraft.network.chat.Component;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.function.BiConsumer;
-import java.util.function.Consumer;
-import java.util.function.Function;
-
-public interface ButtonOption extends Option<BiConsumer<YACLScreen, ButtonOption>> {
- /**
- * Action to be executed upon button press
- */
- BiConsumer<YACLScreen, ButtonOption> action();
-
- static dev.isxander.yacl.api.ButtonOption.Builder createBuilder() {
- return new ButtonOptionImpl.BuilderImpl();
- }
-
- interface Builder {
- /**
- * Sets the name to be used by the option.
- *
- * @see Option#name()
- */
- dev.isxander.yacl.api.ButtonOption.Builder name(@NotNull Component name);
-
- /**
- * Sets the tooltip to be used by the option.
- * Can be invoked twice to append more lines.
- * No need to wrap the text yourself, the gui does this itself.
- *
- * @param tooltips text lines - merged with a new-line on {@link Option.Builder#build()}.
- */
- dev.isxander.yacl.api.ButtonOption.Builder tooltip(@NotNull Component... tooltips);
-
- dev.isxander.yacl.api.ButtonOption.Builder action(@NotNull BiConsumer<YACLScreen, ButtonOption> action);
-
- /**
- * Action to be executed upon button press
- *
- * @see ButtonOption#action()
- */
- @Deprecated
- dev.isxander.yacl.api.ButtonOption.Builder action(@NotNull Consumer<YACLScreen> action);
-
- /**
- * Sets if the option can be configured
- *
- * @see Option#available()
- */
- dev.isxander.yacl.api.ButtonOption.Builder available(boolean available);
-
- /**
- * Sets the controller for the option.
- * This is how you interact and change the options.
- *
- * @see dev.isxander.yacl.gui.controllers
- */
- dev.isxander.yacl.api.ButtonOption.Builder controller(@NotNull Function<ButtonOption, Controller<BiConsumer<YACLScreen, ButtonOption>>> control);
-
- ButtonOption build();
- }
-}
diff --git a/src/client/java/dev/isxander/yacl/api/ConfigCategory.java b/src/client/java/dev/isxander/yacl/api/ConfigCategory.java
deleted file mode 100644
index 7764479..0000000
--- a/src/client/java/dev/isxander/yacl/api/ConfigCategory.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package dev.isxander.yacl.api;
-
-import com.google.common.collect.ImmutableList;
-import dev.isxander.yacl.impl.ConfigCategoryImpl;
-import net.minecraft.network.chat.Component;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Collection;
-
-/**
- * Separates {@link Option}s or {@link OptionGroup}s into multiple distinct sections.
- * Served to a user as a button in the left column,
- * upon pressing, the options list is filled with options contained within this category.
- */
-public interface ConfigCategory {
- /**
- * Name of category, displayed as a button on the left column.
- */
- @NotNull Component name();
-
- /**
- * Gets every {@link OptionGroup} in this category.
- */
- @NotNull ImmutableList<OptionGroup> groups();
-
- /**
- * Tooltip (or description) of the category.
- * Rendered on hover.
- */
- @NotNull Component tooltip();
-
- /**
- * Creates a builder to construct a {@link ConfigCategory}
- */
- static Builder createBuilder() {
- return new ConfigCategoryImpl.BuilderImpl();
- }
-
- interface Builder extends OptionAddable {
- /**
- * Sets name of the category
- *
- * @see ConfigCategory#name()
- */
- Builder name(@NotNull Component name);
-
- /**
- * Adds an option to the root group of the category.
- * To add to another group, use {@link Builder#group(OptionGroup)}.
- * To construct an option, use {@link Option#createBuilder(Class)}
- *
- * @see ConfigCategory#groups()
- * @see OptionGroup#isRoot()
- */
- @Override
- Builder option(@NotNull Option<?> option);
-
- /**
- * Adds multiple options to the root group of the category.
- * To add to another group, use {@link Builder#groups(Collection)}.
- * To construct an option, use {@link Option#createBuilder(Class)}
- *
- * @see ConfigCategory#groups()
- * @see OptionGroup#isRoot()
- */
- @Override
- Builder options(@NotNull Collection<? extends Option<?>> options);
-
- /**
- * Adds an option group.
- * To add an option to the root group, use {@link Builder#option(Option)}
- * To construct a group, use {@link OptionGroup#createBuilder()}
-