diff options
-rw-r--r-- | .github/workflows/gradle.yml | 12 | ||||
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | build.gradle.kts | 260 | ||||
-rw-r--r-- | common/.gitignore | 42 | ||||
-rw-r--r-- | common/build.gradle.kts | 52 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/api/Binding.java (renamed from src/client/java/dev/isxander/yacl/api/Binding.java) | 2 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/api/ButtonOption.java (renamed from src/client/java/dev/isxander/yacl/api/ButtonOption.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/api/ConfigCategory.java (renamed from src/client/java/dev/isxander/yacl/api/ConfigCategory.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/api/Controller.java (renamed from src/client/java/dev/isxander/yacl/api/Controller.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/api/LabelOption.java (renamed from src/client/java/dev/isxander/yacl/api/LabelOption.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/api/ListOption.java (renamed from src/client/java/dev/isxander/yacl/api/ListOption.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/api/ListOptionEntry.java (renamed from src/client/java/dev/isxander/yacl/api/ListOptionEntry.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/api/NameableEnum.java (renamed from src/client/java/dev/isxander/yacl/api/NameableEnum.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/api/Option.java (renamed from src/client/java/dev/isxander/yacl/api/Option.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/api/OptionAddable.java (renamed from src/client/java/dev/isxander/yacl/api/OptionAddable.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/api/OptionFlag.java (renamed from src/client/java/dev/isxander/yacl/api/OptionFlag.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/api/OptionGroup.java (renamed from src/client/java/dev/isxander/yacl/api/OptionGroup.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/api/PlaceholderCategory.java (renamed from src/client/java/dev/isxander/yacl/api/PlaceholderCategory.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/api/YetAnotherConfigLib.java (renamed from src/client/java/dev/isxander/yacl/api/YetAnotherConfigLib.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/api/utils/Dimension.java (renamed from src/main/java/dev/isxander/yacl/api/utils/Dimension.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/api/utils/MutableDimension.java (renamed from src/main/java/dev/isxander/yacl/api/utils/MutableDimension.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/api/utils/OptionUtils.java (renamed from src/client/java/dev/isxander/yacl/api/utils/OptionUtils.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/config/ConfigEntry.java (renamed from src/main/java/dev/isxander/yacl/config/ConfigEntry.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/config/ConfigInstance.java (renamed from src/main/java/dev/isxander/yacl/config/ConfigInstance.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/config/GsonConfigInstance.java (renamed from src/main/java/dev/isxander/yacl/config/GsonConfigInstance.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/AbstractWidget.java (renamed from src/client/java/dev/isxander/yacl/gui/AbstractWidget.java) | 2 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/CategoryListWidget.java (renamed from src/client/java/dev/isxander/yacl/gui/CategoryListWidget.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/CategoryWidget.java (renamed from src/client/java/dev/isxander/yacl/gui/CategoryWidget.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/ElementListWidgetExt.java (renamed from src/client/java/dev/isxander/yacl/gui/ElementListWidgetExt.java) | 4 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java (renamed from src/client/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java) | 1 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java (renamed from src/client/java/dev/isxander/yacl/gui/OptionListWidget.java) | 28 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/RequireRestartScreen.java (renamed from src/client/java/dev/isxander/yacl/gui/RequireRestartScreen.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/SearchFieldWidget.java (renamed from src/client/java/dev/isxander/yacl/gui/SearchFieldWidget.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/TextScaledButtonWidget.java (renamed from src/client/java/dev/isxander/yacl/gui/TextScaledButtonWidget.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/TooltipButtonWidget.java (renamed from src/client/java/dev/isxander/yacl/gui/TooltipButtonWidget.java) | 5 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/YACLScreen.java (renamed from src/client/java/dev/isxander/yacl/gui/YACLScreen.java) | 5 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/ActionController.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/ActionController.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/BooleanController.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/BooleanController.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/ColorController.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/ColorController.java) | 2 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/ControllerWidget.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/ControllerWidget.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/LabelController.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/LabelController.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/ListEntryWidget.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/ListEntryWidget.java) | 4 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/TickBoxController.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/TickBoxController.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/cycling/CyclingControllerElement.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/cycling/CyclingControllerElement.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/cycling/CyclingListController.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/cycling/CyclingListController.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/cycling/EnumController.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/cycling/EnumController.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/cycling/ICyclingController.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/cycling/ICyclingController.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/package-info.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/package-info.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/slider/DoubleSliderController.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/slider/DoubleSliderController.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/slider/FloatSliderController.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/slider/FloatSliderController.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/slider/ISliderController.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/slider/ISliderController.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/slider/IntegerSliderController.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/slider/IntegerSliderController.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/slider/LongSliderController.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/slider/LongSliderController.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/slider/SliderControllerElement.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/slider/SliderControllerElement.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/slider/package-info.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/slider/package-info.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/string/IStringController.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/string/IStringController.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/string/StringController.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/string/StringController.java) | 3 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/string/StringControllerElement.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/string/StringControllerElement.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/string/number/DoubleFieldController.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/string/number/DoubleFieldController.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/string/number/FloatFieldController.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/string/number/FloatFieldController.java) | 8 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/string/number/IntegerFieldController.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/string/number/IntegerFieldController.java) | 8 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/string/number/LongFieldController.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/string/number/LongFieldController.java) | 8 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/string/number/NumberFieldController.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/string/number/NumberFieldController.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/controllers/string/number/package-info.java (renamed from src/client/java/dev/isxander/yacl/gui/controllers/string/number/package-info.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/utils/GuiUtils.java (renamed from src/client/java/dev/isxander/yacl/gui/utils/GuiUtils.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/impl/ButtonOptionImpl.java (renamed from src/client/java/dev/isxander/yacl/impl/ButtonOptionImpl.java) | 14 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/impl/ConfigCategoryImpl.java (renamed from src/client/java/dev/isxander/yacl/impl/ConfigCategoryImpl.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/impl/GenericBindingImpl.java (renamed from src/client/java/dev/isxander/yacl/impl/GenericBindingImpl.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/impl/LabelOptionImpl.java (renamed from src/client/java/dev/isxander/yacl/impl/LabelOptionImpl.java) | 6 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/impl/ListOptionEntryImpl.java (renamed from src/client/java/dev/isxander/yacl/impl/ListOptionEntryImpl.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/impl/ListOptionImpl.java (renamed from src/client/java/dev/isxander/yacl/impl/ListOptionImpl.java) | 26 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/impl/OptionGroupImpl.java (renamed from src/client/java/dev/isxander/yacl/impl/OptionGroupImpl.java) | 2 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/impl/OptionImpl.java (renamed from src/client/java/dev/isxander/yacl/impl/OptionImpl.java) | 27 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/impl/PlaceholderCategoryImpl.java (renamed from src/client/java/dev/isxander/yacl/impl/PlaceholderCategoryImpl.java) | 2 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/impl/YetAnotherConfigLibImpl.java (renamed from src/client/java/dev/isxander/yacl/impl/YetAnotherConfigLibImpl.java) | 12 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/impl/utils/DimensionIntegerImpl.java (renamed from src/main/java/dev/isxander/yacl/impl/utils/DimensionIntegerImpl.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/impl/utils/YACLConstants.java (renamed from src/main/java/dev/isxander/yacl/impl/utils/YACLConstants.java) | 0 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/mixin/AbstractSelectionListMixin.java (renamed from src/client/java/dev/isxander/yacl/mixin/client/AbstractSelectionListMixin.java) | 3 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/mixin/OptionInstanceAccessor.java (renamed from src/client/java/dev/isxander/yacl/mixin/client/OptionInstanceAccessor.java) | 2 | ||||
-rw-r--r-- | common/src/main/resources/architectury.common.json | 3 | ||||
-rw-r--r-- | common/src/main/resources/assets/yet_another_config_lib/lang/el_gr.json (renamed from src/main/resources/assets/yet-another-config-lib/lang/el_gr.json) | 0 | ||||
-rw-r--r-- | common/src/main/resources/assets/yet_another_config_lib/lang/en_us.json (renamed from src/main/resources/assets/yet-another-config-lib/lang/en_us.json) | 0 | ||||
-rw-r--r-- | common/src/main/resources/assets/yet_another_config_lib/lang/et_ee.json (renamed from src/main/resources/assets/yet-another-config-lib/lang/et_ee.json) | 0 | ||||
-rw-r--r-- | common/src/main/resources/assets/yet_another_config_lib/lang/fr_fr.json (renamed from src/main/resources/assets/yet-another-config-lib/lang/fr_fr.json) | 0 | ||||
-rw-r--r-- | common/src/main/resources/assets/yet_another_config_lib/lang/pl_pl.json (renamed from src/main/resources/assets/yet-another-config-lib/lang/pl_pl.json) | 0 | ||||
-rw-r--r-- | common/src/main/resources/assets/yet_another_config_lib/lang/pt_br.json (renamed from src/main/resources/assets/yet-another-config-lib/lang/pt_br.json) | 0 | ||||
-rw-r--r-- | common/src/main/resources/assets/yet_another_config_lib/lang/ru_ru.json (renamed from src/main/resources/assets/yet-another-config-lib/lang/ru_ru.json) | 0 | ||||
-rw-r--r-- | common/src/main/resources/assets/yet_another_config_lib/lang/sl_si.json (renamed from src/main/resources/assets/yet-another-config-lib/lang/sl_si.json) | 0 | ||||
-rw-r--r-- | common/src/main/resources/assets/yet_another_config_lib/lang/zh_cn.json (renamed from src/main/resources/assets/yet-another-config-lib/lang/zh_cn.json) | 0 | ||||
-rw-r--r-- | common/src/main/resources/assets/yet_another_config_lib/lang/zh_tw.json (renamed from src/main/resources/assets/yet-another-config-lib/lang/zh_tw.json) | 0 | ||||
-rw-r--r-- | common/src/main/resources/yacl-128x.png (renamed from src/main/resources/yacl-128x.png) | bin | 13813 -> 13813 bytes | |||
-rw-r--r-- | common/src/main/resources/yacl.accesswidener (renamed from src/main/resources/yacl.accesswidener) | 4 | ||||
-rw-r--r-- | common/src/main/resources/yacl.mixins.json (renamed from src/client/resources/yet-another-config-lib.client.mixins.json) | 6 | ||||
-rw-r--r-- | fabric/.gitignore | 42 | ||||
-rw-r--r-- | fabric/build.gradle.kts | 158 | ||||
-rw-r--r-- | fabric/src/main/resources/fabric.mod.json (renamed from src/main/resources/fabric.mod.json) | 12 | ||||
-rw-r--r-- | forge/.gitignore | 42 | ||||
-rw-r--r-- | forge/build.gradle.kts | 164 | ||||
-rw-r--r-- | forge/gradle.properties | 1 | ||||
-rw-r--r-- | forge/src/main/java/dev/isxander/yacl/forge/YACLForgeEntrypoint.java | 11 | ||||
-rw-r--r-- | forge/src/main/resources/META-INF/mods.toml | 28 | ||||
-rw-r--r-- | forge/src/main/resources/pack.mcmeta | 6 | ||||
-rw-r--r-- | gradle.properties | 12 | ||||
-rw-r--r-- | gradle/libs.versions.toml | 48 | ||||
-rw-r--r-- | gradle/wrapper/gradle-wrapper.properties | 3 | ||||
-rwxr-xr-x | gradlew | 6 | ||||
-rw-r--r-- | gradlew.bat | 14 | ||||
-rw-r--r-- | settings.gradle.kts | 14 | ||||
-rw-r--r-- | src/testmod/java/dev/isxander/yacl/test/ExampleMod.java | 11 | ||||
-rw-r--r-- | src/testmod/java/dev/isxander/yacl/test/config/GuiTest.java | 449 | ||||
-rw-r--r-- | src/testmod/java/dev/isxander/yacl/test/mixins/TitleScreenMixin.java | 30 | ||||
-rw-r--r-- | src/testmod/resources/fabric.mod.json | 22 | ||||
-rw-r--r-- | src/testmod/resources/yet-another-config-lib.test.mixins.json | 11 | ||||
-rw-r--r-- | test-common/.gitignore | 42 | ||||
-rw-r--r-- | test-common/build.gradle.kts | 24 | ||||
-rw-r--r-- | test-common/src/main/java/dev/isxander/yacl/test/ConfigTest.java (renamed from src/testmod/java/dev/isxander/yacl/test/config/ExampleConfig.java) | 31 | ||||
-rw-r--r-- | test-common/src/main/java/dev/isxander/yacl/test/GuiTest.java | 462 | ||||
-rw-r--r-- | test-fabric/.gitignore | 42 | ||||
-rw-r--r-- | test-fabric/build.gradle.kts | 57 | ||||
-rw-r--r-- | test-fabric/src/main/java/dev/isxander/yacl/test/fabric/ModMenuEntrypoint.java | 12 | ||||
-rw-r--r-- | test-fabric/src/main/resources/fabric.mod.json | 13 | ||||
-rw-r--r-- | test-forge/.gitignore | 42 | ||||
-rw-r--r-- | test-forge/build.gradle.kts | 63 | ||||
-rw-r--r-- | test-forge/gradle.properties | 1 | ||||
-rw-r--r-- | test-forge/src/main/java/dev/isxander/yacl/test/forge/ForgeTest.java | 18 | ||||
-rw-r--r-- | test-forge/src/main/resources/META-INF/mods.toml | 28 | ||||
-rw-r--r-- | test-forge/src/main/resources/pack.mcmeta | 6 |
127 files changed, 1630 insertions, 849 deletions
diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index b05f565..3786124 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -3,7 +3,7 @@ name: Gradle CI on: push: branches: - - '*' + - '**' paths-ignore: - 'README.md' - 'LICENSE' @@ -12,7 +12,7 @@ on: - 'changelogs/**' pull_request: branches: - - '*' + - '**' paths-ignore: - 'README.md' - 'LICENSE' @@ -47,4 +47,10 @@ jobs: run: ./gradlew build --no-daemon - uses: actions/upload-artifact@v3 with: - path: build/libs/*.jar + path: | + **/build/libs/ + !build/libs/ + !**/*-dev.jar + !**/*-shadow.jar + !**/*-transformProduction*.jar + !**/test*/ @@ -3,3 +3,4 @@ build /.idea .gradle !.gitkeep +/.architectury-transformer diff --git a/build.gradle.kts b/build.gradle.kts index dde9614..0daff2c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,221 +1,109 @@ plugins { - java + alias(libs.plugins.architectury.plugin) + alias(libs.plugins.architectury.loom) apply false - id("fabric-loom") version "1.1.+" // 1.0.+ but patch must be 16 or higher - id("io.github.juuxel.loom-quiltflower") version "1.8.+" - - id("com.modrinth.minotaur") version "2.6.+" - id("me.hypherionmc.cursegradle") version "2.+" - id("com.github.breadmoirai.github-release") version "2.+" - `maven-publish` - - id("io.github.p03w.machete") version "1.+" - id("org.ajoberstar.grgit") version "5.0.0" + alias(libs.plugins.unified.publishing) apply false + alias(libs.plugins.github.release) + alias(libs.plugins.grgit) } -val ciRun = System.getenv().containsKey("GITHUB_ACTIONS") - -group = "dev.isxander" -version = "2.4.2" - -if (ciRun) - version = "$version+${grgit.branch.current().name.replace('/', '.')}-SNAPSHOT" - -loom { - splitEnvironmentSourceSets() - - mods { - register("yet-another-config-lib") { - sourceSet(sourceSets["main"]) - sourceSet(sourceSets["client"]) - } - } +architectury { + minecraft = libs.versions.minecraft.get() } -val testmod by sourceSets.registering { - compileClasspath += sourceSets.main.get().compileClasspath - runtimeClasspath += sourceSets.main.get().runtimeClasspath - compileClasspath += sourceSets["client"].compileClasspath - runtimeClasspath += sourceSets["client"].runtimeClasspath -} +val changelogText = file("changelogs/${project.version}.md").takeIf { it.exists() }?.readText() ?: "No changelog provided." +val snapshotVer = "${grgit.branch.current().name.replace('/', '.')}-SNAPSHOT" -loom { - accessWidenerPath.set(file("src/main/resources/yacl.accesswidener")) +allprojects { + apply(plugin = "java") + apply(plugin = "maven-publish") + apply(plugin = "architectury-plugin") - runs { - register("testmod") { - client() - ideConfigGenerated(true) - name("Test Mod") - source(testmod.get()) - } + version = "2.5.0+1.19.4" + group = "dev.isxander" - named("client") { ideConfigGenerated(false) } - named("server") { ideConfigGenerated(false) } + if (System.getenv().containsKey("GITHUB_ACTIONS")) { + version = "$version+$snapshotVer" } - createRemapConfigurations(testmod.get()) -} + pluginManager.withPlugin("base") { + val base = the<BasePluginExtension>() -repositories { - mavenCentral() - maven("https://maven.terraformersmc.com") - maven("https://maven.quiltmc.org/repository/release") -} - -val minecraftVersion: String by project -val fabricLoaderVersion: String by project -val qmBuild: String by project - -dependencies { - minecraft("com.mojang:minecraft:$minecraftVersion") - mappings(loom.layered { - mappings("org.quiltmc:quilt-mappings:$minecraftVersion+build.$qmBuild:intermediary-v2") - officialMojangMappings() - }) - modImplementation("net.fabricmc:fabric-loader:$fabricLoaderVersion") - - "modClientImplementation"(fabricApi.module("fabric-resource-loader-v0", "0.76.0+1.19.4")) - - "testmodImplementation"(sourceSets.main.get().output) - "testmodImplementation"(sourceSets["client"].output) -} - -java { - withSourcesJar() - withJavadocJar() -} - -tasks { - processResources { - val modId: String by project - val modName: String by project - val modDescription: String by project - val githubProject: String by project - - inputs.property("id", modId) - inputs.property("group", project.group) - inputs.property("name", modName) - inputs.property("description", modDescription) - inputs.property("version", project.version) - inputs.property("github", githubProject) - - filesMatching(listOf("fabric.mod.json", "quilt.mod.json")) { - expand( - "id" to modId, - "group" to project.group, - "name" to modName, - "description" to modDescription, - "version" to project.version, - "github" to githubProject, - ) - } + base.archivesName.set("yet-another-config-lib-${project.name}") } - register("releaseMod") { - group = "mod" + ext["changelogText"] = changelogText - dependsOn("modrinth") - dependsOn("modrinthSyncBody") - dependsOn("curseforge") - dependsOn("publishModPublicationToReleasesRepository") - dependsOn("githubRelease") - } -} - -val changelogText = file("changelogs/${project.version}.md").takeIf { it.exists() }?.readText() ?: "No changelog provided." - -val modrinthId: String by project -if (modrinthId.isNotEmpty()) { - modrinth { - token.set(findProperty("MODRINTH_TOKEN")?.toString()) - projectId.set(modrinthId) - versionNumber.set("${project.version}") - versionType.set("release") - uploadFile.set(tasks["remapJar"]) - gameVersions.set(listOf("1.19.4")) - loaders.set(listOf("fabric", "quilt")) - dependencies { - required.project("fabric-api") + repositories { + mavenCentral() + maven("https://maven.terraformersmc.com/releases") + maven("https://maven.isxander.dev/releases") + maven("https://maven.isxander.dev/snapshots") + maven("https://maven.quiltmc.org/repository/release") + maven("https://api.modrinth.com/maven") { + name = "Modrinth" + content { + includeGroup("maven.modrinth") + } } - changelog.set(changelogText) - syncBodyFrom.set(file("README.md").readText()) + maven("https://jitpack.io") } -} -val curseforgeId: String by project -if (hasProperty("CURSEFORGE_TOKEN") && curseforgeId.isNotEmpty()) { - curseforge { - apiKey = findProperty("CURSEFORGE_TOKEN") - project(closureOf<me.hypherionmc.cursegradle.CurseProject> { - mainArtifact(tasks["remapJar"], closureOf<me.hypherionmc.cursegradle.CurseArtifact> { - displayName = "${project.version}" - }) - - id = curseforgeId - releaseType = "release" - addGameVersion("1.19.4") - addGameVersion("Fabric") - addGameVersion("Java 17") - - changelog = changelogText - changelogType = "markdown" - - relations(closureOf<me.hypherionmc.cursegradle.CurseRelation> { - requiredDependency("fabric-api") - }) - }) - - options(closureOf<me.hypherionmc.cursegradle.Options> { - forgeGradleIntegration = false - }) + pluginManager.withPlugin("publishing") { + val publishing = the<PublishingExtension>() + + publishing.repositories { + val username = "XANDER_MAVEN_USER".let { System.getenv(it) ?: findProperty(it) }?.toString() + val password = "XANDER_MAVEN_PASS".let { System.getenv(it) ?: findProperty(it) }?.toString() + if (username != null && password != null) { + maven(url = "https://maven.isxander.dev/releases") { + name = "Releases" + credentials { + this.username = username + this.password = password + } + } + maven(url = "https://maven.isxander.dev/snapshots") { + name = "Snapshots" + credentials { + this.username = username + this.password = password + } + } + } else { + println("Xander Maven credentials not satisfied.") + } + } } } githubRelease { token(findProperty("GITHUB_TOKEN")?.toString()) - val githubProject: String by project + val githubProject: String by rootProject val split = githubProject.split("/") owner(split[0]) repo(split[1]) tagName("${project.version}") targetCommitish(grgit.branch.current().name) body(changelogText) - releaseAssets(tasks["remapJar"].outputs.files) + releaseAssets( + { project(":fabric").tasks["remapJar"].outputs.files }, + { project(":fabric").tasks["remapSourcesJar"].outputs.files }, + { project(":forge").tasks["remapJar"].outputs.files }, + { project(":forge").tasks["remapSourcesJar"].outputs.files }, + ) } -publishing { - publications { - create<MavenPublication>("mod") { - groupId = "dev.isxander" - artifactId = "yet-another-config-lib" +tasks.register("releaseMod") { + group = "mod" - from(components["java"]) - artifact(tasks["remapSourcesJar"]) - } - } + dependsOn("githubRelease") +} - repositories { - val username = "XANDER_MAVEN_USER".let { System.getenv(it) ?: findProperty(it) }?.toString() - val password = "XANDER_MAVEN_PASS".let { System.getenv(it) ?: findProperty(it) }?.toString() - if (username != null && password != null) { - maven(url = "https://maven.isxander.dev/releases") { - name = "Releases" - credentials { - this.username = username - this.password = password - } - } - maven(url = "https://maven.isxander.dev/snapshots") { - name = "Snapshots" - credentials { - this.username = username - this.password = password - } - } - } else { - println("Xander Maven credentials not satisfied.") - } - } +tasks.register("buildAll") { + group = "mod" + + dependsOn(project(":fabric").tasks["build"]) + dependsOn(project(":forge").tasks["build"]) } diff --git a/common/.gitignore b/common/.gitignore new file mode 100644 index 0000000..b63da45 --- /dev/null +++ b/common/.gitignore @@ -0,0 +1,42 @@ +.gradle +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store
\ No newline at end of file diff --git a/common/build.gradle.kts b/common/build.gradle.kts new file mode 100644 index 0000000..fb79bd1 --- /dev/null +++ b/common/build.gradle.kts @@ -0,0 +1,52 @@ +plugins { + alias(libs.plugins.architectury.loom) +} + +base { + archivesName.set("yet-another-config-lib") +} + +architectury { + common("fabric", "forge") +} + +loom { + silentMojangMappingsLicense() + + accessWidenerPath.set(file("src/main/resources/yacl.accesswidener")) +} + +dependencies { + minecraft(libs.minecraft) + mappings(loom.layered { + mappings("org.quiltmc:quilt-mappings:${libs.versions.minecraft.get()}+build.${libs.versions.quilt.mappings.get()}:intermediary-v2") + officialMojangMappings() + }) + modImplementation(libs.fabric.loader) +} + +java { + withSourcesJar() +} + +tasks { + remapJar { + archiveClassifier.set(null as String?) + + from(rootProject.file("LICENSE")) + } +} + +publishing { + publications { + create<MavenPublication>("common") { + groupId = "dev.isxander.yacl" + artifactId = "yet-another-config-lib-common" + + from(components["java"]) + } + } +} +tasks.findByPath("publishCommonPublicationToReleasesRepository")?.let { + rootProject.tasks["releaseMod"].dependsOn(it) +} diff --git a/src/client/java/dev/isxander/yacl/api/Binding.java b/common/src/main/java/dev/isxander/yacl/api/Binding.java index ba5a2c0..b4cd2d0 100644 --- a/src/client/java/dev/isxander/yacl/api/Binding.java +++ b/common/src/main/java/dev/isxander/yacl/api/Binding.java @@ -1,7 +1,7 @@ package dev.isxander.yacl.api; import dev.isxander.yacl.impl.GenericBindingImpl; -import dev.isxander.yacl.mixin.client.OptionInstanceAccessor; +import dev.isxander.yacl.mixin.OptionInstanceAccessor; import net.minecraft.client.OptionInstance; import org.apache.commons.lang3.Validate; diff --git a/src/client/java/dev/isxander/yacl/api/ButtonOption.java b/common/src/main/java/dev/isxander/yacl/api/ButtonOption.java index 88e1c4b..88e1c4b 100644 --- a/src/client/java/dev/isxander/yacl/api/ButtonOption.java +++ b/common/src/main/java/dev/isxander/yacl/api/ButtonOption.java diff --git a/src/client/java/dev/isxander/yacl/api/ConfigCategory.java b/common/src/main/java/dev/isxander/yacl/api/ConfigCategory.java index 7764479..7764479 100644 --- a/src/client/java/dev/isxander/yacl/api/ConfigCategory.java +++ b/common/src/main/java/dev/isxander/yacl/api/ConfigCategory.java diff --git a/src/client/java/dev/isxander/yacl/api/Controller.java b/common/src/main/java/dev/isxander/yacl/api/Controller.java index 0b8e2ed..0b8e2ed 100644 --- a/src/client/java/dev/isxander/yacl/api/Controller.java +++ b/common/src/main/java/dev/isxander/yacl/api/Controller.java diff --git a/src/client/java/dev/isxander/yacl/api/LabelOption.java b/common/src/main/java/dev/isxander/yacl/api/LabelOption.java index 05c7214..05c7214 100644 --- a/src/client/java/dev/isxander/yacl/api/LabelOption.java +++ b/common/src/main/java/dev/isxander/yacl/api/LabelOption.java diff --git a/src/client/java/dev/isxander/yacl/api/ListOption.java b/common/src/main/java/dev/isxander/yacl/api/ListOption.java index afba8ee..afba8ee 100644 --- a/src/client/java/dev/isxander/yacl/api/ListOption.java +++ b/common/src/main/java/dev/isxander/yacl/api/ListOption.java diff --git a/src/client/java/dev/isxander/yacl/api/ListOptionEntry.java b/common/src/main/java/dev/isxander/yacl/api/ListOptionEntry.java index e0a3424..e0a3424 100644 --- a/src/client/java/dev/isxander/yacl/api/ListOptionEntry.java +++ b/common/src/main/java/dev/isxander/yacl/api/ListOptionEntry.java diff --git a/src/client/java/dev/isxander/yacl/api/NameableEnum.java b/common/src/main/java/dev/isxander/yacl/api/NameableEnum.java index 4b04057..4b04057 100644 --- a/src/client/java/dev/isxander/yacl/api/NameableEnum.java +++ b/common/src/main/java/dev/isxander/yacl/api/NameableEnum.java diff --git a/src/client/java/dev/isxander/yacl/api/Option.java b/common/src/main/java/dev/isxander/yacl/api/Option.java index a6c0311..a6c0311 100644 --- a/src/client/java/dev/isxander/yacl/api/Option.java +++ b/common/src/main/java/dev/isxander/yacl/api/Option.java diff --git a/src/client/java/dev/isxander/yacl/api/OptionAddable.java b/common/src/main/java/dev/isxander/yacl/api/OptionAddable.java index 57be06c..57be06c 100644 --- a/src/client/java/dev/isxander/yacl/api/OptionAddable.java +++ b/common/src/main/java/dev/isxander/yacl/api/OptionAddable.java diff --git a/src/client/java/dev/isxander/yacl/api/OptionFlag.java b/common/src/main/java/dev/isxander/yacl/api/OptionFlag.java index 51d57e4..51d57e4 100644 --- a/src/client/java/dev/isxander/yacl/api/OptionFlag.java +++ b/common/src/main/java/dev/isxander/yacl/api/OptionFlag.java diff --git a/src/client/java/dev/isxander/yacl/api/OptionGroup.java b/common/src/main/java/dev/isxander/yacl/api/OptionGroup.java index 4fe43c7..4fe43c7 100644 --- a/src/client/java/dev/isxander/yacl/api/OptionGroup.java +++ b/common/src/main/java/dev/isxander/yacl/api/OptionGroup.java diff --git a/src/client/java/dev/isxander/yacl/api/PlaceholderCategory.java b/common/src/main/java/dev/isxander/yacl/api/PlaceholderCategory.java index 3641fad..3641fad 100644 --- a/src/client/java/dev/isxander/yacl/api/PlaceholderCategory.java +++ b/common/src/main/java/dev/isxander/yacl/api/PlaceholderCategory.java diff --git a/src/client/java/dev/isxander/yacl/api/YetAnotherConfigLib.java b/common/src/main/java/dev/isxander/yacl/api/YetAnotherConfigLib.java index c6da1d1..c6da1d1 100644 --- a/src/client/java/dev/isxander/yacl/api/YetAnotherConfigLib.java +++ b/common/src/main/java/dev/isxander/yacl/api/YetAnotherConfigLib.java diff --git a/src/main/java/dev/isxander/yacl/api/utils/Dimension.java b/common/src/main/java/dev/isxander/yacl/api/utils/Dimension.java index 0de0a58..0de0a58 100644 --- a/src/main/java/dev/isxander/yacl/api/utils/Dimension.java +++ b/common/src/main/java/dev/isxander/yacl/api/utils/Dimension.java diff --git a/src/main/java/dev/isxander/yacl/api/utils/MutableDimension.java b/common/src/main/java/dev/isxander/yacl/api/utils/MutableDimension.java index eff0186..eff0186 100644 --- a/src/main/java/dev/isxander/yacl/api/utils/MutableDimension.java +++ b/common/src/main/java/dev/isxander/yacl/api/utils/MutableDimension.java diff --git a/src/client/java/dev/isxander/yacl/api/utils/OptionUtils.java b/common/src/main/java/dev/isxander/yacl/api/utils/OptionUtils.java index 22032bd..22032bd 100644 --- a/src/client/java/dev/isxander/yacl/api/utils/OptionUtils.java +++ b/common/src/main/java/dev/isxander/yacl/api/utils/OptionUtils.java diff --git a/src/main/java/dev/isxander/yacl/config/ConfigEntry.java b/common/src/main/java/dev/isxander/yacl/config/ConfigEntry.java index 7f04c33..7f04c33 100644 --- a/src/main/java/dev/isxander/yacl/config/ConfigEntry.java +++ b/common/src/main/java/dev/isxander/yacl/config/ConfigEntry.java diff --git a/src/main/java/dev/isxander/yacl/config/ConfigInstance.java b/common/src/main/java/dev/isxander/yacl/config/ConfigInstance.java index c207161..c207161 100644 --- a/src/main/java/dev/isxander/yacl/config/ConfigInstance.java +++ b/common/src/main/java/dev/isxander/yacl/config/ConfigInstance.java diff --git a/src/main/java/dev/isxander/yacl/config/GsonConfigInstance.java b/common/src/main/java/dev/isxander/yacl/config/GsonConfigInstance.java index ad7f550..ad7f550 100644 --- a/src/main/java/dev/isxander/yacl/config/GsonConfigInstance.java +++ b/common/src/main/java/dev/isxander/yacl/config/GsonConfigInstance.java diff --git a/src/client/java/dev/isxander/yacl/gui/AbstractWidget.java b/common/src/main/java/dev/isxander/yacl/gui/AbstractWidget.java index c6d2b09..ae3c83b 100644 --- a/src/client/java/dev/isxander/yacl/gui/AbstractWidget.java +++ b/common/src/main/java/dev/isxander/yacl/gui/AbstractWidget.java @@ -14,7 +14,7 @@ import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.resources.sounds.SimpleSoundInstance; import net.minecraft.sounds.SoundEvents; -import java.awt.Color; +import java.awt.*; public abstract class AbstractWidget implements GuiEventListener, Renderable, NarratableEntry { protected final Minecraft client = Minecraft.getInstance(); diff --git a/src/client/java/dev/isxander/yacl/gui/CategoryListWidget.java b/common/src/main/java/dev/isxander/yacl/gui/CategoryListWidget.java index 41286ff..41286ff 100644 --- a/src/client/java/dev/isxander/yacl/gui/CategoryListWidget.java +++ b/common/src/main/java/dev/isxander/yacl/gui/CategoryListWidget.java diff --git a/src/client/java/dev/isxander/yacl/gui/CategoryWidget.java b/common/src/main/java/dev/isxander/yacl/gui/CategoryWidget.java index 60817a2..60817a2 100644 --- a/src/client/java/dev/isxander/yacl/gui/CategoryWidget.java +++ b/common/src/main/java/dev/isxander/yacl/gui/CategoryWidget.java diff --git a/src/client/java/dev/isxander/yacl/gui/ElementListWidgetExt.java b/common/src/main/java/dev/isxander/yacl/gui/ElementListWidgetExt.java index 46503a6..b177236 100644 --- a/src/client/java/dev/isxander/yacl/gui/ElementListWidgetExt.java +++ b/common/src/main/java/dev/isxander/yacl/gui/ElementListWidgetExt.java @@ -8,8 +8,6 @@ import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.util.Mth; import org.jetbrains.annotations.Nullable; -import java.util.Iterator; - public class ElementListWidgetExt<E extends ElementListWidgetExt.Entry<E>> extends ContainerObjectSelectionList<E> { protected final int x, y; @@ -143,7 +141,7 @@ public class ElementListWidgetExt<E extends ElementListWidgetExt.Entry<E>> exten /* END cloth config code */ - public abstract static class Entry<E extends ElementListWidgetExt.Entry<E>> extends ContainerObjectSelectionList.Entry<E> { + public abstract static class Entry<E extends Entry<E>> extends ContainerObjectSelectionList.Entry<E> { @Override public boolean mouseClicked(double mouseX, double mouseY, int button) { for (GuiEventListener child : this.children()) { diff --git a/src/client/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java b/common/src/main/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java index 7e17aac..e8bf59f 100644 --- a/src/client/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java +++ b/common/src/main/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java @@ -5,7 +5,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.Tooltip; import net.minecraft.network.chat.Component; -import net.minecraft.util.Mth; public class LowProfileButtonWidget extends Button { public LowProfileButtonWidget(int x, int y, int width, int height, Component message, OnPress onPress) { diff --git a/src/client/java/dev/isxander/yacl/gui/OptionListWidget.java b/common/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java index 8f96ddf..a73ce43 100644 --- a/src/client/java/dev/isxander/yacl/gui/OptionListWidget.java +++ b/common/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java @@ -17,13 +17,15 @@ import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; import org.jetbrains.annotations.Nullable; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entry> { private final YACLScreen yaclScreen; private boolean singleCategory = false; - private ImmutableList<dev.isxander.yacl.gui.OptionListWidget.Entry> viewableChildren; + private ImmutableList<Entry> viewableChildren; public OptionListWidget(YACLScreen screen, Minecraft client, int width, int height) { super(client, width / 3, 0, width / 3 * 2 + 1, height, true); @@ -64,7 +66,7 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr groupSeparatorEntry = null; } - List<dev.isxander.yacl.gui.OptionListWidget.Entry> optionEntries = new ArrayList<>(); + List<Entry> optionEntries = new ArrayList<>(); // add empty entry to make sure users know it's empty not just bugging out if (groupSeparatorEntry instanceof ListGroupSeparatorEntry listGroupSeparatorEntry) { @@ -101,7 +103,7 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr return; } - for (dev.isxander.yacl.gui.OptionListWidget.Entry entry : groupSeparator.childEntries) + for (Entry entry : groupSeparator.childEntries) super.removeEntry(entry); groupSeparator.childEntries.clear(); @@ -113,7 +115,7 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr return; } - dev.isxander.yacl.gui.OptionListWidget.Entry lastEntry = groupSeparator; + Entry lastEntry = groupSeparator; for (ListOptionEntry<?> listOptionEntry : listOption.options()) { OptionEntry optionEntry = new OptionEntry(listOptionEntry, category, listOption, groupSeparator, listOptionEntry.controller().provideWidget(yaclScreen, getDefaultEntryDimension())); addEntryBelow(lastEntry, optionEntry); @@ -127,7 +129,7 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr } public void expandAllGroups() { - for (dev.isxander.yacl.gui.OptionListWidget.Entry entry : super.children()) { + for (Entry entry : super.children()) { if (entry instanceof GroupSeparatorEntry groupSeparatorEntry) { groupSeparatorEntry.setExpanded(true); } @@ -141,7 +143,7 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr @Override public boolean mouseClicked(double mouseX, double mouseY, int button) { - for (dev.isxander.yacl.gui.OptionListWidget.Entry child : children()) { + for (Entry child : children()) { if (child != getEntryAtPosition(mouseX, mouseY) && child instanceof OptionEntry optionEntry) optionEntry.widget.unfocus(); } @@ -153,7 +155,7 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr public boolean mouseScrolled(double mouseX, double mouseY, double amount) { super.mouseScrolled(mouseX, mouseY, amount); - for (dev.isxander.yacl.gui.OptionListWidget.Entry child : children()) { + for (Entry child : children()) { if (child.mouseScrolled(mouseX, mouseY, amount)) break; } @@ -163,7 +165,7 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr @Override public boolean keyPressed(int keyCode, int scanCode, int modifiers) { - for (dev.isxander.yacl.gui.OptionListWidget.Entry child : children()) { + for (Entry child : children()) { if (child.keyPressed(keyCode, scanCode, modifiers)) return true; } @@ -173,7 +175,7 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr @Override public boolean charTyped(char chr, int modifiers) { - for (dev.isxander.yacl.gui.OptionListWidget.Entry child : children()) { + for (Entry child : children()) { if (child.charTyped(chr, modifiers)) return true; } @@ -187,11 +189,11 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr } public void recacheViewableChildren() { - this.viewableChildren = ImmutableList.copyOf(super.children().stream().filter(dev.isxander.yacl.gui.OptionListWidget.Entry::isViewable).toList()); + this.viewableChildren = ImmutableList.copyOf(super.children().stream().filter(Entry::isViewable).toList()); // update y positions before they need to be rendered are rendered int i = 0; - for (dev.isxander.yacl.gui.OptionListWidget.Entry entry : viewableChildren) { + for (Entry entry : viewableChildren) { if (entry instanceof OptionEntry optionEntry) optionEntry.widget.setDimension(optionEntry.widget.getDimension().withY(getRowTop(i))); i++; @@ -440,7 +442,7 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr public List<? extends NarratableEntry> narratables() { return ImmutableList.of(new NarratableEntry() { @Override - public NarratableEntry.NarrationPriority narrationPriority() { + public NarrationPriority narrationPriority() { return NarrationPriority.HOVERED; } diff --git a/src/client/java/dev/isxander/yacl/gui/RequireRestartScreen.java b/common/src/main/java/dev/isxander/yacl/gui/RequireRestartScreen.java index 18b6033..18b6033 100644 --- a/src/client/java/dev/isxander/yacl/gui/RequireRestartScreen.java +++ b/common/src/main/java/dev/isxander/yacl/gui/RequireRestartScreen.java diff --git a/src/client/java/dev/isxander/yacl/gui/SearchFieldWidget.java b/common/src/main/java/dev/isxander/yacl/gui/SearchFieldWidget.java index 5cf38e0..5cf38e0 100644 --- a/src/client/java/dev/isxander/yacl/gui/SearchFieldWidget.java +++ b/common/src/main/java/dev/isxander/yacl/gui/SearchFieldWidget.java diff --git a/src/client/java/dev/isxander/yacl/gui/TextScaledButtonWidget.java b/common/src/main/java/dev/isxander/yacl/gui/TextScaledButtonWidget.java index b955912..b955912 100644 --- a/src/client/java/dev/isxander/yacl/gui/TextScaledButtonWidget.java +++ b/common/src/main/java/dev/isxander/yacl/gui/TextScaledButtonWidget.java diff --git a/src/client/java/dev/isxander/yacl/gui/TooltipButtonWidget.java b/common/src/main/java/dev/isxander/yacl/gui/TooltipButtonWidget.java index 1395a3f..3b5b6fc 100644 --- a/src/client/java/dev/isxander/yacl/gui/TooltipButtonWidget.java +++ b/common/src/main/java/dev/isxander/yacl/gui/TooltipButtonWidget.java @@ -2,7 +2,6 @@ package dev.isxander.yacl.gui; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.MultiLineLabel; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; @@ -12,13 +11,13 @@ public class TooltipButtonWidget extends TextScaledButtonWidget { protected final Screen screen; protected MultiLineLabel wrappedDescription; - public TooltipButtonWidget(Screen screen, int x, int y, int width, int height, Component message, float textScale, Component tooltip, Button.OnPress onPress) { + public TooltipButtonWidget(Screen screen, int x, int y, int width, int height, Component message, float textScale, Component tooltip, OnPress onPress) { super(x, y, width, height, textScale, message, onPress); this.screen = screen; setTooltip(tooltip); } - public TooltipButtonWidget(Screen screen, int x, int y, int width, int height, Component message, Component tooltip, Button.OnPress onPress) { + public TooltipButtonWidget(Screen screen, int x, int y, int width, int height, Component message, Component tooltip, OnPress onPress) { this(screen, x, y, width, height, message, 1, tooltip, onPress); } diff --git a/src/client/java/dev/isxander/yacl/gui/YACLScreen.java b/common/src/main/java/dev/isxander/yacl/gui/YACLScreen.java index d653d8c..3600e61 100644 --- a/src/client/java/dev/isxander/yacl/gui/YACLScreen.java +++ b/common/src/main/java/dev/isxander/yacl/gui/YACLScreen.java @@ -2,7 +2,10 @@ package dev.isxander.yacl.gui; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.*; -import dev.isxander.yacl.api.*; +import dev.isxander.yacl.api.Option; +import dev.isxander.yacl.api.OptionFlag; +import dev.isxander.yacl.api.PlaceholderCategory; +import dev.isxander.yacl.api.YetAnotherConfigLib; import dev.isxander.yacl.api.utils.Dimension; import dev.isxander.yacl.api.utils.MutableDimension; import dev.isxander.yacl.api.utils.OptionUtils; diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/ActionController.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/ActionController.java index e57cdd2..e57cdd2 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/ActionController.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/ActionController.java diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/BooleanController.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/BooleanController.java index d7d17d5..d7d17d5 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/BooleanController.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/BooleanController.java diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/ColorController.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/ColorController.java index 473407b..3cbce40 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/ColorController.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/ColorController.java @@ -14,7 +14,7 @@ import net.minecraft.client.gui.GuiComponent; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; -import java.awt.Color; +import java.awt.*; import java.util.List; /** diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/ControllerWidget.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/ControllerWidget.java index 22c469d..22c469d 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/ControllerWidget.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/ControllerWidget.java diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/LabelController.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/LabelController.java index 1dfae0b..1dfae0b 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/LabelController.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/LabelController.java diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/ListEntryWidget.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/ListEntryWidget.java index 1acccf1..c3f674d 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/ListEntryWidget.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/ListEntryWidget.java @@ -5,7 +5,9 @@ import com.mojang.blaze3d.vertex.PoseStack; import dev.isxander.yacl.api.ListOption; import dev.isxander.yacl.api.ListOptionEntry; import dev.isxander.yacl.api.utils.Dimension; -import dev.isxander.yacl.gui.*; +import dev.isxander.yacl.gui.AbstractWidget; +import dev.isxander.yacl.gui.TooltipButtonWidget; +import dev.isxander.yacl.gui.YACLScreen; import net.minecraft.client.gui.components.events.ContainerEventHandler; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.narration.NarrationElementOutput; diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/TickBoxController.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/TickBoxController.java index 3f615db..3f615db 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/TickBoxController.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/TickBoxController.java diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/cycling/CyclingControllerElement.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/cycling/CyclingControllerElement.java index ff20039..ff20039 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/cycling/CyclingControllerElement.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/cycling/CyclingControllerElement.java diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/cycling/CyclingListController.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/cycling/CyclingListController.java index 34f2cc9..34f2cc9 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/cycling/CyclingListController.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/cycling/CyclingListController.java diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/cycling/EnumController.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/cycling/EnumController.java index ebd2cb6..ebd2cb6 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/cycling/EnumController.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/cycling/EnumController.java diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/cycling/ICyclingController.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/cycling/ICyclingController.java index 081b572..081b572 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/cycling/ICyclingController.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/cycling/ICyclingController.java diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/package-info.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/package-info.java index 12ce86b..12ce86b 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/package-info.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/package-info.java diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/slider/DoubleSliderController.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/slider/DoubleSliderController.java index 8e044b1..8e044b1 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/slider/DoubleSliderController.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/slider/DoubleSliderController.java diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/slider/FloatSliderController.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/slider/FloatSliderController.java index 25f2206..25f2206 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/slider/FloatSliderController.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/slider/FloatSliderController.java diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/slider/ISliderController.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/slider/ISliderController.java index aa3c18f..aa3c18f 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/slider/ISliderController.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/slider/ISliderController.java diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/slider/IntegerSliderController.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/slider/IntegerSliderController.java index 4a68497..4a68497 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/slider/IntegerSliderController.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/slider/IntegerSliderController.java diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/slider/LongSliderController.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/slider/LongSliderController.java index 681e7cf..681e7cf 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/slider/LongSliderController.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/slider/LongSliderController.java diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/slider/SliderControllerElement.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/slider/SliderControllerElement.java index d00f3d7..d00f3d7 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/slider/SliderControllerElement.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/slider/SliderControllerElement.java diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/slider/package-info.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/slider/package-info.java index bff0d57..bff0d57 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/slider/package-info.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/slider/package-info.java diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/string/IStringController.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/string/IStringController.java index 6a603d2..6a603d2 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/string/IStringController.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/string/IStringController.java diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/string/StringController.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/string/StringController.java index 3a07641..85029b9 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/string/StringController.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/string/StringController.java @@ -1,9 +1,6 @@ package dev.isxander.yacl.gui.controllers.string; import dev.isxander.yacl.api.Option; -import dev.isxander.yacl.api.utils.Dimension; -import dev.isxander.yacl.gui.AbstractWidget; -import dev.isxander.yacl.gui.YACLScreen; /** * A custom text field implementation for strings. diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/string/StringControllerElement.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/string/StringControllerElement.java index cb2ad4e..cb2ad4e 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/string/StringControllerElement.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/string/StringControllerElement.java diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/string/number/DoubleFieldController.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/string/number/DoubleFieldController.java index df28241..df28241 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/string/number/DoubleFieldController.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/string/number/DoubleFieldController.java diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/string/number/FloatFieldController.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/string/number/FloatFieldController.java index 957100a..08084e6 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/string/number/FloatFieldController.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/string/number/FloatFieldController.java @@ -13,7 +13,7 @@ public class FloatFieldController extends NumberFieldController<Float> { private final float min, max; /** - * Constructs a double field controller + * Constructs a float field controller * * @param option option to bind controller to * @param min minimum allowed value (clamped on apply) @@ -27,7 +27,7 @@ public class FloatFieldController extends NumberFieldController<Float> { } /** - * Constructs a double field controller. + * Constructs a float field controller. * Uses {@link FloatSliderController#DEFAULT_FORMATTER} as display text, * not used whilst editing. * @@ -40,7 +40,7 @@ public class FloatFieldController extends NumberFieldController<Float> { } /** - * Constructs a double field controller. + * Constructs a float field controller. * Does not have a minimum or a maximum range. * * @param option option to bind controller to @@ -51,7 +51,7 @@ public class FloatFieldController extends NumberFieldController<Float> { } /** - * Constructs a double field controller. + * Constructs a float field controller. * Uses {@link FloatSliderController#DEFAULT_FORMATTER} as display text, * not used whilst editing. * Does not have a minimum or a maximum range. diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/string/number/IntegerFieldController.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/string/number/IntegerFieldController.java index 2d64a3a..726a590 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/string/number/IntegerFieldController.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/string/number/IntegerFieldController.java @@ -13,7 +13,7 @@ public class IntegerFieldController extends NumberFieldController<Integer> { private final int min, max; /** - * Constructs a double field controller + * Constructs a integer field controller * * @param option option to bind controller to * @param min minimum allowed value (clamped on apply) @@ -27,7 +27,7 @@ public class IntegerFieldController extends NumberFieldController<Integer> { } /** - * Constructs a double field controller. + * Constructs a integer field controller. * Uses {@link IntegerSliderController#DEFAULT_FORMATTER} as display text, * not used whilst editing. * @@ -40,7 +40,7 @@ public class IntegerFieldController extends NumberFieldController<Integer> { } /** - * Constructs a double field controller. + * Constructs a integer field controller. * Does not have a minimum or a maximum range. * * @param option option to bind controller to @@ -51,7 +51,7 @@ public class IntegerFieldController extends NumberFieldController<Integer> { } /** - * Constructs a double field controller. + * Constructs a integer field controller. * Uses {@link IntegerSliderController#DEFAULT_FORMATTER} as display text, * not used whilst editing. * Does not have a minimum or a maximum range. diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/string/number/LongFieldController.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/string/number/LongFieldController.java index a640621..d0c60b4 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/string/number/LongFieldController.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/string/number/LongFieldController.java @@ -13,7 +13,7 @@ public class LongFieldController extends NumberFieldController<Long> { private final long min, max; /** - * Constructs a double field controller + * Constructs a long field controller * * @param option option to bind controller to * @param min minimum allowed value (clamped on apply) @@ -27,7 +27,7 @@ public class LongFieldController extends NumberFieldController<Long> { } /** - * Constructs a double field controller. + * Constructs a long field controller. * Uses {@link LongSliderController#DEFAULT_FORMATTER} as display text, * not used whilst editing. * @@ -40,7 +40,7 @@ public class LongFieldController extends NumberFieldController<Long> { } /** - * Constructs a double field controller. + * Constructs a long field controller. * Does not have a minimum or a maximum range. * * @param option option to bind controller to @@ -51,7 +51,7 @@ public class LongFieldController extends NumberFieldController<Long> { } /** - * Constructs a double field controller. + * Constructs a long field controller. * Uses {@link LongSliderController#DEFAULT_FORMATTER} as display text, * not used whilst editing. * Does not have a minimum or a maximum range. diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/string/number/NumberFieldController.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/string/number/NumberFieldController.java index 4240849..4240849 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/string/number/NumberFieldController.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/string/number/NumberFieldController.java diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/string/number/package-info.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/string/number/package-info.java index 86b9314..86b9314 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/string/number/package-info.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/string/number/package-info.java diff --git a/src/client/java/dev/isxander/yacl/gui/utils/GuiUtils.java b/common/src/main/java/dev/isxander/yacl/gui/utils/GuiUtils.java index aa8bbaa..aa8bbaa 100644 --- a/src/client/java/dev/isxander/yacl/gui/utils/GuiUtils.java +++ b/common/src/main/java/dev/isxander/yacl/gui/utils/GuiUtils.java diff --git a/src/client/java/dev/isxander/yacl/impl/ButtonOptionImpl.java b/common/src/main/java/dev/isxander/yacl/impl/ButtonOptionImpl.java index 33cb474..11da99e 100644 --- a/src/client/java/dev/isxander/yacl/impl/ButtonOptionImpl.java +++ b/common/src/main/java/dev/isxander/yacl/impl/ButtonOptionImpl.java @@ -143,7 +143,7 @@ public final class ButtonOptionImpl implements ButtonOption { } @ApiStatus.Internal - public static final class BuilderImpl implements ButtonOption.Builder { + public static final class BuilderImpl implements Builder { private Component name; private final List<Component> tooltipLines = new ArrayList<>(); private boolean available = true; @@ -151,7 +151,7 @@ public final class ButtonOptionImpl implements ButtonOption { private BiConsumer<YACLScreen, ButtonOption> action; @Override - public ButtonOption.Builder name(@NotNull Component name) { + public Builder name(@NotNull Component name) { Validate.notNull(name, "`name` cannot be null"); this.name = name; @@ -159,7 +159,7 @@ public final class ButtonOptionImpl implements ButtonOption { } @Override - public ButtonOption.Builder tooltip(@NotNull Component... tooltips) { + public Builder tooltip(@NotNull Component... tooltips) { Validate.notNull(tooltips, "`tooltips` cannot be empty"); tooltipLines.addAll(List.of(tooltips)); @@ -167,7 +167,7 @@ public final class ButtonOptionImpl implements ButtonOption { } @Override - public ButtonOption.Builder action(@NotNull BiConsumer<YACLScreen, ButtonOption> action) { + public Builder action(@NotNull BiConsumer<YACLScreen, ButtonOption> action) { Validate.notNull(action, "`action` cannot be null"); this.action = action; @@ -176,7 +176,7 @@ public final class ButtonOptionImpl implements ButtonOption { @Override @Deprecated - public ButtonOption.Builder action(@NotNull Consumer<YACLScreen> action) { + public Builder action(@NotNull Consumer<YACLScreen> action) { Validate.notNull(action, "`action` cannot be null"); this.action = (screen, button) -> action.accept(screen); @@ -184,13 +184,13 @@ public final class ButtonOptionImpl implements ButtonOption { } @Override - public ButtonOption.Builder available(boolean available) { + public Builder available(boolean available) { this.available = available; return this; } @Override - public ButtonOption.Builder controller(@NotNull Function<ButtonOption, Controller<BiConsumer<YACLScreen, ButtonOption>>> control) { + public Builder controller(@NotNull Function<ButtonOption, Controller<BiConsumer<YACLScreen, ButtonOption>>> control) { Validate.notNull(control, "`control` cannot be null"); this.controlGetter = control; diff --git a/src/client/java/dev/isxander/yacl/impl/ConfigCategoryImpl.java b/common/src/main/java/dev/isxander/yacl/impl/ConfigCategoryImpl.java index 2d39eb9..2d39eb9 100644 --- a/src/client/java/dev/isxander/yacl/impl/ConfigCategoryImpl.java +++ b/common/src/main/java/dev/isxander/yacl/impl/ConfigCategoryImpl.java diff --git a/src/client/java/dev/isxander/yacl/impl/GenericBindingImpl.java b/common/src/main/java/dev/isxander/yacl/impl/GenericBindingImpl.java index 0d668c6..0d668c6 100644 --- a/src/client/java/dev/isxander/yacl/impl/GenericBindingImpl.java +++ b/common/src/main/java/dev/isxander/yacl/impl/GenericBindingImpl.java diff --git a/src/client/java/dev/isxander/yacl/impl/LabelOptionImpl.java b/common/src/main/java/dev/isxander/yacl/impl/LabelOptionImpl.java index b6c3c09..732a373 100644 --- a/src/client/java/dev/isxander/yacl/impl/LabelOptionImpl.java +++ b/common/src/main/java/dev/isxander/yacl/impl/LabelOptionImpl.java @@ -120,11 +120,11 @@ public final class LabelOptionImpl implements LabelOption { } @ApiStatus.Internal - public static final class BuilderImpl implements LabelOption.Builder { + public static final class BuilderImpl implements Builder { private final List<Component> lines = new ArrayList<>(); @Override - public dev.isxander.yacl.api.LabelOption.Builder line(@NotNull Component line) { + public Builder line(@NotNull Component line) { Validate.notNull(line, "`line` must not be null"); this.lines.add(line); @@ -132,7 +132,7 @@ public final class LabelOptionImpl implements LabelOption { } @Override - public dev.isxander.yacl.api.LabelOption.Builder lines(@NotNull Collection<? extends Component> lines) { + public Builder lines(@NotNull Collection<? extends Component> lines) { this.lines.addAll(lines); return this; } diff --git a/src/client/java/dev/isxander/yacl/impl/ListOptionEntryImpl.java b/common/src/main/java/dev/isxander/yacl/impl/ListOptionEntryImpl.java index c15efe6..c15efe6 100644 --- a/src/client/java/dev/isxander/yacl/impl/ListOptionEntryImpl.java +++ b/common/src/main/java/dev/isxander/yacl/impl/ListOptionEntryImpl.java diff --git a/src/client/java/dev/isxander/yacl/impl/ListOptionImpl.java b/common/src/main/java/dev/isxander/yacl/impl/ListOptionImpl.java index 27e90ad..f47493c 100644 --- a/src/client/java/dev/isxander/yacl/impl/ListOptionImpl.java +++ b/common/src/main/java/dev/isxander/yacl/impl/ListOptionImpl.java @@ -211,7 +211,7 @@ public final class ListOptionImpl<T> implements ListOption<T> { } @ApiStatus.Internal - public static final class BuilderImpl<T> implements ListOption.Builder<T> { + public static final class BuilderImpl<T> implements Builder<T> { private Component name = Component.empty(); private final List<Component> tooltipLines = new ArrayList<>(); private Function<ListOptionEntry<T>, Controller<T>> controllerFunction; @@ -228,7 +228,7 @@ public final class ListOptionImpl<T> implements ListOption<T> { } @Override - public ListOption.Builder<T> name(@NotNull Component name) { + public Builder<T> name(@NotNull Component name) { Validate.notNull(name, "`name` must not be null"); this.name = name; @@ -236,7 +236,7 @@ public final class ListOptionImpl<T> implements ListOption<T> { } @Override - public ListOption.Builder<T> tooltip(@NotNull Component... tooltips) { + public Builder<T> tooltip(@NotNull Component... tooltips) { Validate.notEmpty(tooltips, "`tooltips` cannot be empty"); tooltipLines.addAll(List.of(tooltips)); @@ -244,7 +244,7 @@ public final class ListOptionImpl<T> implements ListOption<T> { } @Override - public ListOption.Builder<T> initial(@NotNull T initialValue) { + public Builder<T> initial(@NotNull T initialValue) { Validate.notNull(initialValue, "`initialValue` cannot be empty"); this.initialValue = initialValue; @@ -252,7 +252,7 @@ public final class ListOptionImpl<T> implements ListOption<T> { } @Override - public ListOption.Builder<T> controller(@NotNull Function<ListOptionEntry<T>, Controller<T>> control) { + public Builder<T> controller(@NotNull Function<ListOptionEntry<T>, Controller<T>> control) { Validate.notNull(control, "`control` cannot be null"); this.controllerFunction = control; @@ -260,7 +260,7 @@ public final class ListOptionImpl<T> implements ListOption<T> { } @Override - public ListOption.Builder<T> binding(@NotNull Binding<List<T>> binding) { + public Builder<T> binding(@NotNull Binding<List<T>> binding) { Validate.notNull(binding, "`binding` cannot be null"); this.binding = binding; @@ -268,7 +268,7 @@ public final class ListOptionImpl<T> implements ListOption<T> { } @Override - public ListOption.Builder<T> binding(@NotNull List<T> def, @NotNull Supplier<@NotNull List<T>> getter, @NotNull Consumer<@NotNull List<T>> setter) { + public Builder<T> binding(@NotNull List<T> def, @NotNull Supplier<@NotNull List<T>> getter, @NotNull Consumer<@NotNull List<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"); @@ -278,13 +278,13 @@ public final class ListOptionImpl<T> implements ListOption<T> { } @Override - public ListOption.Builder<T> available(boolean available) { + public Builder<T> available(boolean available) { this.available = available; return this; } @Override - public ListOption.Builder<T> flag(@NotNull OptionFlag... flag) { + public Builder<T> flag(@NotNull OptionFlag... flag) { Validate.notNull(flag, "`flag` must not be null"); this.flags.addAll(Arrays.asList(flag)); @@ -292,7 +292,7 @@ public final class ListOptionImpl<T> implements ListOption<T> { } @Override - public ListOption.Builder<T> flags(@NotNull Collection<OptionFlag> flags) { + public Builder<T> flags(@NotNull Collection<OptionFlag> flags) { Validate.notNull(flags, "`flags` must not be null"); this.flags.addAll(flags); @@ -300,19 +300,19 @@ public final class ListOptionImpl<T> implements ListOption<T> { } @Override - public ListOption.Builder<T> collapsed(boolean collapsible) { + public Builder<T> collapsed(boolean collapsible) { this.collapsed = collapsible; return this; } @Override - public ListOption.Builder<T> listener(@NotNull BiConsumer<Option<List<T>>, List<T>> listener) { + public Builder<T> listener(@NotNull BiConsumer<Option<List<T>>, List<T>> listener) { this.listeners.add(listener); return this; } @Override - public ListOption.Builder<T> listeners(@NotNull Collection<BiConsumer<Option<List<T>>, List<T>>> listeners) { + public Builder<T> listeners(@NotNull Collection<BiConsumer<Option<List<T>>, List<T>>> listeners) { this.listeners.addAll(listeners); return this; } diff --git a/src/client/java/dev/isxander/yacl/impl/OptionGroupImpl.java b/common/src/main/java/dev/isxander/yacl/impl/OptionGroupImpl.java index 68f53a0..113aefc 100644 --- a/src/client/java/dev/isxander/yacl/impl/OptionGroupImpl.java +++ b/common/src/main/java/dev/isxander/yacl/impl/OptionGroupImpl.java @@ -57,7 +57,7 @@ public final class OptionGroupImpl implements OptionGroup { } @ApiStatus.Internal - public static final class BuilderImpl implements OptionGroup.Builder { + public static final class BuilderImpl implements Builder { private Component name = Component.empty(); private final List<Component> tooltipLines = new ArrayList<>(); private final List<Option<?>> options = new ArrayList<>(); diff --git a/src/client/java/dev/isxander/yacl/impl/OptionImpl.java b/common/src/main/java/dev/isxander/yacl/impl/OptionImpl.java index 644abc9..4b65d56 100644 --- a/src/client/java/dev/isxander/yacl/impl/OptionImpl.java +++ b/common/src/main/java/dev/isxander/yacl/impl/OptionImpl.java @@ -19,7 +19,6 @@ import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; -import java.util.stream.Stream; @ApiStatus.Internal public final class OptionImpl<T> implements Option<T> { @@ -145,7 +144,7 @@ public final class OptionImpl<T> implements Option<T> { } @ApiStatus.Internal - public static class BuilderImpl<T> implements Option.Builder<T> { + public static class BuilderImpl<T> implements Builder<T> { private Component name = Component.literal("Name not specified!").withStyle(ChatFormatting.RED); private final List<Function<T, Component>> tooltipGetters = new ArrayList<>(); @@ -169,7 +168,7 @@ public final class OptionImpl<T> implements Option<T> { } @Override - public Option.Builder<T> name(@NotNull Component name) { + public Builder<T> name(@NotNull Component name) { Validate.notNull(name, "`name` cannot be null"); this.name = name; @@ -187,7 +186,7 @@ public final class OptionImpl<T> implements Option<T> { @Override @SafeVarargs @Deprecated - public final Option.Builder<T> tooltip(@NotNull Function<T, Component>... tooltipGetter) { + public final Builder<T> tooltip(@NotNull Function<T, Component>... tooltipGetter) { Validate.notNull(tooltipGetter, "`tooltipGetter` cannot be null"); this.tooltipGetters.addAll(List.of(tooltipGetter)); @@ -195,7 +194,7 @@ public final class OptionImpl<T> implements Option<T> { } @Override - public Option.Builder<T> tooltip(@NotNull Component... tooltips) { + public Builder<T> tooltip(@NotNull Component... tooltips) { var tooltipFunctions = Arrays.stream(tooltips) .map(t -> (Function<T, Component>) opt -> t) .toList(); @@ -205,7 +204,7 @@ public final class OptionImpl<T> implements Option<T> { } @Override - public Option.Builder<T> controller(@NotNull Function<Option<T>, Controller<T>> control) { + public Builder<T> controller(@NotNull Function<Option<T>, Controller<T>> control) { Validate.notNull(control, "`control` cannot be null"); this.controlGetter = control; @@ -213,7 +212,7 @@ public final class OptionImpl<T> implements Option<T> { } @Override - public Option.Builder<T> binding(@NotNull Binding<T> binding) { + public Builder<T> binding(@NotNull Binding<T> binding) { Validate.notNull(binding, "`binding` cannot be null"); this.binding = binding; @@ -221,7 +220,7 @@ public final class OptionImpl<T> implements Option<T> { } @Override - public Option.Builder<T> binding(@NotNull T def, @NotNull Supplier<@NotNull T> getter, @NotNull Consumer<@NotNull T> setter) { + public Builder<T> binding(@NotNull T def, @NotNull Supplier<@NotNull T> getter, @NotNull Consumer<@NotNull 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"); @@ -231,13 +230,13 @@ public final class OptionImpl<T> implements Option<T> { } @Override - public Option.Builder<T> available(boolean available) { + public Builder<T> available(boolean available) { this.available = available; return this; } @Override - public Option.Builder<T> flag(@NotNull OptionFlag... flag) { + public Builder<T> flag(@NotNull OptionFlag... flag) { Validate.notNull(flag, "`flag` must not be null"); this.flags.addAll(Arrays.asList(flag)); @@ -245,7 +244,7 @@ public final class OptionImpl<T> implements Option<T> { } @Override - public Option.Builder<T> flags(@NotNull Collection<OptionFlag> flags) { + public Builder<T> flags(@NotNull Collection<OptionFlag> flags) { Validate.notNull(flags, "`flags` must not be null"); this.flags.addAll(flags); @@ -253,19 +252,19 @@ public final class OptionImpl<T> implements Option<T> { } @Override - public Option.Builder<T> instant(boolean instant) { + public Builder<T> instant(boolean instant) { this.instant = instant; return this; } @Override - public Option.Builder<T> listener(@NotNull BiConsumer<Option<T>, T> listener) { + public Builder<T> listener(@NotNull BiConsumer<Option<T>, T> listener) { this.listeners.add(listener); return this; } @Override - public Option.Builder<T> listeners(@NotNull Collection<BiConsumer<Option<T>, T>> listeners) { + public Builder<T> listeners(@NotNull Collection<BiConsumer<Option<T>, T>> listeners) { this.listeners.addAll(listeners); return this; } diff --git a/src/client/java/dev/isxander/yacl/impl/PlaceholderCategoryImpl.java b/common/src/main/java/dev/isxander/yacl/impl/PlaceholderCategoryImpl.java index 0b77466..4e41a8f 100644 --- a/src/client/java/dev/isxander/yacl/impl/PlaceholderCategoryImpl.java +++ b/common/src/main/java/dev/isxander/yacl/impl/PlaceholderCategoryImpl.java @@ -49,7 +49,7 @@ public final class PlaceholderCategoryImpl implements PlaceholderCategory { } @ApiStatus.Internal - public static final class BuilderImpl implements PlaceholderCategory.Builder { + public static final class BuilderImpl implements Builder { private Component name; private final List<Component> tooltipLines = new ArrayList<>(); diff --git a/src/client/java/dev/isxander/yacl/impl/YetAnotherConfigLibImpl.java b/common/src/main/java/dev/isxander/yacl/impl/YetAnotherConfigLibImpl.java index 21c776a..3c3cad2 100644 --- a/src/client/java/dev/isxander/yacl/impl/YetAnotherConfigLibImpl.java +++ b/common/src/main/java/dev/isxander/yacl/impl/YetAnotherConfigLibImpl.java @@ -64,14 +64,14 @@ public final class YetAnotherConfigLibImpl implements YetAnotherConfigLib { } @ApiStatus.Internal - public static final class BuilderImpl implements YetAnotherConfigLib.Builder { + public static final class BuilderImpl implements Builder { private Component title; private final List<ConfigCategory> categories = new ArrayList<>(); private Runnable saveFunction = () -> {}; private Consumer<YACLScreen> initConsumer = screen -> {}; @Override - public YetAnotherConfigLib.Builder title(@NotNull Component title) { + public Builder title(@NotNull Component title) { Validate.notNull(title, "`title` cannot be null"); this.title = title; @@ -79,7 +79,7 @@ public final class YetAnotherConfigLibImpl implements YetAnotherConfigLib { } @Override - public YetAnotherConfigLib.Builder category(@NotNull ConfigCategory category) { + public Builder category(@NotNull ConfigCategory category) { Validate.notNull(category, "`category` cannot be null"); this.categories.add(category); @@ -87,7 +87,7 @@ public final class YetAnotherConfigLibImpl implements YetAnotherConfigLib { } @Override - public YetAnotherConfigLib.Builder categories(@NotNull Collection<? extends ConfigCategory> categories) { + public Builder categories(@NotNull Collection<? extends ConfigCategory> categories) { Validate.notNull(categories, "`categories` cannot be null"); this.categories.addAll(categories); @@ -95,7 +95,7 @@ public final class YetAnotherConfigLibImpl implements YetAnotherConfigLib { } @Override - public YetAnotherConfigLib.Builder save(@NotNull Runnable saveFunction) { + public Builder save(@NotNull Runnable saveFunction) { Validate.notNull(saveFunction, "`saveFunction` cannot be null"); this.saveFunction = saveFunction; @@ -103,7 +103,7 @@ public final class YetAnotherConfigLibImpl implements YetAnotherConfigLib { } @Override - public YetAnotherConfigLib.Builder screenInit(@NotNull Consumer<YACLScreen> initConsumer) { + public Builder screenInit(@NotNull Consumer<YACLScreen> initConsumer) { Validate.notNull(initConsumer, "`initConsumer` cannot be null"); this.initConsumer = initConsumer; diff --git a/src/main/java/dev/isxander/yacl/impl/utils/DimensionIntegerImpl.java b/common/src/main/java/dev/isxander/yacl/impl/utils/DimensionIntegerImpl.java index 6c7508d..6c7508d 100644 --- a/src/main/java/dev/isxander/yacl/impl/utils/DimensionIntegerImpl.java +++ b/common/src/main/java/dev/isxander/yacl/impl/utils/DimensionIntegerImpl.java diff --git a/src/main/java/dev/isxander/yacl/impl/utils/YACLConstants.java b/common/src/main/java/dev/isxander/yacl/impl/utils/YACLConstants.java index 3d382d4..3d382d4 100644 --- a/src/main/java/dev/isxander/yacl/impl/utils/YACLConstants.java +++ b/common/src/main/java/dev/isxander/yacl/impl/utils/YACLConstants.java diff --git a/src/client/java/dev/isxander/yacl/mixin/client/AbstractSelectionListMixin.java b/common/src/main/java/dev/isxander/yacl/mixin/AbstractSelectionListMixin.java index 978fd16..1b53e96 100644 --- a/src/client/java/dev/isxander/yacl/mixin/client/AbstractSelectionListMixin.java +++ b/common/src/main/java/dev/isxander/yacl/mixin/AbstractSelectionListMixin.java @@ -1,6 +1,5 @@ -package dev.isxander.yacl.mixin.client; +package dev.isxander.yacl.mixin; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.components.AbstractSelectionList; import org.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.Mixin; diff --git a/src/client/java/dev/isxander/yacl/mixin/client/OptionInstanceAccessor.java b/common/src/main/java/dev/isxander/yacl/mixin/OptionInstanceAccessor.java index b8df39f..4eea9a9 100644 --- a/src/client/java/dev/isxander/yacl/mixin/client/OptionInstanceAccessor.java +++ b/common/src/main/java/dev/isxander/yacl/mixin/OptionInstanceAccessor.java @@ -1,4 +1,4 @@ -package dev.isxander.yacl.mixin.client; +package dev.isxander.yacl.mixin; import net.minecraft.client.OptionInstance; import org.jetbrains.annotations.ApiStatus; diff --git a/common/src/main/resources/architectury.common.json b/common/src/main/resources/architectury.common.json new file mode 100644 index 0000000..0cb21dd --- /dev/null +++ b/common/src/main/resources/architectury.common.json @@ -0,0 +1,3 @@ +{ + "accessWidener": "yacl.accesswidener" +}
\ No newline at end of file diff --git a/src/main/resources/assets/yet-another-config-lib/lang/el_gr.json b/common/src/main/resources/assets/yet_another_config_lib/lang/el_gr.json index b7bc2d2..b7bc2d2 100644 --- a/src/main/resources/assets/yet-another-config-lib/lang/el_gr.json +++ b/common/src/main/resources/assets/yet_another_config_lib/lang/el_gr.json diff --git a/src/main/resources/assets/yet-another-config-lib/lang/en_us.json b/common/src/main/resources/assets/yet_another_config_lib/lang/en_us.json index 32621e9..32621e9 100644 --- a/src/main/resources/assets/yet-another-config-lib/lang/en_us.json +++ b/common/src/main/resources/assets/yet_another_config_lib/lang/en_us.json diff --git a/src/main/resources/assets/yet-another-config-lib/lang/et_ee.json b/common/src/main/resources/assets/yet_another_config_lib/lang/et_ee.json index 5f5274a..5f5274a 100644 --- a/src/main/resources/assets/yet-another-config-lib/lang/et_ee.json +++ b/common/src/main/resources/assets/yet_another_config_lib/lang/et_ee.json diff --git a/src/main/resources/assets/yet-another-config-lib/lang/fr_fr.json b/common/src/main/resources/assets/yet_another_config_lib/lang/fr_fr.json index bc069cf..bc069cf 100644 --- a/src/main/resources/assets/yet-another-config-lib/lang/fr_fr.json +++ b/common/src/main/resources/assets/yet_another_config_lib/lang/fr_fr.json diff --git a/src/main/resources/assets/yet-another-config-lib/lang/pl_pl.json b/common/src/main/resources/assets/yet_another_config_lib/lang/pl_pl.json index 49074ea..49074ea 100644 --- a/src/main/resources/assets/yet-another-config-lib/lang/pl_pl.json +++ b/common/src/main/resources/assets/yet_another_config_lib/lang/pl_pl.json diff --git a/src/main/resources/assets/yet-another-config-lib/lang/pt_br.json b/common/src/main/resources/assets/yet_another_config_lib/lang/pt_br.json index 9d4ef8d..9d4ef8d 100644 --- a/src/main/resources/assets/yet-another-config-lib/lang/pt_br.json +++ b/common/src/main/resources/assets/yet_another_config_lib/lang/pt_br.json diff --git a/src/main/resources/assets/yet-another-config-lib/lang/ru_ru.json b/common/src/main/resources/assets/yet_another_config_lib/lang/ru_ru.json index 5725d34..5725d34 100644 --- a/src/main/resources/assets/yet-another-config-lib/lang/ru_ru.json +++ b/common/src/main/resources/assets/yet_another_config_lib/lang/ru_ru.json diff --git a/src/main/resources/assets/yet-another-config-lib/lang/sl_si.json b/common/src/main/resources/assets/yet_another_config_lib/lang/sl_si.json index 743dd4d..743dd4d 100644 --- a/src/main/resources/assets/yet-another-config-lib/lang/sl_si.json +++ b/common/src/main/resources/assets/yet_another_config_lib/lang/sl_si.json diff --git a/src/main/resources/assets/yet-another-config-lib/lang/zh_cn.json b/common/src/main/resources/assets/yet_another_config_lib/lang/zh_cn.json index 9307c9b..9307c9b 100644 --- a/src/main/resources/assets/yet-another-config-lib/lang/zh_cn.json +++ b/common/src/main/resources/assets/yet_another_config_lib/lang/zh_cn.json diff --git a/src/main/resources/assets/yet-another-config-lib/lang/zh_tw.json b/common/src/main/resources/assets/yet_another_config_lib/lang/zh_tw.json index 67d05a7..67d05a7 100644 --- a/src/main/resources/assets/yet-another-config-lib/lang/zh_tw.json +++ b/common/src/main/resources/assets/yet_another_config_lib/lang/zh_tw.json diff --git a/src/main/resources/yacl-128x.png b/common/src/main/resources/yacl-128x.png Binary files differindex c86981c..c86981c 100644 --- a/src/main/resources/yacl-128x.png +++ b/common/src/main/resources/yacl-128x.png diff --git a/src/main/resources/yacl.accesswidener b/common/src/main/resources/yacl.accesswidener index 3a65a38..2188ea5 100644 --- a/src/main/resources/yacl.accesswidener +++ b/common/src/main/resources/yacl.accesswidener @@ -1,6 +1,6 @@ -accessWidener v1 named +accessWidener v2 named extendable method net/minecraft/client/gui/components/AbstractSelectionList children ()Ljava/util/List; extendable method net/minecraft/client/gui/components/AbstractSelectionList getEntryAtPosition (DD)Lnet/minecraft/client/gui/components/AbstractSelectionList$Entry; accessible class net/minecraft/client/gui/components/AbstractSelectionList$Entry -extendable method net/minecraft/client/gui/components/AbstractButton getTextureY ()I +extendable method net/minecraft/client/gui/components/AbstractButton getTextureY ()I
\ No newline at end of file diff --git a/src/client/resources/yet-another-config-lib.client.mixins.json b/common/src/main/resources/yacl.mixins.json index 69c0f25..6151c26 100644 --- a/src/client/resources/yet-another-config-lib.client.mixins.json +++ b/common/src/main/resources/yacl.mixins.json @@ -1,14 +1,12 @@ { "required": true, - "package": "dev.isxander.yacl.mixin.client", + "package": "dev.isxander.yacl.mixin", "compatibilityLevel": "JAVA_17", "injectors": { "defaultRequire": 1 }, "client": [ + "AbstractSelectionListMixin", "OptionInstanceAccessor" - ], - "mixins": [ - "AbstractSelectionListMixin" ] } diff --git a/fabric/.gitignore b/fabric/.gitignore new file mode 100644 index 0000000..b63da45 --- /dev/null +++ b/fabric/.gitignore @@ -0,0 +1,42 @@ +.gradle +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store
\ No newline at end of file diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts new file mode 100644 index 0000000..6a4d2d0 --- /dev/null +++ b/fabric/build.gradle.kts @@ -0,0 +1,158 @@ +import org.gradle.jvm.tasks.Jar + +plugins { + alias(libs.plugins.architectury.loom) + alias(libs.plugins.shadow) + alias(libs.plugins.unified.publishing) +} + +architectury { + platformSetupLoomIde() + fabric() +} + +loom { + silentMojangMappingsLicense() + + accessWidenerPath.set(project(":common").loom.accessWidenerPath) +} + +val common by configurations.registering +val shadowCommon by configurations.registering +configurations.compileClasspath.get().extendsFrom(common.get()) +configurations["developmentFabric"].extendsFrom(common.get()) + +val minecraftVersion = libs.versions.minecraft.get() + +dependencies { + minecraft(libs.minecraft) + mappings(loom.layered { + mappings("org.quiltmc:quilt-mappings:$minecraftVersion+build.${libs.versions.quilt.mappings.get()}:intermediary-v2") + officialMojangMappings() + }) + modImplementation(libs.fabric.loader) + + listOf( + "fabric-resource-loader-v0" + ).forEach { modApi(fabricApi.module(it, libs.versions.fabric.api.get())) } + modApi(libs.mod.menu) + + "common"(project(path = ":common", configuration = "namedElements")) { isTransitive = false } + "shadowCommon"(project(path = ":common", configuration = "transformProductionFabric")) { isTransitive = false } +} + +java { + withSourcesJar() +} + +tasks { + processResources { + val modId: String by project + val modName: String by project + val modDescription: String by project + val githubProject: String by project + + inputs.property("id", modId) + inputs.property("group", project.group) + inputs.property("name", modName) + inputs.property("description", modDescription) + inputs.property("version", project.version) + inputs.property("github", githubProject) + + filesMatching("fabric.mod.json") { + expand( + "id" to modId, + "group" to project.group, + "name" to modName, + "description" to modDescription, + "version" to project.version, + "github" to githubProject, + ) + } + } + + shadowJar { + exclude("architectury.common.json") + + configurations = listOf(shadowCommon.get()) + archiveClassifier.set("dev-shadow") + } + + remapJar { + injectAccessWidener.set(true) + inputFile.set(shadowJar.get().archiveFile) + dependsOn(shadowJar) + archiveClassifier.set(null as String?) + + from(rootProject.file("LICENSE")) + } + + named<Jar>("sourcesJar") { + archiveClassifier.set("dev-sources") + val commonSources = project(":common").tasks.named<Jar>("sourcesJar") + dependsOn(commonSources) + from(commonSources.get().archiveFile.map { zipTree(it) }) + } + + remapSourcesJar { + archiveClassifier.set("sources") + } + + jar { + archiveClassifier.set("dev") + } +} + +components["java"].withGroovyBuilder { + "withVariantsFromConfiguration"(configurations["shadowRuntimeElements"]) { + "skip"() + } +} + +val changelogText: String by ext + +unifiedPublishing { + project { + displayName.set("${project.version} (Fabric)") + releaseType.set("release") + gameVersions.set(listOf("1.19.3", "1.19.4")) + gameLoaders.set(listOf("fabric", "quilt")) + changelog.set(changelogText) + + mainPublication(tasks.remapJar.get()) + secondaryPublication(tasks.remapSourcesJar.get().archiveFile) + + val modrinthId: String? by rootProject + if (modrinthId?.isNotEmpty() == true) { + modrinth { + token.set(findProperty("modrinth.token")?.toString() ?: "Modrinth publishing token not found") + id.set(modrinthId) + version.set("${project.version}-fabric") + } + } + + val curseforgeId: String? by rootProject + if (curseforgeId?.isNotEmpty() == true) { + curseforge { + token.set(findProperty("curseforge.token")?.toString() ?: "Curseforge publishing token not found") + id.set(curseforgeId) + gameVersions.add("Java 17") + } + } + } +} +rootProject.tasks["releaseMod"].dependsOn(tasks["publishUnified"]) + +publishing { + publications { + create<MavenPublication>("fabric") { + groupId = "dev.isxander.yacl" + artifactId = "yet-another-config-lib-fabric" + + from(components["java"]) + } + } +} +tasks.findByPath("publishFabricPublicationToReleasesRepository")?.let { + rootProject.tasks["releaseMod"].dependsOn(it) +} diff --git a/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index cc2e6b9..6b6f6e4 100644 --- a/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -1,6 +1,9 @@ { "schemaVersion": 1, "id": "${id}", + "provides": [ + "yet-another-config-lib" + ], "version": "${version}", "name": "${name}", "description": "${description}", @@ -15,9 +18,6 @@ "icon": "yacl-128x.png", "license": "LGPL-3.0-or-later", "environment": "*", - "entrypoints": { - - }, "depends": { "fabricloader": ">=0.14.0", "minecraft": "~1.19.4", @@ -25,12 +25,8 @@ "fabric-resource-loader-v0": "*" }, "mixins": [ - { - "config": "yet-another-config-lib.client.mixins.json", - "environment": "client" - } + "yacl.mixins.json" ], - "accessWidener": "yacl.accesswidener", "custom": { "modmenu": { "badges": ["library"] diff --git a/forge/.gitignore b/forge/.gitignore new file mode 100644 index 0000000..b63da45 --- /dev/null +++ b/forge/.gitignore @@ -0,0 +1,42 @@ +.gradle +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store
\ No newline at end of file diff --git a/forge/build.gradle.kts b/forge/build.gradle.kts new file mode 100644 index 0000000..5ba9450 --- /dev/null +++ b/forge/build.gradle.kts @@ -0,0 +1,164 @@ +import org.gradle.jvm.tasks.Jar + +plugins { + alias(libs.plugins.architectury.loom) + alias(libs.plugins.shadow) + alias(libs.plugins.unified.publishing) +} + +architectury { + platformSetupLoomIde() + forge() +} + +loom { + silentMojangMappingsLicense() + + accessWidenerPath.set(project(":common").loom.accessWidenerPath) + + forge { + mixinConfig("yacl.mixins.json") + + convertAccessWideners.set(true) + extraAccessWideners.add(loom.accessWidenerPath.get().asFile.name) + } +} + +val common by configurations.registering +val shadowCommon by configurations.registering +configurations.compileClasspath.get().extendsFrom(common.get()) +configurations["developmentForge"].extendsFrom(common.get()) + +val minecraftVersion: String = libs.versions.minecraft.get() + +dependencies { + minecraft(libs.minecraft) + mappings(loom.layered { + mappings("org.quiltmc:quilt-mappings:$minecraftVersion+build.${libs.versions.quilt.mappings.get()}:intermediary-v2") + officialMojangMappings() + }) + forge(libs.forge) + + "common"(project(path = ":common", configuration = "namedElements")) { isTransitive = false } + "shadowCommon"(project(path = ":common", configuration = "transformProductionForge")) { isTransitive = false } +} + +java { + withSourcesJar() +} + +tasks { + processResources { + val modId: String by rootProject + val modName: String by rootProject + val modDescription: String by rootProject + val githubProject: String by rootProject + val majorForge = libs.versions.forge.get().substringAfter('-').split('.').first() + + inputs.property("id", modId) + inputs.property("group", project.group) + inputs.property("name", modName) + inputs.property("description", modDescription) + inputs.property("version", project.version) + inputs.property("github", githubProject) + inputs.property("major_forge", majorForge) + + filesMatching(listOf("META-INF/mods.toml", "pack.mcmeta")) { + expand( + "id" to modId, + "group" to project.group, + "name" to modName, + "description" to modDescription, + "version" to project.version, + "github" to githubProject, + "major_forge" to majorForge, + ) + } + } + + shadowJar { + exclude("fabric.mod.json") + exclude("architectury.common.json") + + configurations = listOf(shadowCommon.get()) + archiveClassifier.set("dev-shadow") + } + + remapJar { + injectAccessWidener.set(true) + inputFile.set(shadowJar.get().archiveFile) + dependsOn(shadowJar) + archiveClassifier.set(null as String?) + + from(rootProject.file("LICENSE")) + } + + named<Jar>("sourcesJar") { + archiveClassifier.set("dev-sources") + val commonSources = project(":common").tasks.named<Jar>("sourcesJar") + dependsOn(commonSources) + from(commonSources.get().archiveFile.map { zipTree(it) }) + } + + remapSourcesJar { + archiveClassifier.set("sources") + } + + jar { + archiveClassifier.set("dev") + } +} + +components["java"].withGroovyBuilder { + "withVariantsFromConfiguration"(configurations["shadowRuntimeElements"]) { + "skip"() + } +} + +val changelogText: String by ext + +unifiedPublishing { + project { + displayName.set("${project.version} (Forge)") + releaseType.set("release") + gameVersions.set(listOf("1.19.3", "1.19.4")) + gameLoaders.set(listOf("forge")) + changelog.set(changelogText) + + mainPublication(tasks.remapJar.get()) + secondaryPublication(tasks.remapSourcesJar.get().archiveFile) + + val modrinthId: String? by rootProject + if (modrinthId?.isNotEmpty() == true) { + modrinth { + token.set(findProperty("modrinth.token")?.toString() ?: "Modrinth publishing token not found") + id.set(modrinthId) + version.set("${project.version}-forge") + } + } + + val curseforgeId: String? by rootProject + if (curseforgeId?.isNotEmpty() == true) { + curseforge { + token.set(findProperty("curseforge.token")?.toString() ?: "Curseforge publishing token not found") + id.set(curseforgeId) + gameVersions.add("Java 17") + } + } + } +} +rootProject.tasks["releaseMod"].dependsOn(tasks["publishUnified"]) + +publishing { + publications { + create<MavenPublication>("forge") { + groupId = "dev.isxander.yacl" + artifactId = "yet-another-config-lib-forge" + + from(components["java"]) + } + } +} +tasks.findByPath("publishForgePublicationToReleasesRepository")?.let { + rootProject.tasks["releaseMod"].dependsOn(it) +} diff --git a/forge/gradle.properties b/forge/gradle.properties new file mode 100644 index 0000000..32f842a --- /dev/null +++ b/forge/gradle.properties @@ -0,0 +1 @@ +loom.platform=forge
\ No newline at end of file diff --git a/forge/src/main/java/dev/isxander/yacl/forge/YACLForgeEntrypoint.java b/forge/src/main/java/dev/isxander/yacl/forge/YACLForgeEntrypoint.java new file mode 100644 index 0000000..3360184 --- /dev/null +++ b/forge/src/main/java/dev/isxander/yacl/forge/YACLForgeEntrypoint.java @@ -0,0 +1,11 @@ +package dev.isxander.yacl.forge; + +import net.minecraftforge.fml.common.Mod; + +@Mod("yet_another_config_lib") +public class YACLForgeEntrypoint { + public YACLForgeEntrypoint() { + + } + +} diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml new file mode 100644 index 0000000..e6a0a07 --- /dev/null +++ b/forge/src/main/resources/META-INF/mods.toml @@ -0,0 +1,28 @@ +modLoader = "javafml" +loaderVersion = "[${major_forge},)" +#issueTrackerURL = "" +license = "LGPL-3.0-or-later" + +[[mods]] +modId = "${id}" +version = "${version}" +displayName = "${name}" +authors = "isXander" +description = ''' +${description} +''' +logoFile = "yacl-128x.png" + +[["dependencies.${id}"]] +modId = "forge" +mandatory = true +versionRange = "[${major_forge},)" +ordering = "NONE" +side = "BOTH" + +[["dependencies.${id}"]] +modId = "minecraft" +mandatory = true +versionRange = "[1.19.4,)" +ordering = "NONE" +side = "BOTH" diff --git a/forge/src/main/resources/pack.mcmeta b/forge/src/main/resources/pack.mcmeta new file mode 100644 index 0000000..a9c6340 --- /dev/null +++ b/forge/src/main/resources/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack": { + "description": "${name}", + "pack_format": 14 + } +}
\ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 866cd28..a89ff66 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,13 +1,9 @@ -org.gradle.jvmargs=-Xmx3G +org.gradle.jvmargs=-Xmx4G -minecraftVersion=1.19.4 -fabricLoaderVersion=0.14.17 -qmBuild=1 - -modId=yet-another-config-lib +modId=yet_another_config_lib modName=YetAnotherConfigLib modDescription=YetAnotherConfigLib (yacl) is just that. A builder-based configuration library for Minecraft. -curseforgeId=667299 modrinthId=yacl -githubProject=isXander/YetAnotherConfigLib +curseforgeId=yacl +githubProject=isXander/YetAnotherConfigLib
\ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..e811335 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,48 @@ +[versions] +# Plugins +architectury_loom = "1.1.+" +architectury_plugin = "3.4.+" +shadow = "7.1.+" +quilt_quiltflower = "1.8.+" +unified_publishing = "0.1.+" +github_release = "2.+" +machete = "2.+" +grgit = "5.0.+" + +minecraft = "1.19.4" +quilt_mappings = "10" +fabric_loader = "0.14.19" + +# Common Dependencies +mixin_extras = "0.2.0-beta.6" + +# Fabric-like Dependencies +fabric_api = "0.79.0+1.19.4" +mod_menu = "6.2.1" + +# Forge Dependencies +forge = "1.19.4-45.0.47" + +[libraries] +minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" } +fabric_loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabric_loader" } + +# Common Dependencies +mixin_extras_common = { module = "com.github.llamalad7.mixinextras:mixinextras-common", version.ref = "mixin_extras" } + +# Fabric-like Dependencies +fabric_api = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabric_api" } +mod_menu = { module = "com.terraformersmc:modmenu", version.ref = "mod_menu" } + +# Forge Dependencies +forge = { module = "net.minecraftforge:forge", version.ref = "forge" } + +[plugins] +architectury_loom = { id = "dev.architectury.loom", version.ref = "architectury_loom" } +architectury_plugin = { id = "architectury-plugin", version.ref = "architectury_plugin" } +shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" } + +unified_publishing = { id = "me.shedaniel.unified-publishing", version.ref = "unified_publishing" } +github_release = { id = "com.github.breadmoirai.github-release", version.ref = "github_release" } +machete = { id = "io.github.p03w.machete", version.ref = "machete" } +grgit = { id = "org.ajoberstar.grgit", version.ref = "grgit" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ae04661..876a219 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Sun Apr 23 19:05:18 BST 2023 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists @@ -205,12 +205,6 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" -# Stop when "xargs" is not available. -if ! command -v xargs >/dev/null 2>&1 -then - die "xargs is not available" -fi - # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 53a6b23..ac1b06f 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License.
@rem
-@if "%DEBUG%"=="" @echo off
+@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@@ -25,7 +25,7 @@ if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
-if "%DIRNAME%"=="" set DIRNAME=.
+if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
-if %ERRORLEVEL% equ 0 goto execute
+if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -75,15 +75,13 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end
@rem End local scope for the variables with windows NT shell
-if %ERRORLEVEL% equ 0 goto mainEnd
+if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
-set EXIT_CODE=%ERRORLEVEL%
-if %EXIT_CODE% equ 0 set EXIT_CODE=1
-if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
-exit /b %EXIT_CODE%
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
diff --git a/settings.gradle.kts b/settings.gradle.kts index 0ea7354..51b9105 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -3,9 +3,23 @@ pluginManagement { mavenCentral() gradlePluginPortal() maven("https://maven.fabricmc.net") + maven("https://maven.architectury.dev/") + maven("https://maven.minecraftforge.net/") maven("https://maven.quiltmc.org/repository/release") } } +dependencyResolutionManagement { + versionCatalogs { + create("libs") + } +} + rootProject.name = "YetAnotherConfigLib" +include("common") +include("fabric") +include("forge") +include("test-common") +include("test-fabric") +include("test-forge") diff --git a/src/testmod/java/dev/isxander/yacl/test/ExampleMod.java b/src/testmod/java/dev/isxander/yacl/test/ExampleMod.java deleted file mode 100644 index 46c5225..0000000 --- a/src/testmod/java/dev/isxander/yacl/test/ExampleMod.java +++ /dev/null @@ -1,11 +0,0 @@ -package dev.isxander.yacl.test; - -import dev.isxander.yacl.test.config.ExampleConfig; -import net.fabricmc.api.ClientModInitializer; - -public class ExampleMod implements ClientModInitializer { - @Override - public void onInitializeClient() { - ExampleConfig.INSTANCE.load(); - } -} diff --git a/src/testmod/java/dev/isxander/yacl/test/config/GuiTest.java b/src/testmod/java/dev/isxander/yacl/test/config/GuiTest.java deleted file mode 100644 index 18d2a3c..0000000 --- a/src/testmod/java/dev/isxander/yacl/test/config/GuiTest.java +++ /dev/null @@ -1,449 +0,0 @@ -package dev.isxander.yacl.test.config; - -import dev.isxander.yacl.api.*; -import dev.isxander.yacl.gui.RequireRestartScreen; -import dev.isxander.yacl.gui.controllers.*; -import dev.isxander.yacl.gui.controllers.cycling.EnumController; -import dev.isxander.yacl.gui.controllers.slider.DoubleSliderController; -import dev.isxander.yacl.gui.controllers.slider.FloatSliderController; -import dev.isxander.yacl.gui.controllers.slider.IntegerSliderController; -import dev.isxander.yacl.gui.controllers.slider.LongSliderController; -import dev.isxander.yacl.gui.controllers.string.StringController; -import dev.isxander.yacl.gui.controllers.string.number.DoubleFieldController; -import dev.isxander.yacl.gui.controllers.string.number.FloatFieldController; -import dev.isxander.yacl.gui.controllers.string.number.IntegerFieldController; -import dev.isxander.yacl.gui.controllers.string.number.LongFieldController; -import net.minecraft.client.GraphicsStatus; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.components.toasts.SystemToast; -import net.minecraft.client.gui.screens.Screen; -import net.minecraft.network.chat.ClickEvent; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.HoverEvent; - -import java.awt.Color; -import java.util.List; - -public class GuiTest { - public static Screen getModConfigScreenFactory(Screen parent) { - return YetAnotherConfigLib.create(ExampleConfig.INSTANCE, (defaults, config, builder) -> builder - .title(Component.literal("Test Suites")) - .category(ConfigCategory.createBuilder() - .name(Component.literal("Suites")) - .option(ButtonOption.createBuilder() - .name(Component.literal("Full Test Suite")) - .controller(ActionController::new) - .action((screen, opt) -> Minecraft.getInstance().setScreen(getFullTestSuite(screen))) - .build()) - .group(OptionGroup.createBuilder() - .name(Component.literal("Wiki")) - .option(ButtonOption.createBuilder() - .name(Component.literal("Get Started")) - .controller(ActionController::new) - .action((screen, opt) -> Minecraft.getInstance().setScreen(getWikiGetStarted(screen))) - .build()) - .build()) - .build()) - ) - .generateScreen(parent); - } - - private static Screen getFullTestSuite(Screen parent) { - return YetAnotherConfigLib.create(ExampleConfig.INSTANCE, (defaults, config, builder) -> builder - .title(Component.literal("Test GUI")) - .category(ConfigCategory.createBuilder() - .name(Component.literal("Control Examples")) - .tooltip(Component.literal("Example Category Description")) - .group(OptionGroup.createBuilder() - .name(Component.literal("Boolean Controllers")) - .tooltip(Component.literal("Test!")) - .option(Option.createBuilder(boolean.class) - .name(Component.literal("Boolean Toggle")) - .tooltip(value -> Component.literal("A simple toggle button that contains the value '" + value + "'")) - .binding( - defaults.booleanToggle, - () -> config.booleanToggle, - (value) -> config.booleanToggle = value - ) - .controller(BooleanController::new) - .flag(OptionFlag.GAME_RESTART) - .build()) - .option(Option.createBuilder(boolean.class) - .name(Component.literal("Custom Boolean Toggle")) - .tooltip(Component.literal("You can customize these controllers like this!")) - .tooltip(Component.empty()) - .tooltip(opt -> Component.empty()) - .binding( - defaults.customBooleanToggle, - () -> config.customBooleanToggle, - (value) -> config.customBooleanToggle = value - ) - .controller(opt -> new BooleanController(opt, state -> state ? Component.literal("Amazing") : Component.literal("Not Amazing"), true)) - .build()) - .option(Option.createBuilder(boolean.class) - .name(Component.literal("Tick Box")) - .tooltip(Component.literal("There are even alternate methods of displaying the same data type!")) - .binding( - defaults.tickbox, - () -> config.tickbox, - (value) -> config.tickbox = value - ) - .controller(TickBoxController::new) - .build()) - .build()) - .group(OptionGroup.createBuilder() - .name(Component.literal("Slider Controllers")) - .option(Option.createBuilder(int.class) - .name(Component.literal("Int Slider")) - .instant(true) - .binding( - defaults.intSlider, - () -> config.intSlider, - value -> config.intSlider = value - - ) - .controller(opt -> new IntegerSliderController(opt, 0, 3, 1)) - .build()) - .option(Option.createBuilder(double.class) - .name(Component.literal("Double Slider")) - .binding( - defaults.doubleSlider, - () -> config.doubleSlider, - (value) -> config.doubleSlider = value - ) - .controller(opt -> new DoubleSliderController(opt, 0, 3, 0.05)) - .build()) - .option(Option.createBuilder(float.class) - .name(Component.literal("Float Slider")) - .binding( - defaults.floatSlider, - () -> config.floatSlider, - (value) -> config.floatSlider = value - ) - .controller(opt -> new FloatSliderController(opt, 0, 3, 0.1f)) - .build()) - .option(Option.createBuilder(long.class) - .name(Component.literal("Long Slider")) - .binding( - defaults.longSlider, - () -> config.longSlider, - (value) -> config.longSlider = value - ) - .controller(opt -> new LongSliderController(opt, 0, 1_000_000, 100)) - .build()) - .build()) - .group(OptionGroup.createBuilder() - .name(Component.literal("Input Field Controllers")) - .option(Option.createBuilder(String.class) - .name(Component.literal("Component Option")) - .binding( - defaults.textField, - () -> config.textField, - value -> config.textField = value - ) - .controller(StringController::new) - .build()) - .option(Option.createBuilder(Color.class) - .name(Component.literal("Color Option")) - .binding( - defaults.colorOption, - () -> config.colorOption, - value -> config.colorOption = value - ) - .controller(ColorController::new) - .build()) - .build()) - .group(OptionGroup.createBuilder() - .name(Component.literal("Number Fields")) - .option(Option.createBuilder(double.class) - .name(Component.literal("Double Field")) - .binding( - defaults.doubleField, - () -> config.doubleField, - value -> config.doubleField = value - ) - .controller(DoubleFieldController::new) - .build()) - .option(Option.createBuilder(float.class) - .name(Component.literal("Float Field")) - .binding( - defaults.floatField, - () -> config.floatField, - value -> config.floatField = value - ) - .controller(FloatFieldController::new) - .build()) - .option(Option.createBuilder(int.class) - .name(Component.literal("Integer Field")) - .binding( - defaults.intField, - () -> config.intField, - value -> config.intField = value - ) - .controller(IntegerFieldController::new) - .build()) - .option(Option.createBuilder(long.class) - .name(Component.literal("Long Field")) - .binding( - defaults.longField, - () -> config.longField, - value -> config.longField = value - ) - .controller(LongFieldController::new) - .build()) - .build()) - .group(OptionGroup.createBuilder() - .name(Component.literal("Enum Controllers")) - .option(Option.createBuilder(ExampleConfig.Alphabet.class) - .name(Component.literal("Enum Cycler")) - .binding( - defaults.enumOption, - () -> config.enumOption, - (value) -> config.enumOption = value - ) - .controller(EnumController::new) - .build()) - .build()) - .group(OptionGroup.createBuilder() - .name(Component.literal("Options that aren't really options")) - .option(ButtonOption.createBuilder() - .name(Component.literal("Button \"Option\"")) - .action((screen, opt) -> SystemToast.add(Minecraft.getInstance().getToasts(), SystemToast.SystemToastIds.TUTORIAL_HINT, Component.literal("Button Pressed"), Component.literal("Button option was invoked!"))) - .controller(ActionController::new) - .build()) - .option(LabelOption.create( - Component.empty() - .append(Component.literal("a").withStyle(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("a"))))) - .append(Component.literal("b").withStyle(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("b"))))) - .append(Component.literal("c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c").withStyle(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("c"))))) - .append(Component.literal("e").withStyle(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("e"))))) - .withStyle(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://isxander.dev")))) - ) - .build()) - .group(OptionGroup.createBuilder() - .name(Component.literal("Minecraft Bindings")) - .tooltip(Component.literal("YACL can also bind Minecraft options!")) - .option(Option.createBuilder(boolean.class) - .name(Component.literal("Minecraft AutoJump")) - .tooltip(Component.literal("You can even bind minecraft options!")) - .binding(Binding.minecraft(Minecraft.getInstance().options.autoJump())) - .controller(TickBoxController::new) - .build()) - .option(Option.createBuilder(GraphicsStatus.class) - .name(Component.literal("Minecraft Graphics Mode")) - .binding(Binding.minecraft(Minecraft.getInstance().options.graphicsMode())) - .controller(EnumController::new) - .build()) - .build()) - .build()) - .category(ConfigCategory.createBuilder() - .name(Component.literal("List Test")) - .group(ListOption.createBuilder(String.class) - .name(Component.literal("String List")) - .binding( - defaults.stringList, - () -> config.stringList, - val -> config.stringList = val - ) - .controller(StringController::new) - .initial("") - .build()) - .group(ListOption.createBuilder(Integer.class) - .name(Component.literal("Slider List")) - .binding( - defaults.intList, - () -> config.intList, - val -> config.intList = val - ) - .controller(opt -> new IntegerSliderController(opt, 0, 10, 1)) - .initial(0) - .available(false) - .build()) - .group(ListOption.createBuilder(Component.class) - .name(Component.literal("Useless Label List")) - .binding(Binding.immutable(List.of(Component.literal("It's quite impressive that literally every single controller works, without problem.")))) - .controller(LabelController::new) - .initial(Component.literal("Initial label")) - .build()) - .build()) - .category(PlaceholderCategory.createBuilder() - .name(Component.literal("Placeholder Category")) - .screen((client, yaclScreen) -> new RequireRestartScreen(yaclScreen)) - .build()) - .category(ConfigCategory.createBuilder() - .name(Component.literal("Group Test")) - .option(Option.createBuilder(boolean.class) - .name(Component.literal("Root Test")) - .binding( - defaults.groupTestRoot, - () -> config.groupTestRoot, - value -> config.groupTestRoot = value - ) - .controller(TickBoxController::new) - .build()) - .group(OptionGroup.createBuilder() - .name(Component.literal("First Group")) - .option(Option.createBuilder(boolean.class) - .name(Component.literal("First Group Test 1")) - .binding( - defaults.groupTestFirstGroup, - () -> config.groupTestFirstGroup, - value -> config.groupTestFirstGroup = value - ) - .controller(TickBoxController::new) - .build()) - .option(Option.createBuilder(boolean.class) - .name(Component.literal("First Group Test 2")) - .binding( - defaults.groupTestFirstGroup2, - () -> config.groupTestFirstGroup2, - value -> config.groupTestFirstGroup2 = value - ) - .controller(TickBoxController::new) - .build()) - .build()) - .group(OptionGroup.createBuilder() - .name(Component.empty()) - .option(Option.createBuilder(boolean.class) - .name(Component.literal("Second Group Test")) - .binding( - defaults.groupTestSecondGroup, - () -> config.groupTestSecondGroup, - value -> config.groupTestSecondGroup = value - ) - .controller(TickBoxController::new) - .build()) - .build()) - .build()) - .category(ConfigCategory.createBuilder() - .name(Component.literal("Scroll Test")) - .option(Option.createBuilder(int.class) - .name(Component.literal("Int Slider that is cut off because the slider")) - .binding( - defaults.scrollingSlider, - () -> config.scrollingSlider, - (value) -> config.scrollingSlider = value - ) - .controller(opt -> new IntegerSliderController(opt, 0, 10, 1)) - .build()) - .option(ButtonOption.createBuilder() - .name(Component.literal("Option")) - .action((screen, opt) -> {}) - .controller(ActionController::new) - .build()) - .option(ButtonOption.createBuilder() - .name(Component.literal("Option")) - .action((screen, opt) -> {}) - .controller(ActionController::new) - .build()) - .option(ButtonOption.createBuilder() - .name(Component.literal("Option")) - .action((screen, opt) -> {}) - .controller(ActionController::new) - .build()) - .option(ButtonOption.createBuilder() - .name(Component.literal("Option")) - .action((screen, opt) -> {}) - .controller(ActionController::new) - .build()) - .option(ButtonOption.createBuilder() - .name(Component.literal("Option")) - .action((screen, opt) -> {}) - .controller(ActionController::new) - .build()) - .option(ButtonOption.createBuilder() - .name(Component.literal("Option")) - .action((screen, opt) -> {}) - .controller(ActionController::new) - .build()) - .option(ButtonOption.createBuilder() - .name(Component.literal("Option")) - .action((screen, opt) -> {}) - .controller(ActionController::new) - .build()) - .option(ButtonOption.createBuilder() - .name(Component.literal("Option")) - .action((screen, opt) -> {}) - .controller(ActionController::new) - .build()) - .option(ButtonOption.createBuilder() - .name(Component.literal("Option")) - .action((screen, opt) -> {}) - .controller(ActionController::new) - .build()) - .option(ButtonOption.createBuilder() - .name(Component.literal("Option")) - .action((screen, opt) -> {}) - .controller(ActionController::new) - .build()) - .option(ButtonOption.createBuilder() - .name(Component.literal("Option")) - .action((screen, opt) -> {}) - .controller(ActionController::new) - .build()) - .option(ButtonOption.createBuilder() - .name(Component.literal("Option")) - .action((screen, opt) -> {}) - .controller(ActionController::new) - .build()) - .option(ButtonOption.createBuilder() - .name(Component.literal("Option")) - .action((screen, opt) -> {}) - .controller(ActionController::new) - .build()) - .build()) - .category(ConfigCategory.createBuilder() - .name(Component.literal("Category Test")) - .build()) - .category(ConfigCategory.createBuilder() - .name(Component.literal("Category Test")) - .build()) - .category(ConfigCategory.createBuilder() - .name(Component.literal("Category Test")) - .build()) - .category(ConfigCategory.createBuilder() - .name(Component.literal("Category Test")) - .build()) - .category(ConfigCategory.createBuilder() - .name(Component.literal("Category Test")) - .build()) - .category(ConfigCategory.createBuilder() - .name(Component.literal("Category Test")) - .build()) - .category(ConfigCategory.createBuilder() - .name(Component.literal("Category Test")) - .build()) - .category(ConfigCategory.createBuilder() - .name(Component.literal("Category Test")) - .build()) - .save(() -> { - Minecraft.getInstance().options.save(); - ExampleConfig.INSTANCE.save(); - }) - ) - .generateScreen(parent); - } - - private static boolean myBooleanOption = true; - - private static Screen getWikiGetStarted(Screen parent) { - return YetAnotherConfigLib.createBuilder() - .title(Component.literal("Used for narration. Could be used to render a title in the future.")) - .category(ConfigCategory.createBuilder() - .name(Component.literal("Name of the category")) - .tooltip(Component.literal("This Component will appear as a tooltip when you hover or focus the button with Tab. There is no need to add \n to wrap as YACL will do it for you.")) - .group(OptionGroup.createBuilder() - .name(Component.literal("Name of the group")) - .tooltip(Component.literal("This Component will appear when you hover over the name or focus on the collapse button with Tab.")) - .option(Option.createBuilder(boolean.class) - .name(Component.literal("Boolean Option")) - .tooltip(Component.literal("This Component will appear as a tooltip when you hover over the option.")) - .binding(true, () -> myBooleanOption, newVal -> myBooleanOption = newVal) - .controller(TickBoxController::new) - .build()) - .build()) - .build()) - .build() - .generateScreen(parent); - } -} diff --git a/src/testmod/java/dev/isxander/yacl/test/mixins/TitleScreenMixin.java b/src/testmod/java/dev/isxander/yacl/test/mixins/TitleScreenMixin.java deleted file mode 100644 index eac9ff4..0000000 --- a/src/testmod/java/dev/isxander/yacl/test/mixins/TitleScreenMixin.java +++ /dev/null @@ -1,30 +0,0 @@ -package dev.isxander.yacl.test.mixins; - -import dev.isxander.yacl.test.config.GuiTest; -import net.minecraft.client.gui.components.Button; -import net.minecraft.client.gui.screens.Screen; -import net.minecraft.client.gui.screens.TitleScreen; -import net.minecraft.network.chat.Component; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -/** - * For testing purposes! If you are using this as - * an example, ignore this class! - */ -@Mixin(TitleScreen.class) -public abstract class TitleScreenMixin extends Screen { - protected TitleScreenMixin(Component title) { - super(title); - } - - @Inject(method = "init", at = @At("RETURN")) - private void injectTestButton(CallbackInfo ci) { - addRenderableWidget(Button.builder(Component.literal("YACL"), button -> minecraft.setScreen(GuiTest.getModConfigScreenFactory(minecraft.screen))) - .pos(0, 0) - .width(50) - .build()); - } -} diff --git a/src/testmod/resources/fabric.mod.json b/src/testmod/resources/fabric.mod.json deleted file mode 100644 index d682084..0000000 --- a/src/testmod/resources/fabric.mod.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "schemaVersion": 1, - "id": "test-mod", - "version": "1", - "name": "YACL Test", - "authors": [ - "isXander" - ], - "license": "LGPL-3.0-or-later", - "environment": "client", - "entrypoints": { - "client": [ - "dev.isxander.yacl.test.ExampleMod" - ] - }, - "depends": { - "yet-another-config-lib": "*" - }, - "mixins": [ - "yet-another-config-lib.test.mixins.json" - ] -} diff --git a/src/testmod/resources/yet-another-config-lib.test.mixins.json b/src/testmod/resources/yet-another-config-lib.test.mixins.json deleted file mode 100644 index 9287cdd..0000000 --- a/src/testmod/resources/yet-another-config-lib.test.mixins.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "required": true, - "package": "dev.isxander.yacl.test.mixins", - "compatibilityLevel": "JAVA_17", - "injectors": { - "defaultRequire": 1 - }, - "client": [ - "TitleScreenMixin" - ] -} diff --git a/test-common/.gitignore b/test-common/.gitignore new file mode 100644 index 0000000..b63da45 --- /dev/null +++ b/test-common/.gitignore @@ -0,0 +1,42 @@ +.gradle +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store
\ No newline at end of file diff --git a/test-common/build.gradle.kts b/test-common/build.gradle.kts new file mode 100644 index 0000000..7e14666 --- /dev/null +++ b/test-common/build.gradle.kts @@ -0,0 +1,24 @@ +plugins { + alias(libs.plugins.architectury.loom) +} + +architectury { + common("fabric", "forge") +} + +loom { + silentMojangMappingsLicense() + + accessWidenerPath.set(project(":common").loom.accessWidenerPath) +} + +dependencies { + minecraft(libs.minecraft) + mappings(loom.layered { + mappings("org.quiltmc:quilt-mappings:${libs.versions.minecraft.get()}+build.${libs.versions.quilt.mappings.get()}:intermediary-v2") + officialMojangMappings() + }) + modImplementation(libs.fabric.loader) + + implementation(project(path = ":common", configuration = "namedElements")) +} diff --git a/src/testmod/java/dev/isxander/yacl/test/config/ExampleConfig.java b/test-common/src/main/java/dev/isxander/yacl/test/ConfigTest.java index 717132b..71cb285 100644 --- a/src/testmod/java/dev/isxander/yacl/test/config/ExampleConfig.java +++ b/test-common/src/main/java/dev/isxander/yacl/test/ConfigTest.java @@ -1,4 +1,4 @@ -package dev.isxander.yacl.test.config; +package dev.isxander.yacl.test; import dev.isxander.yacl.config.ConfigEntry; import dev.isxander.yacl.config.ConfigInstance; @@ -8,8 +8,8 @@ import java.awt.*; import java.util.List; import java.nio.file.Path; -public class ExampleConfig { - public static final ConfigInstance<ExampleConfig> INSTANCE = GsonConfigInstance.createBuilder(ExampleConfig.class) +public class ConfigTest { + public static final ConfigInstance<ConfigTest> GSON = GsonConfigInstance.createBuilder(ConfigTest.class) .setPath(Path.of("./config/yacl-test.json")) .build(); @@ -28,15 +28,22 @@ public class ExampleConfig { @ConfigEntry public long longField = 5; @ConfigEntry public Alphabet enumOption = Alphabet.A; - @ConfigEntry public List<String> stringList = List.of("This is quite cool.", "You can add multiple items!", "And it is integrated so well into Option groups!"); - @ConfigEntry public List<Integer> intList = List.of(1, 2, 3); - - @ConfigEntry public boolean groupTestRoot = false; - @ConfigEntry public boolean groupTestFirstGroup = false; - @ConfigEntry public boolean groupTestFirstGroup2 = false; - @ConfigEntry public boolean groupTestSecondGroup = false; - - @ConfigEntry public int scrollingSlider = 0; + @ConfigEntry + public List<String> stringList = List.of("This is quite cool.", "You can add multiple items!", "And it is integrated so well into Option groups!"); + @ConfigEntry + public List<Integer> intList = List.of(1, 2, 3); + + @ConfigEntry + public boolean groupTestRoot = false; + @ConfigEntry + public boolean groupTestFirstGroup = false; + @ConfigEntry + public boolean groupTestFirstGroup2 = false; + @ConfigEntry + public boolean groupTestSecondGroup = false; + + @ConfigEntry + public int scrollingSlider = 0; public enum Alphabet { A, B, C diff --git a/test-common/src/main/java/dev/isxander/yacl/test/GuiTest.java b/test-common/src/main/java/dev/isxander/yacl/test/GuiTest.java new file mode 100644 index 0000000..9065e76 --- /dev/null +++ b/test-common/src/main/java/dev/isxander/yacl/test/GuiTest.java @@ -0,0 +1,462 @@ +package dev.isxander.yacl.test; + +import dev.isxander.yacl.api.*; +import dev.isxander.yacl.gui.RequireRestartScreen; +import dev.isxander.yacl.gui.controllers.*; +import dev.isxander.yacl.gui.controllers.cycling.EnumController; +import dev.isxander.yacl.gui.controllers.slider.DoubleSliderController; +import dev.isxander.yacl.gui.controllers.slider.FloatSliderController; +import dev.isxander.yacl.gui.controllers.slider.IntegerSliderController; +import dev.isxander.yacl.gui.controllers.slider.LongSliderController; +import dev.isxander.yacl.gui.controllers.string.StringController; +import dev.isxander.yacl.gui.controllers.string.number.DoubleFieldController; +import dev.isxander.yacl.gui.controllers.string.number.FloatFieldController; +import dev.isxander.yacl.gui.controllers.string.number.IntegerFieldController; +import dev.isxander.yacl.gui.controllers.string.number.LongFieldController; +import net.minecraft.client.GraphicsStatus; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.components.toasts.SystemToast; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.network.chat.ClickEvent; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.HoverEvent; + +import java.awt.Color; +import java.util.List; + +public class GuiTest { + public static Screen getModConfigScreenFactory(Screen parent) { + return YetAnotherConfigLib.create(ConfigTest.GSON, (defaults, config, builder) -> builder + .title(Component.literal("Test Suites")) + .category(ConfigCategory.createBuilder() + .name(Component.literal("Suites")) + .option(ButtonOption.createBuilder() + .name(Component.literal("Full Test Suite")) + .controller(ActionController::new) + .action((screen, opt) -> Minecraft.getInstance().setScreen(getFullTestSuite(screen))) + .build()) + .group(OptionGroup.createBuilder() + .name(Component.literal("Wiki")) + .option(ButtonOption.createBuilder() + .name(Component.literal("Get Started")) + .controller(ActionController::new) + .action((screen, opt) -> Minecraft.getInstance().setScreen(getWikiGetStarted(screen))) + .build()) + .build()) + .build()) + ) + .generateScreen(parent); + } + + private static Screen getFullTestSuite(Screen parent) { + return YetAnotherConfigLib.create(ConfigTest.GSON, (defaults, config, builder) -> builder + .title(Component.literal("Test GUI")) + .category(ConfigCategory.createBuilder() + .name(Component.literal("Control Examples")) + .tooltip(Component.literal("Example Category Description")) + .group(OptionGroup.createBuilder() + .name(Component.literal("Boolean Controllers")) + .tooltip(Component.literal("Test!")) + .option(Option.createBuilder(boolean.class) + .name(Component.literal("Boolean Toggle")) + .tooltip(value -> Component.literal("A simple toggle button that contains the value '" + value + "'")) + .binding( + defaults.booleanToggle, + () -> config.booleanToggle, + (value) -> config.booleanToggle = value + ) + .controller(BooleanController::new) + .flag(OptionFlag.GAME_RESTART) + .build()) + .option(Option.createBuilder(boolean.class) + .name(Component.literal("Custom Boolean Toggle")) + .tooltip(Component.literal("You can customize these controllers like this!")) + .tooltip(Component.empty()) + .tooltip(opt -> Component.empty()) + .binding( + defaults.customBooleanToggle, + () -> config.customBooleanToggle, + (value) -> config.customBooleanToggle = value + ) + .controller(opt -> new BooleanController(opt, state -> state ? Component.literal("Amazing") : Component.literal("Not Amazing"), true)) + .build()) + .option(Option.createBuilder(boolean.class) + .name(Component.literal("Tick Box")) + .tooltip(Component.literal("There are even alternate methods of displaying the same data type!")) + .binding( + defaults.tickbox, + () -> config.tickbox, + (value) -> config.tickbox = value + ) + .controller(TickBoxController::new) + .build()) + .build()) + .group(OptionGroup.createBuilder() + .name(Component.literal("Slider Controllers")) + .option(Option.createBuilder(int.class) + .name(Component.literal("Int Slider")) + .instant(true) + .binding( + defaults.intSlider, + () -> config.intSlider, + value -> config.intSlider = value + + ) + .controller(opt -> new IntegerSliderController(opt, 0, 3, 1)) + .build()) + .option(Option.createBuilder(double.class) + .name(Component.literal("Double Slider")) + .binding( + defaults.doubleSlider, + () -> config.doubleSlider, + (value) -> config.doubleSlider = value + ) + .controller(opt -> new DoubleSliderController(opt, 0, 3, 0.05)) + .build()) + .option(Option.createBuilder(float.class) + .name(Component.literal("Float Slider")) + .binding( + defaults.floatSlider, + () -> config.floatSlider, + (value) -> config.floatSlider = value + ) + .controller(opt -> new FloatSliderController(opt, 0, 3, 0.1f)) + .build()) + .option(Option.createBuilder(long.class) + .name(Component.literal("Long Slider")) + .binding( + defaults.longSlider, + () -> config.longSlider, + (value) -> config.longSlider = value + ) + .controller(opt -> new LongSliderController(opt, 0, 1_000_000, 100)) + .build()) + .build()) + .group(OptionGroup.createBuilder() + .name(Component.literal("Input Field Controllers")) + .option(Option.createBuilder(String.class) + .name(Component.literal("Component Option")) + .binding( + defaults.textField, + () -> config.textField, + value -> config.textField = value + ) + .controller(StringController::new) + .build()) + .option(Option.createBuilder(Color.class) + .name(Component.literal("Color Option")) + .binding( + defaults.colorOption, + () -> config.colorOption, + value -> config.colorOption = value + ) + .controller(ColorController::new) + .build()) + .build()) + .group(OptionGroup.createBuilder() + .name(Component.literal("Number Fields")) + .option(Option.createBuilder(double.class) + .name(Component.literal("Double Field")) + .binding( + defaults.doubleField, + () -> config.doubleField, + value -> config.doubleField = value + ) + .controller(DoubleFieldController::new) + .build()) + .option(Option.createBuilder(float.class) + .name(Component.literal("Float Field")) + .binding( + defaults.floatField, + () -> config.floatField, + value -> config.floatField = value + ) + .controller(FloatFieldController::new) + .build()) + .option(Option.createBuilder(int.class) + .name(Component.literal("Integer Field")) + .binding( + defaults.intField, + () -> config.intField, + value -> config.intField = value + ) + .controller(IntegerFieldController::new) + .build()) + .option(Option.createBuilder(long.class) + .name(Component.literal("Long Field")) + .binding( + defaults.longField, + () -> config.longField, + value -> config.longField = value + ) + .controller(LongFieldController::new) + .build()) + .build()) + .group(OptionGroup.createBuilder() + .name(Component.literal("Enum Controllers")) + .option(Option.createBuilder(ConfigTest.Alphabet.class) + .name(Component.literal("Enum Cycler")) + .binding( + defaults.enumOption, + () -> config.enumOption, + (value) -> config.enumOption = value + ) + .controller(EnumController::new) + .build()) + .build()) + .group(OptionGroup.createBuilder() + .name(Component.literal("Options that aren't really options")) + .option(ButtonOption.createBuilder() + .name(Component.literal("Button \"Option\"")) + .action((screen, opt) -> SystemToast.add(Minecraft.getInstance().getToasts(), SystemToast.SystemToastIds.TUTORIAL_HINT, Component.literal("Button Pressed"), Component.literal("Button option was invoked!"))) + .controller(ActionController::new) + .build()) + .option(LabelOption.create( + Component.empty() + .append(Component.literal("a").withStyle(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("a"))))) + .append(Component.literal("b").withStyle(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("b"))))) + .append(Component.literal("c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c").withStyle(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("c"))))) + .append(Component.literal("e").withStyle(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("e"))))) + .withStyle(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://isxander.dev")))) + ) + .build()) + .group(OptionGroup.createBuilder() + .name(Component.literal("Minecraft Bindings")) + .tooltip(Component.literal("YACL can also bind Minecraft options!")) + .option(Option.createBuilder(boolean.class) + .name(Component.literal("Minecraft AutoJump")) + .tooltip(Component.literal("You can even bind minecraft options!")) + .binding(Binding.minecraft(Minecraft.getInstance().options.autoJump())) + .controller(TickBoxController::new) + .build()) + .option(Option.createBuilder(GraphicsStatus.class) + .name(Component.literal("Minecraft Graphics Mode")) + .binding(Binding.minecraft(Minecraft.getInstance().options.graphicsMode())) + .controller(EnumController::new) + .build()) + .build()) + .build()) + .category(ConfigCategory.createBuilder() + .name(Component.literal("List Test")) + .group(ListOption.createBuilder(String.class) + .name(Component.literal("String List")) + .binding( + defaults.stringList, + () -> config.stringList, + val -> config.stringList = val + ) + .controller(StringController::new) + .initial("") + .build()) + .group(ListOption.createBuilder(Integer.class) + .name(Component.literal("Slider List")) + .binding( + defaults.intList, + () -> config.intList, + val -> config.intList = val + ) + .controller(opt -> new IntegerSliderController(opt, 0, 10, 1)) + .initial(0) + .available(false) + .build()) + .group(ListOption.createBuilder(Component.class) + .name(Component.literal("Useless Label List")) + .binding(Binding.immutable(List.of(Component.literal("It's quite impressive that literally every single controller works, without problem.")))) + .controller(LabelController::new) + .initial(Component.literal("Initial label")) + .build()) + .build()) + .category(PlaceholderCategory.createBuilder() + .name(Component.literal("Placeholder Category")) + .screen((client, yaclScreen) -> new RequireRestartScreen(yaclScreen)) + .build()) + .category(ConfigCategory.createBuilder() + .name(Component.literal("Group Test")) + .option(Option.createBuilder(boolean.class) + .name(Component.literal("Root Test")) + .binding( + defaults.groupTestRoot, + () -> config.groupTestRoot, + value -> config.groupTestRoot = value + ) + .controller(TickBoxController::new) + .build()) + .group(OptionGroup.createBuilder() + .name(Component.literal("First Group")) + .option(Option.createBuilder(boolean.class) + .name(Component.literal("First Group Test 1")) + .binding( + defaults.groupTestFirstGroup, + () -> config.groupTestFirstGroup, + value -> config.groupTestFirstGroup = value + ) + .controller(TickBoxController::new) + .build()) + .option(Option.createBuilder(boolean.class) + .name(Component.literal("First Group Test 2")) + .binding( + defaults.groupTestFirstGroup2, + () -> config.groupTestFirstGroup2, + value -> config.groupTestFirstGroup2 = value + ) + .controller(TickBoxController::new) + .build()) + .build()) + .group(OptionGroup.createBuilder() + .name(Component.empty()) + .option(Option.createBuilder(boolean.class) + .name(Component.literal("Second Group Test")) + .binding( + defaults.groupTestSecondGroup, + () -> config.groupTestSecondGroup, + value -> config.groupTestSecondGroup = value + ) + .controller(TickBoxController::new) + .build()) + .build()) + .build()) + .category(ConfigCategory.createBuilder() + .name(Component.literal("Scroll Test")) + .option(Option.createBuilder(int.class) + .name(Component.literal("Int Slider that is cut off because the slider")) + .binding( + defaults.scrollingSlider, + () -> config.scrollingSlider, + (value) -> config.scrollingSlider = value + ) + .controller(opt -> new IntegerSliderController(opt, 0, 10, 1)) + .build()) + .option(ButtonOption.createBuilder() + .name(Component.literal("Option")) + .action((screen, opt) -> { + }) + .controller(ActionController::new) + .build()) + .option(ButtonOption.createBuilder() + .name(Component.literal("Option")) + .action((screen, opt) -> { + }) + .controller(ActionController::new) + .build()) + .option(ButtonOption.createBuilder() + .name(Component.literal("Option")) + .action((screen, opt) -> { + }) + .controller(ActionController::new) + .build()) + .option(ButtonOption.createBuilder() + .name(Component.literal("Option")) + .action((screen, opt) -> { + }) + .controller(ActionController::new) + .build()) + .option(ButtonOption.createBuilder() + .name(Component.literal("Option")) + .action((screen, opt) -> { + }) + .controller(ActionController::new) + .build()) + .option(ButtonOption.createBuilder() + .name(Component.literal("Option")) + .action((screen, opt) -> { + }) + .controller(ActionController::new) + .build()) + .option(ButtonOption.createBuilder() + .name(Component.literal("Option")) + .action((screen, opt) -> { + }) + .controller(ActionController::new) + .build()) + .option(ButtonOption.createBuilder() + .name(Component.literal("Option")) + .action((screen, opt) -> { + }) + .controller(ActionController::new) + .build()) + .option(ButtonOption.createBuilder() + .name(Component.literal("Option")) + .action((screen, opt) -> { + }) + .controller(ActionController::new) + .build()) + .option(ButtonOption.createBuilder() + .name(Component.literal("Option")) + .action((screen, opt) -> { + }) + .controller(ActionController::new) + .build()) + .option(ButtonOption.createBuilder() + .name(Component.literal("Option")) + .action((screen, opt) -> { + }) + .controller(ActionController::new) + .build()) + .option(ButtonOption.createBuilder() + .name(Component.literal("Option")) + .action((screen, opt) -> { + }) + .controller(ActionController::new) + .build()) + .option(ButtonOption.createBuilder() + .name(Component.literal("Option")) + .action((screen, opt) -> { + }) + .controller(ActionController::new) + .build()) + .build()) + .category(ConfigCategory.createBuilder() + .name(Component.literal("Category Test")) + .build()) + .category(ConfigCategory.createBuilder() + .name(Component.literal("Category Test")) + .build()) + .category(ConfigCategory.createBuilder() + .name(Component.literal("Category Test")) + .build()) + .category(ConfigCategory.createBuilder() + .name(Component.literal("Category Test")) + .build()) + .category(ConfigCategory.createBuilder() + .name(Component.literal("Category Test")) + .build()) + .category(ConfigCategory.createBuilder() + .name(Component.literal("Category Test")) + .build()) + .category(ConfigCategory.createBuilder() + .name(Component.literal("Category Test")) + .build()) + .category(ConfigCategory.createBuilder() + .name(Component.literal("Category Test")) + .build()) + .save(() -> { + Minecraft.getInstance().options.save(); + ConfigTest.GSON.save(); + }) + ) + .generateScreen(parent); + } + + private static boolean myBooleanOption = true; + + private static Screen getWikiGetStarted(Screen parent) { + return YetAnotherConfigLib.createBuilder() + .title(Component.literal("Used for narration. Could be used to render a title in the future.")) + .category(ConfigCategory.createBuilder() + .name(Component.literal("Name of the category")) + .tooltip(Component.literal("This Component will appear as a tooltip when you hover or focus the button with Tab. There is no need to add \n to wrap as YACL will do it for you.")) + .group(OptionGroup.createBuilder() + .name(Component.literal("Name of the group")) + .tooltip(Component.literal("This Component will appear when you hover over the name or focus on the collapse button with Tab.")) + .option(Option.createBuilder(boolean.class) + .name(Component.literal("Boolean Option")) + .tooltip(Component.literal("This Component will appear as a tooltip when you hover over the option.")) + .binding(true, () -> myBooleanOption, newVal -> myBooleanOption = newVal) + .controller(TickBoxController::new) + .build()) + .build()) + .build()) + .build() + .generateScreen(parent); + } +} diff --git a/test-fabric/.gitignore b/test-fabric/.gitignore new file mode 100644 index 0000000..b63da45 --- /dev/null +++ b/test-fabric/.gitignore @@ -0,0 +1,42 @@ +.gradle +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store
\ No newline at end of file diff --git a/test-fabric/build.gradle.kts b/test-fabric/build.gradle.kts new file mode 100644 index 0000000..1d2d5fd --- /dev/null +++ b/test-fabric/build.gradle.kts @@ -0,0 +1,57 @@ +plugins { + alias(libs.plugins.architectury.loom) + alias(libs.plugins.shadow) +} + +architectury { + platformSetupLoomIde() + fabric() +} + +loom { + silentMojangMappingsLicense() + + accessWidenerPath.set(project(":common").loom.accessWidenerPath) +} + +val common by configurations.registering +val shadowCommon by configurations.registering +configurations.compileClasspath.get().extendsFrom(common.get()) +configurations["developmentFabric"].extendsFrom(common.get()) + +val minecraftVersion = libs.versions.minecraft.get() + +dependencies { + minecraft(libs.minecraft) + mappings(loom.layered { + mappings("org.quiltmc:quilt-mappings:$minecraftVersion+build.${libs.versions.quilt.mappings.get()}:intermediary-v2") + officialMojangMappings() + }) + modImplementation(libs.fabric.loader) + + "common"(project(path = ":test-common", configuration = "namedElements")) { isTransitive = false } + implementation(project(path = ":fabric", configuration = "namedElements")) + + "common"(project(path = ":common", configuration = "namedElements")) { isTransitive = false } +} + +tasks { + shadowJar { + exclude("architectury.common.json") + + configurations = listOf(shadowCommon.get()) + archiveClassifier.set("dev-shadow") + } + + remapJar { + injectAccessWidener.set(true) + inputFile.set(shadowJar.get().archiveFile) + dependsOn(shadowJar) + + archiveClassifier.set("fabric-$minecraftVersion") + } + + jar { + archiveClassifier.set("dev") + } +} diff --git a/test-fabric/src/main/java/dev/isxander/yacl/test/fabric/ModMenuEntrypoint.java b/test-fabric/src/main/java/dev/isxander/yacl/test/fabric/ModMenuEntrypoint.java new file mode 100644 index 0000000..b2dc876 --- /dev/null +++ b/test-fabric/src/main/java/dev/isxander/yacl/test/fabric/ModMenuEntrypoint.java @@ -0,0 +1,12 @@ +package dev.isxander.yacl.test.fabric; + +import com.terraformersmc.modmenu.api.ConfigScreenFactory; +import com.terraformersmc.modmenu.api.ModMenuApi; +import dev.isxander.yacl.test.GuiTest; + +public class ModMenuEntrypoint implements ModMenuApi { + @Override + public ConfigScreenFactory<?> getModConfigScreenFactory() { + return GuiTest::getModConfigScreenFactory; + } +} diff --git a/test-fabric/src/main/resources/fabric.mod.json b/test-fabric/src/main/resources/fabric.mod.json new file mode 100644 index 0000000..15e28a4 --- /dev/null +++ b/test-fabric/src/main/resources/fabric.mod.json @@ -0,0 +1,13 @@ +{ + "schemaVersion": 1, + "id": "yacl_test", + "version": "1", + "name": "YACL Test", + "license": "LGPL-3.0-or-later", + "environment": "*", + "entrypoints": { + "modmenu": [ + "dev.isxander.yacl.test.fabric.ModMenuEntrypoint" + ] + } +} diff --git a/test-forge/.gitignore b/test-forge/.gitignore new file mode 100644 index 0000000..b63da45 --- /dev/null +++ b/test-forge/.gitignore @@ -0,0 +1,42 @@ +.gradle +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store
\ No newline at end of file diff --git a/test-forge/build.gradle.kts b/test-forge/build.gradle.kts new file mode 100644 index 0000000..5f98b90 --- /dev/null +++ b/test-forge/build.gradle.kts @@ -0,0 +1,63 @@ +plugins { + alias(libs.plugins.architectury.loom) + alias(libs.plugins.shadow) +} + +architectury { + platformSetupLoomIde() + forge() +} + +loom { + silentMojangMappingsLicense() + + accessWidenerPath.set(project(":common").loom.accessWidenerPath) + + forge { + convertAccessWideners.set(true) + extraAccessWideners.add(loom.accessWidenerPath.get().asFile.name) + } +} + +val common by configurations.registering +val shadowCommon by configurations.registering +configurations.compileClasspath.get().extendsFrom(common.get()) +configurations["developmentForge"].extendsFrom(common.get()) + +val minecraftVersion: String = libs.versions.minecraft.get() + +dependencies { + minecraft(libs.minecraft) + mappings(loom.layered { + mappings("org.quiltmc:quilt-mappings:$minecraftVersion+build.${libs.versions.quilt.mappings.get()}:intermediary-v2") + officialMojangMappings() + }) + forge(libs.forge) + + "common"(project(path = ":test-common", configuration = "namedElements")) { isTransitive = false } + implementation(project(path = ":forge", configuration = "namedElements")) + + "common"(project(path = ":common", configuration = "namedElements")) { isTransitive = false } +} + +tasks { + shadowJar { + exclude("fabric.mod.json") + exclude("architectury.common.json") + + configurations = listOf(shadowCommon.get()) + archiveClassifier.set("dev-shadow") + } + + remapJar { + injectAccessWidener.set(true) + inputFile.set(shadowJar.get().archiveFile) + dependsOn(shadowJar) + + archiveClassifier.set("forge-$minecraftVersion") + } + + jar { + archiveClassifier.set("dev") + } +} diff --git a/test-forge/gradle.properties b/test-forge/gradle.properties new file mode 100644 index 0000000..32f842a --- /dev/null +++ b/test-forge/gradle.properties @@ -0,0 +1 @@ +loom.platform=forge
\ No newline at end of file diff --git a/test-forge/src/main/java/dev/isxander/yacl/test/forge/ForgeTest.java b/test-forge/src/main/java/dev/isxander/yacl/test/forge/ForgeTest.java new file mode 100644 index 0000000..182c4a9 --- /dev/null +++ b/test-forge/src/main/java/dev/isxander/yacl/test/forge/ForgeTest.java @@ -0,0 +1,18 @@ +package dev.isxander.yacl.test.forge; + +import dev.isxander.yacl.test.GuiTest; +import net.minecraftforge.client.ConfigScreenHandler; +import net.minecraftforge.fml.ModLoadingContext; +import net.minecraftforge.fml.common.Mod; + +@Mod("yacl_test") +public class ForgeTest { + public ForgeTest() { + ModLoadingContext.get().registerExtensionPoint( + ConfigScreenHandler.ConfigScreenFactory.class, + () -> new ConfigScreenHandler.ConfigScreenFactory( + (minecraft, parent) -> GuiTest.getModConfigScreenFactory(parent) + ) + ); + } +} diff --git a/test-forge/src/main/resources/META-INF/mods.toml b/test-forge/src/main/resources/META-INF/mods.toml new file mode 100644 index 0000000..f4f57d0 --- /dev/null +++ b/test-forge/src/main/resources/META-INF/mods.toml @@ -0,0 +1,28 @@ +modLoader = "javafml" +loaderVersion = "[45,)" +#issueTrackerURL = "" +license = "LGPL-3.0-or-later" + +[[mods]] +modId = "yacl_test" +version = "1" +displayName = "YACL Test" +authors = "isXander" +description = ''' +Test mod for YACL +''' +#logoFile = "" + +[[dependencies.yacl_test]] +modId = "forge" +mandatory = true +versionRange = "[45,)" +ordering = "NONE" +side = "BOTH" + +[[dependencies.yacl_test]] +modId = "minecraft" +mandatory = true +versionRange = "[1.19.4,)" +ordering = "NONE" +side = "BOTH" diff --git a/test-forge/src/main/resources/pack.mcmeta b/test-forge/src/main/resources/pack.mcmeta new file mode 100644 index 0000000..8fbe236 --- /dev/null +++ b/test-forge/src/main/resources/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack": { + "description": "Test YACL", + "pack_format": 14 + } +} |