diff --git a/Common/src/main/java/mezz/jei/common/gui/elements/package-info.java b/Common/src/main/java/mezz/jei/common/gui/elements/package-info.java index 1546ed732..260f84cbf 100644 --- a/Common/src/main/java/mezz/jei/common/gui/elements/package-info.java +++ b/Common/src/main/java/mezz/jei/common/gui/elements/package-info.java @@ -4,4 +4,4 @@ import javax.annotation.ParametersAreNonnullByDefault; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; diff --git a/Common/src/main/java/mezz/jei/common/network/packets/PacketGiveItemStack.java b/Common/src/main/java/mezz/jei/common/network/packets/PacketGiveItemStack.java index d32b0479f..b72fc4c79 100644 --- a/Common/src/main/java/mezz/jei/common/network/packets/PacketGiveItemStack.java +++ b/Common/src/main/java/mezz/jei/common/network/packets/PacketGiveItemStack.java @@ -4,7 +4,7 @@ import mezz.jei.common.network.PacketIdServer; import mezz.jei.common.network.ServerPacketContext; import mezz.jei.common.network.ServerPacketData; -import mezz.jei.core.config.GiveMode; +import mezz.jei.api.config.GiveMode; import mezz.jei.common.util.ServerCommandUtil; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.MinecraftServer; diff --git a/Common/src/main/java/mezz/jei/common/util/ServerCommandUtil.java b/Common/src/main/java/mezz/jei/common/util/ServerCommandUtil.java index f0181892f..63ba05726 100644 --- a/Common/src/main/java/mezz/jei/common/util/ServerCommandUtil.java +++ b/Common/src/main/java/mezz/jei/common/util/ServerCommandUtil.java @@ -6,7 +6,7 @@ import mezz.jei.common.network.IConnectionToClient; import mezz.jei.common.network.ServerPacketContext; import mezz.jei.common.network.packets.PacketCheatPermission; -import mezz.jei.core.config.GiveMode; +import mezz.jei.api.config.GiveMode; import mezz.jei.core.config.IServerConfig; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; diff --git a/Core/src/main/java/mezz/jei/core/FieldsAndMethodsAreNonnullByDefault.java b/CommonApi/src/main/java/mezz/jei/api/FieldsAndMethodsAreNonnullByDefault.java similarity index 94% rename from Core/src/main/java/mezz/jei/core/FieldsAndMethodsAreNonnullByDefault.java rename to CommonApi/src/main/java/mezz/jei/api/FieldsAndMethodsAreNonnullByDefault.java index ea2ab14d5..42fec5148 100644 --- a/Core/src/main/java/mezz/jei/core/FieldsAndMethodsAreNonnullByDefault.java +++ b/CommonApi/src/main/java/mezz/jei/api/FieldsAndMethodsAreNonnullByDefault.java @@ -1,4 +1,4 @@ -package mezz.jei.core; +package mezz.jei.api; import javax.annotation.Nonnull; import javax.annotation.meta.TypeQualifierDefault; diff --git a/Core/src/main/java/mezz/jei/core/config/GiveMode.java b/CommonApi/src/main/java/mezz/jei/api/config/GiveMode.java similarity index 79% rename from Core/src/main/java/mezz/jei/core/config/GiveMode.java rename to CommonApi/src/main/java/mezz/jei/api/config/GiveMode.java index 32bc52c44..e0726e106 100644 --- a/Core/src/main/java/mezz/jei/core/config/GiveMode.java +++ b/CommonApi/src/main/java/mezz/jei/api/config/GiveMode.java @@ -1,4 +1,4 @@ -package mezz.jei.core.config; +package mezz.jei.api.config; public enum GiveMode { INVENTORY, MOUSE_PICKUP; diff --git a/Gui/src/main/java/mezz/jei/gui/config/IClientConfig.java b/CommonApi/src/main/java/mezz/jei/api/config/IClientConfig.java similarity index 65% rename from Gui/src/main/java/mezz/jei/gui/config/IClientConfig.java rename to CommonApi/src/main/java/mezz/jei/api/config/IClientConfig.java index d8cf34763..a7df22504 100644 --- a/Gui/src/main/java/mezz/jei/gui/config/IClientConfig.java +++ b/CommonApi/src/main/java/mezz/jei/api/config/IClientConfig.java @@ -1,9 +1,6 @@ -package mezz.jei.gui.config; +package mezz.jei.api.config; -import mezz.jei.core.config.GiveMode; -import mezz.jei.core.config.IngredientSortStage; - -import java.util.List; +import java.util.stream.Stream; public interface IClientConfig { int minRecipeGuiHeight = 175; @@ -22,5 +19,5 @@ public interface IClientConfig { int getMaxRecipeGuiHeight(); - List getIngredientSorterStages(); + Stream getIngredientSorterStages(); } diff --git a/Gui/src/main/java/mezz/jei/gui/config/IJeiClientConfigs.java b/CommonApi/src/main/java/mezz/jei/api/config/IClientConfigs.java similarity index 75% rename from Gui/src/main/java/mezz/jei/gui/config/IJeiClientConfigs.java rename to CommonApi/src/main/java/mezz/jei/api/config/IClientConfigs.java index bfc05e6a1..0c92f5894 100644 --- a/Gui/src/main/java/mezz/jei/gui/config/IJeiClientConfigs.java +++ b/CommonApi/src/main/java/mezz/jei/api/config/IClientConfigs.java @@ -1,6 +1,6 @@ -package mezz.jei.gui.config; +package mezz.jei.api.config; -public interface IJeiClientConfigs { +public interface IClientConfigs { IClientConfig getClientConfig(); IIngredientFilterConfig getIngredientFilterConfig(); diff --git a/Gui/src/main/java/mezz/jei/gui/config/IIngredientFilterConfig.java b/CommonApi/src/main/java/mezz/jei/api/config/IIngredientFilterConfig.java similarity index 81% rename from Gui/src/main/java/mezz/jei/gui/config/IIngredientFilterConfig.java rename to CommonApi/src/main/java/mezz/jei/api/config/IIngredientFilterConfig.java index 6a00bbd58..e3ed9b35d 100644 --- a/Gui/src/main/java/mezz/jei/gui/config/IIngredientFilterConfig.java +++ b/CommonApi/src/main/java/mezz/jei/api/config/IIngredientFilterConfig.java @@ -1,6 +1,4 @@ -package mezz.jei.gui.config; - -import mezz.jei.core.search.SearchMode; +package mezz.jei.api.config; public interface IIngredientFilterConfig { SearchMode getModNameSearchMode(); diff --git a/CommonApi/src/main/java/mezz/jei/api/config/IIngredientGridConfig.java b/CommonApi/src/main/java/mezz/jei/api/config/IIngredientGridConfig.java new file mode 100644 index 000000000..53953bd4e --- /dev/null +++ b/CommonApi/src/main/java/mezz/jei/api/config/IIngredientGridConfig.java @@ -0,0 +1,28 @@ +package mezz.jei.api.config; + +import mezz.jei.api.config.gui.HorizontalAlignment; +import mezz.jei.api.config.gui.NavigationVisibility; +import mezz.jei.api.config.gui.VerticalAlignment; + +public interface IIngredientGridConfig { + int minNumRows = 1; + int defaultNumRows = 48; + int largestNumRows = 100; + + int minNumColumns = 4; + int defaultNumColumns = 9; + int largestNumColumns = 100; + + VerticalAlignment defaultVerticalAlignment = VerticalAlignment.TOP; + NavigationVisibility defaultButtonNavigationVisibility = NavigationVisibility.ENABLED; + boolean defaultDrawBackground = false; + + int getMaxColumns(); + int getMinColumns(); + int getMaxRows(); + int getMinRows(); + boolean drawBackground(); + HorizontalAlignment getHorizontalAlignment(); + VerticalAlignment getVerticalAlignment(); + NavigationVisibility getButtonNavigationVisibility(); +} diff --git a/Core/src/main/java/mezz/jei/core/config/IngredientSortStage.java b/CommonApi/src/main/java/mezz/jei/api/config/IngredientSortStage.java similarity index 52% rename from Core/src/main/java/mezz/jei/core/config/IngredientSortStage.java rename to CommonApi/src/main/java/mezz/jei/api/config/IngredientSortStage.java index 8a6192de7..99f44e9ab 100644 --- a/Core/src/main/java/mezz/jei/core/config/IngredientSortStage.java +++ b/CommonApi/src/main/java/mezz/jei/api/config/IngredientSortStage.java @@ -1,4 +1,4 @@ -package mezz.jei.core.config; +package mezz.jei.api.config; import java.util.List; @@ -10,4 +10,14 @@ public enum IngredientSortStage { IngredientSortStage.INGREDIENT_TYPE, IngredientSortStage.CREATIVE_MENU ); + public static final List defaultStagesNames = defaultStages.stream().map(stage -> stage.name()).toList(); + + public static boolean isValidName(String name) { + try { + valueOf(name); + return true; + } catch (IllegalArgumentException e) { + return false; + } + } } diff --git a/Core/src/main/java/mezz/jei/core/search/SearchMode.java b/CommonApi/src/main/java/mezz/jei/api/config/SearchMode.java similarity index 67% rename from Core/src/main/java/mezz/jei/core/search/SearchMode.java rename to CommonApi/src/main/java/mezz/jei/api/config/SearchMode.java index 738bd64ee..17fbda908 100644 --- a/Core/src/main/java/mezz/jei/core/search/SearchMode.java +++ b/CommonApi/src/main/java/mezz/jei/api/config/SearchMode.java @@ -1,4 +1,4 @@ -package mezz.jei.core.search; +package mezz.jei.api.config; public enum SearchMode { ENABLED, REQUIRE_PREFIX, DISABLED diff --git a/Gui/src/main/java/mezz/jei/gui/util/HorizontalAlignment.java b/CommonApi/src/main/java/mezz/jei/api/config/gui/HorizontalAlignment.java similarity index 63% rename from Gui/src/main/java/mezz/jei/gui/util/HorizontalAlignment.java rename to CommonApi/src/main/java/mezz/jei/api/config/gui/HorizontalAlignment.java index 70710f8cf..be0dfa8dc 100644 --- a/Gui/src/main/java/mezz/jei/gui/util/HorizontalAlignment.java +++ b/CommonApi/src/main/java/mezz/jei/api/config/gui/HorizontalAlignment.java @@ -1,4 +1,4 @@ -package mezz.jei.gui.util; +package mezz.jei.api.config.gui; public enum HorizontalAlignment { LEFT, CENTER, RIGHT diff --git a/Gui/src/main/java/mezz/jei/gui/overlay/options/NavigationVisibility.java b/CommonApi/src/main/java/mezz/jei/api/config/gui/NavigationVisibility.java similarity index 64% rename from Gui/src/main/java/mezz/jei/gui/overlay/options/NavigationVisibility.java rename to CommonApi/src/main/java/mezz/jei/api/config/gui/NavigationVisibility.java index 7577dc570..a08720d75 100644 --- a/Gui/src/main/java/mezz/jei/gui/overlay/options/NavigationVisibility.java +++ b/CommonApi/src/main/java/mezz/jei/api/config/gui/NavigationVisibility.java @@ -1,4 +1,4 @@ -package mezz.jei.gui.overlay.options; +package mezz.jei.api.config.gui; public enum NavigationVisibility { ENABLED, AUTO_HIDE, DISABLED diff --git a/Gui/src/main/java/mezz/jei/gui/util/VerticalAlignment.java b/CommonApi/src/main/java/mezz/jei/api/config/gui/VerticalAlignment.java similarity index 62% rename from Gui/src/main/java/mezz/jei/gui/util/VerticalAlignment.java rename to CommonApi/src/main/java/mezz/jei/api/config/gui/VerticalAlignment.java index a6c09a294..7fec742e1 100644 --- a/Gui/src/main/java/mezz/jei/gui/util/VerticalAlignment.java +++ b/CommonApi/src/main/java/mezz/jei/api/config/gui/VerticalAlignment.java @@ -1,4 +1,4 @@ -package mezz.jei.gui.util; +package mezz.jei.api.config.gui; public enum VerticalAlignment { TOP, CENTER, BOTTOM diff --git a/CommonApi/src/main/java/mezz/jei/api/config/gui/package-info.java b/CommonApi/src/main/java/mezz/jei/api/config/gui/package-info.java new file mode 100644 index 000000000..16fd21213 --- /dev/null +++ b/CommonApi/src/main/java/mezz/jei/api/config/gui/package-info.java @@ -0,0 +1,8 @@ +@ParametersAreNonnullByDefault +@FieldsAndMethodsAreNonnullByDefault +package mezz.jei.api.config.gui; + + +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Gui/src/main/java/mezz/jei/gui/overlay/options/package-info.java b/CommonApi/src/main/java/mezz/jei/api/config/package-info.java similarity index 81% rename from Gui/src/main/java/mezz/jei/gui/overlay/options/package-info.java rename to CommonApi/src/main/java/mezz/jei/api/config/package-info.java index 84d21b318..0621c7927 100644 --- a/Gui/src/main/java/mezz/jei/gui/overlay/options/package-info.java +++ b/CommonApi/src/main/java/mezz/jei/api/config/package-info.java @@ -1,6 +1,6 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -package mezz.jei.gui.overlay.options; +package mezz.jei.api.config; import net.minecraft.MethodsReturnNonnullByDefault; diff --git a/CommonApi/src/main/java/mezz/jei/api/registration/IRuntimeRegistration.java b/CommonApi/src/main/java/mezz/jei/api/registration/IRuntimeRegistration.java index c3fa35dc2..80aa35cd7 100644 --- a/CommonApi/src/main/java/mezz/jei/api/registration/IRuntimeRegistration.java +++ b/CommonApi/src/main/java/mezz/jei/api/registration/IRuntimeRegistration.java @@ -1,5 +1,6 @@ package mezz.jei.api.registration; +import mezz.jei.api.config.IClientConfigs; import mezz.jei.api.helpers.IJeiHelpers; import mezz.jei.api.recipe.IRecipeManager; import mezz.jei.api.recipe.transfer.IRecipeTransferManager; @@ -88,4 +89,7 @@ public interface IRuntimeRegistration { * This is used by JEI's GUI and can be used by other mods that want to use the same information from JEI. */ IEditModeConfig getEditModeConfig(); + + // TODO: docs + IClientConfigs getClientConfigs(); } diff --git a/Core/build.gradle.kts b/Core/build.gradle.kts index f52a128df..281cab30b 100644 --- a/Core/build.gradle.kts +++ b/Core/build.gradle.kts @@ -34,6 +34,7 @@ dependencies { name = "log4j-api", version = "2.17.0" ) + implementation(project(mapOf("path" to ":CommonApi"))) testImplementation( group = "org.junit.jupiter", name = "junit-jupiter-api", diff --git a/Core/src/main/java/mezz/jei/core/collect/package-info.java b/Core/src/main/java/mezz/jei/core/collect/package-info.java index 0b71fade5..65fbb31f7 100644 --- a/Core/src/main/java/mezz/jei/core/collect/package-info.java +++ b/Core/src/main/java/mezz/jei/core/collect/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.core.collect; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Core/src/main/java/mezz/jei/core/config/file/package-info.java b/Core/src/main/java/mezz/jei/core/config/file/package-info.java index 9c25cc75b..16666cd6e 100644 --- a/Core/src/main/java/mezz/jei/core/config/file/package-info.java +++ b/Core/src/main/java/mezz/jei/core/config/file/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.core.config.file; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Core/src/main/java/mezz/jei/core/config/file/serializers/package-info.java b/Core/src/main/java/mezz/jei/core/config/file/serializers/package-info.java index 385287f6e..3b0bad92a 100644 --- a/Core/src/main/java/mezz/jei/core/config/file/serializers/package-info.java +++ b/Core/src/main/java/mezz/jei/core/config/file/serializers/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.core.config.file.serializers; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Core/src/main/java/mezz/jei/core/config/package-info.java b/Core/src/main/java/mezz/jei/core/config/package-info.java index ea541c7e3..853836590 100644 --- a/Core/src/main/java/mezz/jei/core/config/package-info.java +++ b/Core/src/main/java/mezz/jei/core/config/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.core.config; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Core/src/main/java/mezz/jei/core/config/sorting/package-info.java b/Core/src/main/java/mezz/jei/core/config/sorting/package-info.java index 836edd3f2..1ca5117d0 100644 --- a/Core/src/main/java/mezz/jei/core/config/sorting/package-info.java +++ b/Core/src/main/java/mezz/jei/core/config/sorting/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.core.config.sorting; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Core/src/main/java/mezz/jei/core/config/sorting/serializers/package-info.java b/Core/src/main/java/mezz/jei/core/config/sorting/serializers/package-info.java index 7eaa9ba0f..c4f7b6666 100644 --- a/Core/src/main/java/mezz/jei/core/config/sorting/serializers/package-info.java +++ b/Core/src/main/java/mezz/jei/core/config/sorting/serializers/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.core.config.sorting.serializers; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Core/src/main/java/mezz/jei/core/package-info.java b/Core/src/main/java/mezz/jei/core/package-info.java index 3f1905a52..32dd22eb6 100644 --- a/Core/src/main/java/mezz/jei/core/package-info.java +++ b/Core/src/main/java/mezz/jei/core/package-info.java @@ -2,4 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.core; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; + import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Core/src/main/java/mezz/jei/core/search/CombinedSearchables.java b/Core/src/main/java/mezz/jei/core/search/CombinedSearchables.java index f18067f6e..474b1b17e 100644 --- a/Core/src/main/java/mezz/jei/core/search/CombinedSearchables.java +++ b/Core/src/main/java/mezz/jei/core/search/CombinedSearchables.java @@ -1,5 +1,7 @@ package mezz.jei.core.search; +import mezz.jei.api.config.SearchMode; + import java.util.ArrayList; import java.util.List; import java.util.Set; diff --git a/Core/src/main/java/mezz/jei/core/search/ISearchable.java b/Core/src/main/java/mezz/jei/core/search/ISearchable.java index 0ca4c4348..24bcd437f 100644 --- a/Core/src/main/java/mezz/jei/core/search/ISearchable.java +++ b/Core/src/main/java/mezz/jei/core/search/ISearchable.java @@ -1,5 +1,7 @@ package mezz.jei.core.search; +import mezz.jei.api.config.SearchMode; + import java.util.Set; public interface ISearchable { diff --git a/Core/src/main/java/mezz/jei/core/search/PrefixInfo.java b/Core/src/main/java/mezz/jei/core/search/PrefixInfo.java index eccbe867b..38eb13961 100644 --- a/Core/src/main/java/mezz/jei/core/search/PrefixInfo.java +++ b/Core/src/main/java/mezz/jei/core/search/PrefixInfo.java @@ -1,5 +1,6 @@ package mezz.jei.core.search; +import mezz.jei.api.config.SearchMode; import org.jetbrains.annotations.Unmodifiable; import java.util.Collection; diff --git a/Core/src/main/java/mezz/jei/core/search/PrefixedSearchable.java b/Core/src/main/java/mezz/jei/core/search/PrefixedSearchable.java index 28e14f720..409b20ff8 100644 --- a/Core/src/main/java/mezz/jei/core/search/PrefixedSearchable.java +++ b/Core/src/main/java/mezz/jei/core/search/PrefixedSearchable.java @@ -1,5 +1,7 @@ package mezz.jei.core.search; +import mezz.jei.api.config.SearchMode; + import java.util.Collection; import java.util.Set; diff --git a/Core/src/main/java/mezz/jei/core/search/package-info.java b/Core/src/main/java/mezz/jei/core/search/package-info.java index cc1412cd2..bc655e238 100644 --- a/Core/src/main/java/mezz/jei/core/search/package-info.java +++ b/Core/src/main/java/mezz/jei/core/search/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.core.search; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Core/src/main/java/mezz/jei/core/search/suffixtree/package-info.java b/Core/src/main/java/mezz/jei/core/search/suffixtree/package-info.java index 946c5d124..9b5b3bcc0 100644 --- a/Core/src/main/java/mezz/jei/core/search/suffixtree/package-info.java +++ b/Core/src/main/java/mezz/jei/core/search/suffixtree/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.core.search.suffixtree; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Core/src/main/java/mezz/jei/core/util/function/package-info.java b/Core/src/main/java/mezz/jei/core/util/function/package-info.java index 7329498d0..4d0d6a368 100644 --- a/Core/src/main/java/mezz/jei/core/util/function/package-info.java +++ b/Core/src/main/java/mezz/jei/core/util/function/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.core.util.function; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Core/src/main/java/mezz/jei/core/util/package-info.java b/Core/src/main/java/mezz/jei/core/util/package-info.java index b0475e70f..356889085 100644 --- a/Core/src/main/java/mezz/jei/core/util/package-info.java +++ b/Core/src/main/java/mezz/jei/core/util/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.core.util; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Core/src/test/java/mezz/jei/test/search/suffixtree/package-info.java b/Core/src/test/java/mezz/jei/test/search/suffixtree/package-info.java index 00e4c8c9a..7b28f92c8 100644 --- a/Core/src/test/java/mezz/jei/test/search/suffixtree/package-info.java +++ b/Core/src/test/java/mezz/jei/test/search/suffixtree/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.test.search.suffixtree; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Core/src/test/java/mezz/jei/test/util/package-info.java b/Core/src/test/java/mezz/jei/test/util/package-info.java index 191dcd23c..5c679bb25 100644 --- a/Core/src/test/java/mezz/jei/test/util/package-info.java +++ b/Core/src/test/java/mezz/jei/test/util/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.test.util; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Fabric/src/main/java/mezz/jei/fabric/JustEnoughItemsClient.java b/Fabric/src/main/java/mezz/jei/fabric/JustEnoughItemsClient.java index a30b87e05..c1088c34a 100644 --- a/Fabric/src/main/java/mezz/jei/fabric/JustEnoughItemsClient.java +++ b/Fabric/src/main/java/mezz/jei/fabric/JustEnoughItemsClient.java @@ -3,7 +3,9 @@ import mezz.jei.common.Internal; import mezz.jei.common.gui.textures.JeiSpriteUploader; import mezz.jei.common.gui.textures.Textures; +import mezz.jei.common.platform.Services; import mezz.jei.core.config.IServerConfig; +import mezz.jei.fabric.config.ClientConfigs; import mezz.jei.fabric.config.ServerConfig; import mezz.jei.fabric.events.JeiIdentifiableResourceReloadListener; import mezz.jei.fabric.events.JeiLifecycleEvents; @@ -13,7 +15,12 @@ import net.fabricmc.fabric.api.resource.ResourceManagerHelper; import net.minecraft.server.packs.PackType; +import java.nio.file.Path; + public class JustEnoughItemsClient implements ClientModInitializer { + + + @Override public void onInitializeClient() { JeiLifecycleEvents.REGISTER_RESOURCE_RELOAD_LISTENER.register((resourceManager, textureManager) -> { @@ -24,8 +31,11 @@ public void onInitializeClient() { Internal.setTextures(textures); ClientLifecycleEvents.CLIENT_STARTED.register(event -> { + Path configDir = Services.PLATFORM.getConfigHelper().createJeiConfigDir(); + ClientConfigs jeiClientConfigs = new ClientConfigs(configDir.resolve("jei-client.ini")); + IServerConfig serverConfig = ServerConfig.getInstance(); - ClientLifecycleHandler clientLifecycleHandler = new ClientLifecycleHandler(textures, serverConfig); + ClientLifecycleHandler clientLifecycleHandler = new ClientLifecycleHandler(textures, serverConfig, jeiClientConfigs); clientLifecycleHandler.registerEvents(); ResourceManagerHelper.get(PackType.SERVER_DATA) diff --git a/Gui/src/main/java/mezz/jei/gui/config/ClientConfig.java b/Fabric/src/main/java/mezz/jei/fabric/config/ClientConfig.java similarity index 90% rename from Gui/src/main/java/mezz/jei/gui/config/ClientConfig.java rename to Fabric/src/main/java/mezz/jei/fabric/config/ClientConfig.java index b67a0f646..5b6d58ec2 100644 --- a/Gui/src/main/java/mezz/jei/gui/config/ClientConfig.java +++ b/Fabric/src/main/java/mezz/jei/fabric/config/ClientConfig.java @@ -1,16 +1,18 @@ -package mezz.jei.gui.config; +package mezz.jei.fabric.config; import com.google.common.base.Preconditions; +import mezz.jei.api.config.IClientConfig; import mezz.jei.core.config.file.IConfigCategoryBuilder; import mezz.jei.core.config.file.IConfigSchemaBuilder; import mezz.jei.core.config.file.serializers.EnumSerializer; import mezz.jei.core.config.file.serializers.ListSerializer; -import mezz.jei.core.config.GiveMode; -import mezz.jei.core.config.IngredientSortStage; +import mezz.jei.api.config.GiveMode; +import mezz.jei.api.config.IngredientSortStage; import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.function.Supplier; +import java.util.stream.Stream; public final class ClientConfig implements IClientConfig { @Nullable @@ -110,7 +112,7 @@ public int getMaxRecipeGuiHeight() { } @Override - public List getIngredientSorterStages() { - return ingredientSorterStages.get(); + public Stream getIngredientSorterStages() { + return ingredientSorterStages.get().stream(); } } diff --git a/Gui/src/main/java/mezz/jei/gui/config/JeiClientConfigs.java b/Fabric/src/main/java/mezz/jei/fabric/config/ClientConfigs.java similarity index 79% rename from Gui/src/main/java/mezz/jei/gui/config/JeiClientConfigs.java rename to Fabric/src/main/java/mezz/jei/fabric/config/ClientConfigs.java index 1bfda5143..3f5272b7c 100644 --- a/Gui/src/main/java/mezz/jei/gui/config/JeiClientConfigs.java +++ b/Fabric/src/main/java/mezz/jei/fabric/config/ClientConfigs.java @@ -1,14 +1,18 @@ -package mezz.jei.gui.config; +package mezz.jei.fabric.config; +import mezz.jei.api.config.IClientConfig; +import mezz.jei.api.config.IIngredientFilterConfig; +import mezz.jei.api.config.IIngredientGridConfig; +import mezz.jei.api.config.IClientConfigs; import mezz.jei.core.config.file.FileWatcher; -import mezz.jei.gui.util.HorizontalAlignment; +import mezz.jei.api.config.gui.HorizontalAlignment; import mezz.jei.core.config.file.ConfigSchemaBuilder; import mezz.jei.core.config.file.IConfigSchema; import mezz.jei.core.config.file.IConfigSchemaBuilder; import java.nio.file.Path; -public class JeiClientConfigs implements IJeiClientConfigs { +public class ClientConfigs implements IClientConfigs { private final IClientConfig clientConfig; private final IIngredientFilterConfig ingredientFilterConfig; private final IIngredientGridConfig ingredientListConfig; @@ -16,7 +20,7 @@ public class JeiClientConfigs implements IJeiClientConfigs { private final IConfigSchema schema; - public JeiClientConfigs(Path configFile) { + public ClientConfigs(Path configFile) { IConfigSchemaBuilder builder = new ConfigSchemaBuilder(configFile); clientConfig = new ClientConfig(builder); diff --git a/Gui/src/main/java/mezz/jei/gui/config/IngredientFilterConfig.java b/Fabric/src/main/java/mezz/jei/fabric/config/IngredientFilterConfig.java similarity index 95% rename from Gui/src/main/java/mezz/jei/gui/config/IngredientFilterConfig.java rename to Fabric/src/main/java/mezz/jei/fabric/config/IngredientFilterConfig.java index b57aec47e..d86b66d5c 100644 --- a/Gui/src/main/java/mezz/jei/gui/config/IngredientFilterConfig.java +++ b/Fabric/src/main/java/mezz/jei/fabric/config/IngredientFilterConfig.java @@ -1,8 +1,9 @@ -package mezz.jei.gui.config; +package mezz.jei.fabric.config; +import mezz.jei.api.config.IIngredientFilterConfig; import mezz.jei.core.config.file.IConfigCategoryBuilder; import mezz.jei.core.config.file.IConfigSchemaBuilder; -import mezz.jei.core.search.SearchMode; +import mezz.jei.api.config.SearchMode; import java.util.function.Supplier; diff --git a/Gui/src/main/java/mezz/jei/gui/config/IngredientGridConfig.java b/Fabric/src/main/java/mezz/jei/fabric/config/IngredientGridConfig.java similarity index 77% rename from Gui/src/main/java/mezz/jei/gui/config/IngredientGridConfig.java rename to Fabric/src/main/java/mezz/jei/fabric/config/IngredientGridConfig.java index 574c98154..0cd5edbc2 100644 --- a/Gui/src/main/java/mezz/jei/gui/config/IngredientGridConfig.java +++ b/Fabric/src/main/java/mezz/jei/fabric/config/IngredientGridConfig.java @@ -1,26 +1,15 @@ -package mezz.jei.gui.config; +package mezz.jei.fabric.config; -import mezz.jei.gui.util.HorizontalAlignment; -import mezz.jei.gui.overlay.options.NavigationVisibility; -import mezz.jei.gui.util.VerticalAlignment; +import mezz.jei.api.config.IIngredientGridConfig; +import mezz.jei.api.config.gui.HorizontalAlignment; +import mezz.jei.api.config.gui.NavigationVisibility; +import mezz.jei.api.config.gui.VerticalAlignment; import mezz.jei.core.config.file.IConfigCategoryBuilder; import mezz.jei.core.config.file.IConfigSchemaBuilder; import java.util.function.Supplier; public class IngredientGridConfig implements IIngredientGridConfig { - private static final int minNumRows = 1; - private static final int defaultNumRows = 16; - private static final int largestNumRows = 100; - - private static final int minNumColumns = 4; - private static final int defaultNumColumns = 9; - private static final int largestNumColumns = 100; - - private static final VerticalAlignment defaultVerticalAlignment = VerticalAlignment.TOP; - private static final NavigationVisibility defaultButtonNavigationVisibility = NavigationVisibility.ENABLED; - private static final boolean defaultDrawBackground = false; - private final Supplier maxRows; private final Supplier maxColumns; private final Supplier horizontalAlignment; diff --git a/Fabric/src/main/java/mezz/jei/fabric/config/package-info.java b/Fabric/src/main/java/mezz/jei/fabric/config/package-info.java index 4a299eebe..7e5539c92 100644 --- a/Fabric/src/main/java/mezz/jei/fabric/config/package-info.java +++ b/Fabric/src/main/java/mezz/jei/fabric/config/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.fabric.config; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Fabric/src/main/java/mezz/jei/fabric/events/package-info.java b/Fabric/src/main/java/mezz/jei/fabric/events/package-info.java index d878b0e51..ec172a411 100644 --- a/Fabric/src/main/java/mezz/jei/fabric/events/package-info.java +++ b/Fabric/src/main/java/mezz/jei/fabric/events/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.fabric.events; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Fabric/src/main/java/mezz/jei/fabric/ingredients/fluid/package-info.java b/Fabric/src/main/java/mezz/jei/fabric/ingredients/fluid/package-info.java index f8cd8e7de..92845eb78 100644 --- a/Fabric/src/main/java/mezz/jei/fabric/ingredients/fluid/package-info.java +++ b/Fabric/src/main/java/mezz/jei/fabric/ingredients/fluid/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.fabric.ingredients.fluid; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Fabric/src/main/java/mezz/jei/fabric/ingredients/package-info.java b/Fabric/src/main/java/mezz/jei/fabric/ingredients/package-info.java index a6c738724..e6058a759 100644 --- a/Fabric/src/main/java/mezz/jei/fabric/ingredients/package-info.java +++ b/Fabric/src/main/java/mezz/jei/fabric/ingredients/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.fabric.ingredients; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Fabric/src/main/java/mezz/jei/fabric/input/package-info.java b/Fabric/src/main/java/mezz/jei/fabric/input/package-info.java index 8b26c584f..dbb37a889 100644 --- a/Fabric/src/main/java/mezz/jei/fabric/input/package-info.java +++ b/Fabric/src/main/java/mezz/jei/fabric/input/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.fabric.input; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Fabric/src/main/java/mezz/jei/fabric/mixin/package-info.java b/Fabric/src/main/java/mezz/jei/fabric/mixin/package-info.java index 824c4e2c9..4962983e3 100644 --- a/Fabric/src/main/java/mezz/jei/fabric/mixin/package-info.java +++ b/Fabric/src/main/java/mezz/jei/fabric/mixin/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.fabric.mixin; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Fabric/src/main/java/mezz/jei/fabric/network/package-info.java b/Fabric/src/main/java/mezz/jei/fabric/network/package-info.java index ebe09d1f9..85a8c9563 100644 --- a/Fabric/src/main/java/mezz/jei/fabric/network/package-info.java +++ b/Fabric/src/main/java/mezz/jei/fabric/network/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.fabric.network; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Fabric/src/main/java/mezz/jei/fabric/package-info.java b/Fabric/src/main/java/mezz/jei/fabric/package-info.java index 47eff8d0f..50e2b1575 100644 --- a/Fabric/src/main/java/mezz/jei/fabric/package-info.java +++ b/Fabric/src/main/java/mezz/jei/fabric/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.fabric; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Fabric/src/main/java/mezz/jei/fabric/platform/package-info.java b/Fabric/src/main/java/mezz/jei/fabric/platform/package-info.java index 42719a560..032159d66 100644 --- a/Fabric/src/main/java/mezz/jei/fabric/platform/package-info.java +++ b/Fabric/src/main/java/mezz/jei/fabric/platform/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.fabric.platform; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Fabric/src/main/java/mezz/jei/fabric/plugins/fabric/FabricGuiPlugin.java b/Fabric/src/main/java/mezz/jei/fabric/plugins/fabric/FabricGuiPlugin.java index c72a89dfd..950da96c3 100644 --- a/Fabric/src/main/java/mezz/jei/fabric/plugins/fabric/FabricGuiPlugin.java +++ b/Fabric/src/main/java/mezz/jei/fabric/plugins/fabric/FabricGuiPlugin.java @@ -6,6 +6,7 @@ import mezz.jei.api.registration.IRuntimeRegistration; import mezz.jei.api.runtime.IJeiRuntime; import mezz.jei.core.config.file.FileWatcher; +import mezz.jei.fabric.config.ClientConfigs; import mezz.jei.fabric.startup.EventRegistration; import mezz.jei.gui.startup.JeiEventHandlers; import mezz.jei.gui.startup.JeiGuiStarter; @@ -31,7 +32,13 @@ public ResourceLocation getPluginUid() { @Override public void registerRuntime(IRuntimeRegistration registration) { - JeiEventHandlers eventHandlers = JeiGuiStarter.start(registration, fileWatcher); + + var clientConfigs = registration.getClientConfigs(); + + // TODO: This is a hack. When proper config API will be used, this will not be needed. + ((ClientConfigs)clientConfigs).register(fileWatcher); + + JeiEventHandlers eventHandlers = JeiGuiStarter.start(registration, clientConfigs); eventRegistration.setEventHandlers(eventHandlers); fileWatcher.start(); } diff --git a/Fabric/src/main/java/mezz/jei/fabric/plugins/fabric/package-info.java b/Fabric/src/main/java/mezz/jei/fabric/plugins/fabric/package-info.java index d9b38f3f9..dbe1db21b 100644 --- a/Fabric/src/main/java/mezz/jei/fabric/plugins/fabric/package-info.java +++ b/Fabric/src/main/java/mezz/jei/fabric/plugins/fabric/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.fabric.plugins.fabric; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Fabric/src/main/java/mezz/jei/fabric/plugins/package-info.java b/Fabric/src/main/java/mezz/jei/fabric/plugins/package-info.java index 7b6217c18..bcde54be6 100644 --- a/Fabric/src/main/java/mezz/jei/fabric/plugins/package-info.java +++ b/Fabric/src/main/java/mezz/jei/fabric/plugins/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.fabric.plugins; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Fabric/src/main/java/mezz/jei/fabric/startup/ClientLifecycleHandler.java b/Fabric/src/main/java/mezz/jei/fabric/startup/ClientLifecycleHandler.java index 034f0e2d0..a963855db 100644 --- a/Fabric/src/main/java/mezz/jei/fabric/startup/ClientLifecycleHandler.java +++ b/Fabric/src/main/java/mezz/jei/fabric/startup/ClientLifecycleHandler.java @@ -1,6 +1,7 @@ package mezz.jei.fabric.startup; import mezz.jei.api.IModPlugin; +import mezz.jei.api.config.IClientConfigs; import mezz.jei.common.Internal; import mezz.jei.gui.config.InternalKeyMappings; import mezz.jei.common.gui.textures.Textures; @@ -26,7 +27,7 @@ public class ClientLifecycleHandler { private final JeiStarter jeiStarter; private boolean running; - public ClientLifecycleHandler(Textures textures, IServerConfig serverConfig) { + public ClientLifecycleHandler(Textures textures, IServerConfig serverConfig, IClientConfigs clientConfigs) { IConnectionToServer serverConnection = new ConnectionToServer(); Internal.setServerConnection(serverConnection); @@ -42,7 +43,8 @@ public ClientLifecycleHandler(Textures textures, IServerConfig serverConfig) { plugins, textures, serverConnection, - keyMappings + keyMappings, + clientConfigs ); this.jeiStarter = new JeiStarter(startData); diff --git a/Fabric/src/main/java/mezz/jei/fabric/startup/package-info.java b/Fabric/src/main/java/mezz/jei/fabric/startup/package-info.java index 4d2717436..8dd5825f0 100644 --- a/Fabric/src/main/java/mezz/jei/fabric/startup/package-info.java +++ b/Fabric/src/main/java/mezz/jei/fabric/startup/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.fabric.startup; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Forge/build.gradle.kts b/Forge/build.gradle.kts index 95a84dd38..d21874309 100644 --- a/Forge/build.gradle.kts +++ b/Forge/build.gradle.kts @@ -1,5 +1,6 @@ import net.darkhax.curseforgegradle.TaskPublishCurseForge import net.darkhax.curseforgegradle.Constants as CFG_Constants +import java.net.URI; plugins { java @@ -57,6 +58,15 @@ java { withSourcesJar() } +repositories { + maven { + url = URI.create("https://cursemaven.com") + content { + includeGroup("curse.maven") + } + } +} + dependencies { "minecraft"( group = "net.minecraftforge", @@ -76,6 +86,9 @@ dependencies { name = "junit-jupiter-engine", version = jUnitVersion ) + + // https://www.curseforge.com/minecraft/mc-mods/configured/files/4011355 + runtimeOnly(fg.deobf("curse.maven:configured-457570:4011355")) } minecraft { diff --git a/Forge/src/main/java/mezz/jei/forge/JustEnoughItemsClient.java b/Forge/src/main/java/mezz/jei/forge/JustEnoughItemsClient.java index ea00ff84f..77bbf462a 100644 --- a/Forge/src/main/java/mezz/jei/forge/JustEnoughItemsClient.java +++ b/Forge/src/main/java/mezz/jei/forge/JustEnoughItemsClient.java @@ -1,18 +1,20 @@ package mezz.jei.forge; import mezz.jei.api.IModPlugin; +import mezz.jei.api.config.IClientConfigs; import mezz.jei.common.Internal; -import mezz.jei.gui.config.InternalKeyMappings; import mezz.jei.common.gui.textures.JeiSpriteUploader; import mezz.jei.common.gui.textures.Textures; import mezz.jei.common.network.ClientPacketRouter; import mezz.jei.core.config.IServerConfig; import mezz.jei.core.config.IWorldConfig; +import mezz.jei.forge.config.ClientConfigs; import mezz.jei.forge.events.PermanentEventSubscriptions; import mezz.jei.forge.network.ConnectionToServer; import mezz.jei.forge.network.NetworkHandler; import mezz.jei.forge.startup.ForgePluginFinder; import mezz.jei.forge.startup.StartEventObserver; +import mezz.jei.gui.config.InternalKeyMappings; import mezz.jei.library.startup.JeiStarter; import mezz.jei.library.startup.StartData; import net.minecraft.client.KeyMapping; @@ -20,6 +22,7 @@ import net.minecraft.client.renderer.texture.TextureManager; import net.minecraftforge.client.event.RegisterClientReloadListenersEvent; import net.minecraftforge.client.event.RegisterKeyMappingsEvent; +import net.minecraftforge.fml.ModLoadingContext; import java.util.HashSet; import java.util.List; @@ -29,11 +32,13 @@ public class JustEnoughItemsClient { private final NetworkHandler networkHandler; private final PermanentEventSubscriptions subscriptions; private final IServerConfig serverConfig; + private final IClientConfigs clientConfigs; public JustEnoughItemsClient(NetworkHandler networkHandler, PermanentEventSubscriptions subscriptions, IServerConfig serverConfig) { this.networkHandler = networkHandler; this.subscriptions = subscriptions; this.serverConfig = serverConfig; + this.clientConfigs = ClientConfigs.register(ModLoadingContext.get()); } public void register() { @@ -60,7 +65,8 @@ private void onRegisterReloadListenerEvent(RegisterClientReloadListenersEvent ev plugins, textures, serverConnection, - keyMappings + keyMappings, + clientConfigs ); JeiStarter jeiStarter = new JeiStarter(startData); diff --git a/Forge/src/main/java/mezz/jei/forge/config/ClientConfig.java b/Forge/src/main/java/mezz/jei/forge/config/ClientConfig.java new file mode 100644 index 000000000..b8e6b9821 --- /dev/null +++ b/Forge/src/main/java/mezz/jei/forge/config/ClientConfig.java @@ -0,0 +1,101 @@ +package mezz.jei.forge.config; + +import mezz.jei.api.config.GiveMode; +import mezz.jei.api.config.IClientConfig; +import mezz.jei.api.config.IngredientSortStage; +import net.minecraftforge.common.ForgeConfigSpec; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public class ClientConfig implements IClientConfig { + private final ForgeConfigSpec.BooleanValue centerSearch; + private final ForgeConfigSpec.BooleanValue lowMemorySearch; + private final ForgeConfigSpec.BooleanValue cheatToHotbar; + private final ForgeConfigSpec.BooleanValue addBookmarksToFront; + private final ForgeConfigSpec.EnumValue giveMode; + private final ForgeConfigSpec.IntValue maxRecipeGuiHeight; + private final ForgeConfigSpec.ConfigValue> ingredientSorterStages; + + public ClientConfig(ForgeConfigSpec.Builder builder) { + builder.push("advanced"); + { + builder.comment("Display search bar in the center"); + centerSearch = builder.define("center_search", defaultCenterSearchBar); + + builder.comment("Set low-memory mode (makes search very slow, but uses less RAM)"); + lowMemorySearch = builder.define("low_memory_search", false); + + builder.comment("Enable cheating items into the hotbar by using the shift+number keys."); + cheatToHotbar = builder.define("cheat_to_hotbar", false); + + builder.comment("Enable adding new bookmarks to the front of the bookmark list."); + addBookmarksToFront = builder.define("add_bookmarks_to_front", true); + + builder.comment("How items should be handed to you"); + giveMode = builder.defineEnum("give_mode", GiveMode.defaultGiveMode); + + builder.comment("Max. recipe gui height"); + maxRecipeGuiHeight = builder.defineInRange( + "recipe_gui_height", + defaultRecipeGuiHeight, + minRecipeGuiHeight, + Integer.MAX_VALUE + ); + } + builder.pop(); + + builder.push("sorting"); + { + var commentValues = Arrays.stream(IngredientSortStage.values()) + .map(Enum::name) + .collect(Collectors.joining(", ")); + + builder.comment("Sorting order for the ingredient list.", + "Valid values: " + commentValues); + ingredientSorterStages = builder.defineListAllowEmpty( + List.of("ingredient_sort_stages"), + () -> IngredientSortStage.defaultStagesNames, + obj -> obj instanceof String str && IngredientSortStage.isValidName(str) + ); + } + builder.pop(); + } + + @Override + public boolean isCenterSearchBarEnabled() { + return centerSearch.get(); + } + + @Override + public boolean isLowMemorySlowSearchEnabled() { + return lowMemorySearch.get(); + } + + @Override + public boolean isCheatToHotbarUsingHotkeysEnabled() { + return cheatToHotbar.get(); + } + + @Override + public boolean isAddingBookmarksToFront() { + return addBookmarksToFront.get(); + } + + @Override + public GiveMode getGiveMode() { + return giveMode.get(); + } + + @Override + public int getMaxRecipeGuiHeight() { + return maxRecipeGuiHeight.get(); + } + + @Override + public Stream getIngredientSorterStages() { + return ingredientSorterStages.get().stream().map(IngredientSortStage::valueOf); + } +} diff --git a/Forge/src/main/java/mezz/jei/forge/config/ClientConfigs.java b/Forge/src/main/java/mezz/jei/forge/config/ClientConfigs.java new file mode 100644 index 000000000..7aac81514 --- /dev/null +++ b/Forge/src/main/java/mezz/jei/forge/config/ClientConfigs.java @@ -0,0 +1,69 @@ +package mezz.jei.forge.config; + +import mezz.jei.api.config.IClientConfig; +import mezz.jei.api.config.IIngredientFilterConfig; +import mezz.jei.api.config.IIngredientGridConfig; +import mezz.jei.api.config.IClientConfigs; +import mezz.jei.api.config.gui.HorizontalAlignment; +import net.minecraftforge.common.ForgeConfigSpec; +import net.minecraftforge.fml.ModLoadingContext; +import net.minecraftforge.fml.config.ModConfig; + +public class ClientConfigs implements IClientConfigs { + private final IClientConfig clientConfig; + private final IIngredientFilterConfig ingredientFilterConfig; + private final IIngredientGridConfig ingredientListConfig; + private final IIngredientGridConfig bookmarkListConfig; + + + public static ClientConfigs register(ModLoadingContext modLoadingContext) { + var configBuilder = new ForgeConfigSpec.Builder(); + var config = new ClientConfigs(configBuilder); + var forgeConfig = configBuilder.build(); + + modLoadingContext.registerConfig(ModConfig.Type.CLIENT, forgeConfig); + return config; + } + + private ClientConfigs(ForgeConfigSpec.Builder builder) { + clientConfig = new ClientConfig(builder); + + builder.push("search"); + { + ingredientFilterConfig = new IngredientFilterConfig(builder); + } + builder.pop(); + + builder.push("ingredient_list"); + { + ingredientListConfig = new IngredientGridConfig(builder, HorizontalAlignment.RIGHT); + } + builder.pop(); + + builder.push("bookmark_list"); + { + bookmarkListConfig = new IngredientGridConfig(builder, HorizontalAlignment.LEFT); + } + builder.pop(); + } + + @Override + public IClientConfig getClientConfig() { + return clientConfig; + } + + @Override + public IIngredientFilterConfig getIngredientFilterConfig() { + return ingredientFilterConfig; + } + + @Override + public IIngredientGridConfig getIngredientListConfig() { + return ingredientListConfig; + } + + @Override + public IIngredientGridConfig getBookmarkListConfig() { + return bookmarkListConfig; + } +} diff --git a/Forge/src/main/java/mezz/jei/forge/config/IngredientFilterConfig.java b/Forge/src/main/java/mezz/jei/forge/config/IngredientFilterConfig.java new file mode 100644 index 000000000..9b795a864 --- /dev/null +++ b/Forge/src/main/java/mezz/jei/forge/config/IngredientFilterConfig.java @@ -0,0 +1,73 @@ +package mezz.jei.forge.config; + +import mezz.jei.api.config.IIngredientFilterConfig; +import mezz.jei.api.config.SearchMode; +import net.minecraftforge.common.ForgeConfigSpec; + +public class IngredientFilterConfig implements IIngredientFilterConfig { + private final ForgeConfigSpec.EnumValue modNameSearchMode; + private final ForgeConfigSpec.EnumValue tooltipSearchMode; + private final ForgeConfigSpec.EnumValue tagSearchMode; + private final ForgeConfigSpec.EnumValue creativeTabSearchMode; + private final ForgeConfigSpec.EnumValue colorSearchMode; + private final ForgeConfigSpec.EnumValue resourceLocationSearchMode; + private final ForgeConfigSpec.BooleanValue searchAdvTooltips; + + public IngredientFilterConfig(ForgeConfigSpec.Builder builder) { + builder.comment("Search mode for Mod Names (prefix: @)"); + modNameSearchMode = builder.defineEnum("mod_name_search_mode", SearchMode.REQUIRE_PREFIX); + + builder.comment("Search mode for Tooltips (prefix: #)"); + tooltipSearchMode = builder.defineEnum("tooltip_search_mode", SearchMode.ENABLED); + + builder.comment("Search mode for Tag Names (prefix: $)"); + tagSearchMode = builder.defineEnum("tag_search_mode", SearchMode.REQUIRE_PREFIX); + + builder.comment("Search mode for Creative Tab Names (prefix: %)"); + creativeTabSearchMode = builder.defineEnum("creative_tab_search_mode", SearchMode.DISABLED); + + builder.comment("Search mode for Colors (prefix: ^)"); + colorSearchMode = builder.defineEnum("color_search_mode", SearchMode.DISABLED); + + builder.comment("Search mode for resources locations (prefix: &)"); + resourceLocationSearchMode = builder.defineEnum("resource_location_search_mode", SearchMode.DISABLED); + + builder.comment("Search advanced tooltips (visible with F3+H)"); + searchAdvTooltips = builder.define("search_adv_tooltips", false); + } + + @Override + public SearchMode getModNameSearchMode() { + return modNameSearchMode.get(); + } + + @Override + public SearchMode getTooltipSearchMode() { + return tooltipSearchMode.get(); + } + + @Override + public SearchMode getTagSearchMode() { + return tagSearchMode.get(); + } + + @Override + public SearchMode getCreativeTabSearchMode() { + return creativeTabSearchMode.get(); + } + + @Override + public SearchMode getColorSearchMode() { + return colorSearchMode.get(); + } + + @Override + public SearchMode getResourceLocationSearchMode() { + return resourceLocationSearchMode.get(); + } + + @Override + public boolean getSearchAdvancedTooltips() { + return searchAdvTooltips.get(); + } +} diff --git a/Forge/src/main/java/mezz/jei/forge/config/IngredientGridConfig.java b/Forge/src/main/java/mezz/jei/forge/config/IngredientGridConfig.java new file mode 100644 index 000000000..3930fdada --- /dev/null +++ b/Forge/src/main/java/mezz/jei/forge/config/IngredientGridConfig.java @@ -0,0 +1,86 @@ +package mezz.jei.forge.config; + +import mezz.jei.api.config.IIngredientGridConfig; +import mezz.jei.api.config.gui.HorizontalAlignment; +import mezz.jei.api.config.gui.NavigationVisibility; +import mezz.jei.api.config.gui.VerticalAlignment; +import net.minecraftforge.common.ForgeConfigSpec; + +public class IngredientGridConfig implements IIngredientGridConfig { + private final ForgeConfigSpec.IntValue maxRows; + private final ForgeConfigSpec.IntValue maxColumns; + private final ForgeConfigSpec.EnumValue alignmentHorizontal; + private final ForgeConfigSpec.EnumValue alignmentVertical; + private final ForgeConfigSpec.EnumValue navigationVis; + private final ForgeConfigSpec.BooleanValue drawBackground; + + public IngredientGridConfig(ForgeConfigSpec.Builder builder, HorizontalAlignment defaultHorizontalAlignment) { + builder.comment("Max number of rows shown"); + maxRows = builder.defineInRange( + "max_rows", + defaultNumRows, + minNumRows, + largestNumRows + ); + + builder.comment("Max number of columns shown"); + maxColumns = builder.defineInRange( + "max_columns", + defaultNumColumns, + minNumColumns, + largestNumColumns + ); + + builder.comment("Horizontal alignment of the ingredient grid inside the available area"); + alignmentHorizontal = builder.defineEnum("horizontal_alignment", defaultHorizontalAlignment); + + builder.comment("Vertical alignment of the ingredient grid inside the available area"); + alignmentVertical = builder.defineEnum("vertical_alignment", defaultVerticalAlignment); + + builder.comment("Visibility of the top page buttons. Use AUTO_HIDE to only show it when there are multiple pages."); + navigationVis = builder.defineEnum("navigation_visibility", defaultButtonNavigationVisibility); + + builder.comment("Set to true to draw a background texture behind the gui."); + drawBackground = builder.define("draw_background", defaultDrawBackground); + } + + @Override + public int getMaxColumns() { + return maxColumns.get(); + } + + @Override + public int getMinColumns() { + return minNumColumns; + } + + @Override + public int getMaxRows() { + return maxRows.get(); + } + + @Override + public int getMinRows() { + return minNumColumns; + } + + @Override + public boolean drawBackground() { + return drawBackground.get(); + } + + @Override + public HorizontalAlignment getHorizontalAlignment() { + return alignmentHorizontal.get(); + } + + @Override + public VerticalAlignment getVerticalAlignment() { + return alignmentVertical.get(); + } + + @Override + public NavigationVisibility getButtonNavigationVisibility() { + return navigationVis.get(); + } +} diff --git a/Forge/src/main/java/mezz/jei/forge/config/package-info.java b/Forge/src/main/java/mezz/jei/forge/config/package-info.java index 3d800a54d..006b5f8fd 100644 --- a/Forge/src/main/java/mezz/jei/forge/config/package-info.java +++ b/Forge/src/main/java/mezz/jei/forge/config/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.forge.config; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Forge/src/main/java/mezz/jei/forge/events/package-info.java b/Forge/src/main/java/mezz/jei/forge/events/package-info.java index dc8c040bd..d7c4f3dfc 100644 --- a/Forge/src/main/java/mezz/jei/forge/events/package-info.java +++ b/Forge/src/main/java/mezz/jei/forge/events/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.forge.events; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Forge/src/main/java/mezz/jei/forge/ingredients/package-info.java b/Forge/src/main/java/mezz/jei/forge/ingredients/package-info.java index 827b6372a..115101fca 100644 --- a/Forge/src/main/java/mezz/jei/forge/ingredients/package-info.java +++ b/Forge/src/main/java/mezz/jei/forge/ingredients/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.forge.ingredients; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Forge/src/main/java/mezz/jei/forge/input/package-info.java b/Forge/src/main/java/mezz/jei/forge/input/package-info.java index 3f1b9cfb6..2bd6b12e4 100644 --- a/Forge/src/main/java/mezz/jei/forge/input/package-info.java +++ b/Forge/src/main/java/mezz/jei/forge/input/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.forge.input; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Forge/src/main/java/mezz/jei/forge/network/package-info.java b/Forge/src/main/java/mezz/jei/forge/network/package-info.java index 3b4d6694f..9f1a74e6a 100644 --- a/Forge/src/main/java/mezz/jei/forge/network/package-info.java +++ b/Forge/src/main/java/mezz/jei/forge/network/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.forge.network; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Forge/src/main/java/mezz/jei/forge/package-info.java b/Forge/src/main/java/mezz/jei/forge/package-info.java index f7f43f76e..4a8de6ba2 100644 --- a/Forge/src/main/java/mezz/jei/forge/package-info.java +++ b/Forge/src/main/java/mezz/jei/forge/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.forge; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Forge/src/main/java/mezz/jei/forge/platform/package-info.java b/Forge/src/main/java/mezz/jei/forge/platform/package-info.java index 4cababdf8..c9dac0f90 100644 --- a/Forge/src/main/java/mezz/jei/forge/platform/package-info.java +++ b/Forge/src/main/java/mezz/jei/forge/platform/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.forge.platform; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Forge/src/main/java/mezz/jei/forge/plugins/forge/ForgeGuiPlugin.java b/Forge/src/main/java/mezz/jei/forge/plugins/forge/ForgeGuiPlugin.java index 7fa9e60a4..be8e6e69d 100644 --- a/Forge/src/main/java/mezz/jei/forge/plugins/forge/ForgeGuiPlugin.java +++ b/Forge/src/main/java/mezz/jei/forge/plugins/forge/ForgeGuiPlugin.java @@ -4,7 +4,6 @@ import mezz.jei.api.JeiPlugin; import mezz.jei.api.constants.ModIds; import mezz.jei.api.registration.IRuntimeRegistration; -import mezz.jei.core.config.file.FileWatcher; import mezz.jei.forge.events.RuntimeEventSubscriptions; import mezz.jei.forge.startup.EventRegistration; import mezz.jei.gui.startup.JeiEventHandlers; @@ -19,7 +18,6 @@ public class ForgeGuiPlugin implements IModPlugin { private static final Logger LOGGER = LogManager.getLogger(); private final RuntimeEventSubscriptions runtimeSubscriptions = new RuntimeEventSubscriptions(MinecraftForge.EVENT_BUS); - private final FileWatcher fileWatcher = new FileWatcher("JEI GUI Config file watcher"); @Override public ResourceLocation getPluginUid() { @@ -33,16 +31,14 @@ public void registerRuntime(IRuntimeRegistration registration) { runtimeSubscriptions.clear(); } - JeiEventHandlers eventHandlers = JeiGuiStarter.start(registration, fileWatcher); + JeiEventHandlers eventHandlers = JeiGuiStarter.start(registration, registration.getClientConfigs()); EventRegistration.registerEvents(runtimeSubscriptions, eventHandlers); - fileWatcher.start(); } @Override public void onRuntimeUnavailable() { LOGGER.info("Stopping JEI GUI"); runtimeSubscriptions.clear(); - fileWatcher.reset(); } } diff --git a/Forge/src/main/java/mezz/jei/forge/plugins/forge/package-info.java b/Forge/src/main/java/mezz/jei/forge/plugins/forge/package-info.java index 48d08cec3..3d6b629a1 100644 --- a/Forge/src/main/java/mezz/jei/forge/plugins/forge/package-info.java +++ b/Forge/src/main/java/mezz/jei/forge/plugins/forge/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.forge.plugins.forge; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Forge/src/main/java/mezz/jei/forge/plugins/package-info.java b/Forge/src/main/java/mezz/jei/forge/plugins/package-info.java index a4bde9e14..ff3d1188b 100644 --- a/Forge/src/main/java/mezz/jei/forge/plugins/package-info.java +++ b/Forge/src/main/java/mezz/jei/forge/plugins/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.forge.plugins; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Forge/src/main/java/mezz/jei/forge/startup/package-info.java b/Forge/src/main/java/mezz/jei/forge/startup/package-info.java index 9fecfda42..44d07b08e 100644 --- a/Forge/src/main/java/mezz/jei/forge/startup/package-info.java +++ b/Forge/src/main/java/mezz/jei/forge/startup/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.forge.startup; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Forge/src/test/java/mezz/jei/test/IngredientFilterTest.java b/Forge/src/test/java/mezz/jei/test/IngredientFilterTest.java index 0bb9de67f..c479c5902 100644 --- a/Forge/src/test/java/mezz/jei/test/IngredientFilterTest.java +++ b/Forge/src/test/java/mezz/jei/test/IngredientFilterTest.java @@ -9,7 +9,7 @@ import mezz.jei.api.runtime.IIngredientVisibility; import mezz.jei.common.util.Translator; import mezz.jei.core.config.IWorldConfig; -import mezz.jei.gui.config.IClientConfig; +import mezz.jei.api.config.IClientConfig; import mezz.jei.gui.filter.FilterTextSource; import mezz.jei.gui.filter.IFilterTextSource; import mezz.jei.gui.ingredients.IIngredientSorter; diff --git a/Forge/src/test/java/mezz/jei/test/lib/TestClientConfig.java b/Forge/src/test/java/mezz/jei/test/lib/TestClientConfig.java index e29e69aeb..4f0c62eb2 100644 --- a/Forge/src/test/java/mezz/jei/test/lib/TestClientConfig.java +++ b/Forge/src/test/java/mezz/jei/test/lib/TestClientConfig.java @@ -1,10 +1,10 @@ package mezz.jei.test.lib; -import mezz.jei.core.config.GiveMode; -import mezz.jei.core.config.IngredientSortStage; -import mezz.jei.gui.config.IClientConfig; +import mezz.jei.api.config.GiveMode; +import mezz.jei.api.config.IngredientSortStage; +import mezz.jei.api.config.IClientConfig; -import java.util.List; +import java.util.stream.Stream; public class TestClientConfig implements IClientConfig { private final boolean lowMemorySlowSearchEnabled; @@ -44,7 +44,7 @@ public int getMaxRecipeGuiHeight() { } @Override - public List getIngredientSorterStages() { - return List.of(); + public Stream getIngredientSorterStages() { + return Stream.empty(); } } diff --git a/Forge/src/test/java/mezz/jei/test/lib/TestIngredientFilterConfig.java b/Forge/src/test/java/mezz/jei/test/lib/TestIngredientFilterConfig.java index 7cec736f1..be23e8323 100644 --- a/Forge/src/test/java/mezz/jei/test/lib/TestIngredientFilterConfig.java +++ b/Forge/src/test/java/mezz/jei/test/lib/TestIngredientFilterConfig.java @@ -1,7 +1,7 @@ package mezz.jei.test.lib; -import mezz.jei.core.search.SearchMode; -import mezz.jei.gui.config.IIngredientFilterConfig; +import mezz.jei.api.config.SearchMode; +import mezz.jei.api.config.IIngredientFilterConfig; public class TestIngredientFilterConfig implements IIngredientFilterConfig { @Override diff --git a/Gui/src/main/java/mezz/jei/gui/bookmarks/BookmarkList.java b/Gui/src/main/java/mezz/jei/gui/bookmarks/BookmarkList.java index 3397318af..9e4f929b9 100644 --- a/Gui/src/main/java/mezz/jei/gui/bookmarks/BookmarkList.java +++ b/Gui/src/main/java/mezz/jei/gui/bookmarks/BookmarkList.java @@ -5,7 +5,7 @@ import mezz.jei.api.ingredients.subtypes.UidContext; import mezz.jei.api.runtime.IIngredientManager; import mezz.jei.gui.config.IBookmarkConfig; -import mezz.jei.gui.config.IClientConfig; +import mezz.jei.api.config.IClientConfig; import mezz.jei.gui.overlay.IIngredientGridSource; import net.minecraft.world.item.ItemStack; diff --git a/Gui/src/main/java/mezz/jei/gui/config/IIngredientGridConfig.java b/Gui/src/main/java/mezz/jei/gui/config/IIngredientGridConfig.java deleted file mode 100644 index 27de156c4..000000000 --- a/Gui/src/main/java/mezz/jei/gui/config/IIngredientGridConfig.java +++ /dev/null @@ -1,16 +0,0 @@ -package mezz.jei.gui.config; - -import mezz.jei.gui.util.HorizontalAlignment; -import mezz.jei.gui.overlay.options.NavigationVisibility; -import mezz.jei.gui.util.VerticalAlignment; - -public interface IIngredientGridConfig { - int getMaxColumns(); - int getMinColumns(); - int getMaxRows(); - int getMinRows(); - boolean drawBackground(); - HorizontalAlignment getHorizontalAlignment(); - VerticalAlignment getVerticalAlignment(); - NavigationVisibility getButtonNavigationVisibility(); -} diff --git a/Gui/src/main/java/mezz/jei/gui/ingredients/IListElementInfo.java b/Gui/src/main/java/mezz/jei/gui/ingredients/IListElementInfo.java index 3b2fd0ab4..17bb659b6 100644 --- a/Gui/src/main/java/mezz/jei/gui/ingredients/IListElementInfo.java +++ b/Gui/src/main/java/mezz/jei/gui/ingredients/IListElementInfo.java @@ -7,7 +7,7 @@ import mezz.jei.api.ingredients.ITypedIngredient; import mezz.jei.api.runtime.IIngredientManager; -import mezz.jei.gui.config.IIngredientFilterConfig; +import mezz.jei.api.config.IIngredientFilterConfig; import net.minecraft.resources.ResourceLocation; import org.jetbrains.annotations.Unmodifiable; diff --git a/Gui/src/main/java/mezz/jei/gui/ingredients/IngredientFilter.java b/Gui/src/main/java/mezz/jei/gui/ingredients/IngredientFilter.java index 2f825f864..a1301d8af 100644 --- a/Gui/src/main/java/mezz/jei/gui/ingredients/IngredientFilter.java +++ b/Gui/src/main/java/mezz/jei/gui/ingredients/IngredientFilter.java @@ -10,8 +10,8 @@ import mezz.jei.api.runtime.IIngredientVisibility; import mezz.jei.common.config.DebugConfig; import mezz.jei.common.util.Translator; -import mezz.jei.gui.config.IClientConfig; -import mezz.jei.gui.config.IIngredientFilterConfig; +import mezz.jei.api.config.IClientConfig; +import mezz.jei.api.config.IIngredientFilterConfig; import mezz.jei.gui.filter.IFilterTextSource; import mezz.jei.gui.overlay.IIngredientGridSource; import mezz.jei.gui.search.ElementPrefixParser; diff --git a/Gui/src/main/java/mezz/jei/gui/ingredients/IngredientInformationUtil.java b/Gui/src/main/java/mezz/jei/gui/ingredients/IngredientInformationUtil.java index cfff26513..585f5ea43 100644 --- a/Gui/src/main/java/mezz/jei/gui/ingredients/IngredientInformationUtil.java +++ b/Gui/src/main/java/mezz/jei/gui/ingredients/IngredientInformationUtil.java @@ -2,7 +2,7 @@ import mezz.jei.api.ingredients.IIngredientHelper; import mezz.jei.api.ingredients.IIngredientRenderer; -import mezz.jei.gui.config.IIngredientFilterConfig; +import mezz.jei.api.config.IIngredientFilterConfig; import mezz.jei.common.util.Translator; import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; diff --git a/Gui/src/main/java/mezz/jei/gui/ingredients/IngredientSorter.java b/Gui/src/main/java/mezz/jei/gui/ingredients/IngredientSorter.java index 1744d502a..048ff7c66 100644 --- a/Gui/src/main/java/mezz/jei/gui/ingredients/IngredientSorter.java +++ b/Gui/src/main/java/mezz/jei/gui/ingredients/IngredientSorter.java @@ -1,8 +1,7 @@ package mezz.jei.gui.ingredients; import mezz.jei.api.runtime.IIngredientManager; -import mezz.jei.core.config.IngredientSortStage; -import mezz.jei.gui.config.IClientConfig; +import mezz.jei.api.config.IClientConfig; import mezz.jei.gui.config.IngredientTypeSortingConfig; import mezz.jei.gui.config.ModNameSortingConfig; @@ -30,7 +29,7 @@ public IngredientSorter(IClientConfig clientConfig, ModNameSortingConfig modName public void doPreSort(IngredientFilter ingredientFilter, IIngredientManager ingredientManager) { IngredientSorterComparators comparators = new IngredientSorterComparators(ingredientFilter, ingredientManager, this.modNameSortingConfig, this.ingredientTypeSortingConfig); - List ingredientSorterStages = this.clientConfig.getIngredientSorterStages(); + var ingredientSorterStages = this.clientConfig.getIngredientSorterStages(); Comparator> completeComparator = comparators.getComparator(ingredientSorterStages); diff --git a/Gui/src/main/java/mezz/jei/gui/ingredients/IngredientSorterComparators.java b/Gui/src/main/java/mezz/jei/gui/ingredients/IngredientSorterComparators.java index c7d8921fc..9a090180f 100644 --- a/Gui/src/main/java/mezz/jei/gui/ingredients/IngredientSorterComparators.java +++ b/Gui/src/main/java/mezz/jei/gui/ingredients/IngredientSorterComparators.java @@ -3,7 +3,7 @@ import mezz.jei.api.ingredients.IIngredientType; import mezz.jei.api.ingredients.ITypedIngredient; import mezz.jei.api.runtime.IIngredientManager; -import mezz.jei.core.config.IngredientSortStage; +import mezz.jei.api.config.IngredientSortStage; import mezz.jei.gui.config.IngredientTypeSortingConfig; import mezz.jei.gui.config.ModNameSortingConfig; import net.minecraft.core.HolderSet.ListBacked; @@ -16,9 +16,9 @@ import java.util.Collection; import java.util.Comparator; -import java.util.List; import java.util.Set; import java.util.stream.Collectors; +import java.util.stream.Stream; public class IngredientSorterComparators { private final IngredientFilter ingredientFilter; @@ -38,8 +38,8 @@ public IngredientSorterComparators( this.ingredientTypeSortingConfig = ingredientTypeSortingConfig; } - public Comparator> getComparator(List ingredientSorterStages) { - return ingredientSorterStages.stream() + public Comparator> getComparator(Stream ingredientSorterStages) { + return ingredientSorterStages .map(this::getComparator) .reduce(Comparator::thenComparing) .orElseGet(this::getDefault); diff --git a/Gui/src/main/java/mezz/jei/gui/ingredients/ListElementInfo.java b/Gui/src/main/java/mezz/jei/gui/ingredients/ListElementInfo.java index df97faaf9..49f0f9050 100644 --- a/Gui/src/main/java/mezz/jei/gui/ingredients/ListElementInfo.java +++ b/Gui/src/main/java/mezz/jei/gui/ingredients/ListElementInfo.java @@ -6,7 +6,7 @@ import mezz.jei.api.ingredients.IIngredientRenderer; import mezz.jei.api.ingredients.ITypedIngredient; import mezz.jei.api.runtime.IIngredientManager; -import mezz.jei.gui.config.IIngredientFilterConfig; +import mezz.jei.api.config.IIngredientFilterConfig; import mezz.jei.common.util.Translator; import net.minecraft.resources.ResourceLocation; import org.apache.logging.log4j.LogManager; diff --git a/Gui/src/main/java/mezz/jei/gui/input/handlers/CheatInputHandler.java b/Gui/src/main/java/mezz/jei/gui/input/handlers/CheatInputHandler.java index 3b673e22d..64f926f6c 100644 --- a/Gui/src/main/java/mezz/jei/gui/input/handlers/CheatInputHandler.java +++ b/Gui/src/main/java/mezz/jei/gui/input/handlers/CheatInputHandler.java @@ -5,7 +5,7 @@ import mezz.jei.common.network.IConnectionToServer; import mezz.jei.common.util.ImmutableRect2i; import mezz.jei.core.config.IWorldConfig; -import mezz.jei.gui.config.IClientConfig; +import mezz.jei.api.config.IClientConfig; import mezz.jei.gui.input.IRecipeFocusSource; import mezz.jei.gui.input.IUserInputHandler; import mezz.jei.gui.input.UserInput; diff --git a/Gui/src/main/java/mezz/jei/gui/input/handlers/DeleteItemInputHandler.java b/Gui/src/main/java/mezz/jei/gui/input/handlers/DeleteItemInputHandler.java index 974576459..692ed72c4 100644 --- a/Gui/src/main/java/mezz/jei/gui/input/handlers/DeleteItemInputHandler.java +++ b/Gui/src/main/java/mezz/jei/gui/input/handlers/DeleteItemInputHandler.java @@ -11,8 +11,8 @@ import mezz.jei.common.network.packets.PacketJei; import mezz.jei.gui.util.CheatUtil; import mezz.jei.common.util.ServerCommandUtil; -import mezz.jei.core.config.GiveMode; -import mezz.jei.gui.config.IClientConfig; +import mezz.jei.api.config.GiveMode; +import mezz.jei.api.config.IClientConfig; import mezz.jei.core.config.IWorldConfig; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.Screen; diff --git a/Gui/src/main/java/mezz/jei/gui/overlay/IngredientGrid.java b/Gui/src/main/java/mezz/jei/gui/overlay/IngredientGrid.java index 5c75045d4..58e0bc75f 100644 --- a/Gui/src/main/java/mezz/jei/gui/overlay/IngredientGrid.java +++ b/Gui/src/main/java/mezz/jei/gui/overlay/IngredientGrid.java @@ -15,9 +15,9 @@ import mezz.jei.common.util.ImmutableSize2i; import mezz.jei.common.util.MathUtil; import mezz.jei.core.config.IWorldConfig; -import mezz.jei.gui.config.IClientConfig; -import mezz.jei.gui.config.IIngredientFilterConfig; -import mezz.jei.gui.config.IIngredientGridConfig; +import mezz.jei.api.config.IClientConfig; +import mezz.jei.api.config.IIngredientFilterConfig; +import mezz.jei.api.config.IIngredientGridConfig; import mezz.jei.gui.ingredients.GuiIngredientProperties; import mezz.jei.gui.input.IRecipeFocusSource; import mezz.jei.gui.input.IUserInputHandler; diff --git a/Gui/src/main/java/mezz/jei/gui/overlay/IngredientGridTooltipHelper.java b/Gui/src/main/java/mezz/jei/gui/overlay/IngredientGridTooltipHelper.java index 352203a50..ad317994e 100644 --- a/Gui/src/main/java/mezz/jei/gui/overlay/IngredientGridTooltipHelper.java +++ b/Gui/src/main/java/mezz/jei/gui/overlay/IngredientGridTooltipHelper.java @@ -12,8 +12,8 @@ import mezz.jei.common.input.IInternalKeyMappings; import mezz.jei.common.util.IngredientTooltipHelper; import mezz.jei.core.config.IWorldConfig; -import mezz.jei.core.search.SearchMode; -import mezz.jei.gui.config.IIngredientFilterConfig; +import mezz.jei.api.config.SearchMode; +import mezz.jei.api.config.IIngredientFilterConfig; import net.minecraft.ChatFormatting; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; diff --git a/Gui/src/main/java/mezz/jei/gui/overlay/IngredientGridWithNavigation.java b/Gui/src/main/java/mezz/jei/gui/overlay/IngredientGridWithNavigation.java index a05f87469..c70159139 100644 --- a/Gui/src/main/java/mezz/jei/gui/overlay/IngredientGridWithNavigation.java +++ b/Gui/src/main/java/mezz/jei/gui/overlay/IngredientGridWithNavigation.java @@ -12,8 +12,8 @@ import mezz.jei.common.util.MathUtil; import mezz.jei.core.config.IWorldConfig; import mezz.jei.gui.PageNavigation; -import mezz.jei.gui.config.IClientConfig; -import mezz.jei.gui.config.IIngredientGridConfig; +import mezz.jei.api.config.IClientConfig; +import mezz.jei.api.config.IIngredientGridConfig; import mezz.jei.gui.input.IPaged; import mezz.jei.gui.input.IRecipeFocusSource; import mezz.jei.gui.input.IUserInputHandler; diff --git a/Gui/src/main/java/mezz/jei/gui/overlay/IngredientListOverlay.java b/Gui/src/main/java/mezz/jei/gui/overlay/IngredientListOverlay.java index 738c95f41..6d8acd6f6 100644 --- a/Gui/src/main/java/mezz/jei/gui/overlay/IngredientListOverlay.java +++ b/Gui/src/main/java/mezz/jei/gui/overlay/IngredientListOverlay.java @@ -16,7 +16,7 @@ import mezz.jei.common.util.ImmutableRect2i; import mezz.jei.core.config.IWorldConfig; import mezz.jei.gui.GuiProperties; -import mezz.jei.gui.config.IClientConfig; +import mezz.jei.api.config.IClientConfig; import mezz.jei.gui.elements.GuiIconToggleButton; import mezz.jei.gui.filter.IFilterTextSource; import mezz.jei.gui.ghost.GhostIngredientDragManager; diff --git a/Gui/src/main/java/mezz/jei/gui/overlay/bookmarks/BookmarkOverlay.java b/Gui/src/main/java/mezz/jei/gui/overlay/bookmarks/BookmarkOverlay.java index 98de43366..f68dba4b2 100644 --- a/Gui/src/main/java/mezz/jei/gui/overlay/bookmarks/BookmarkOverlay.java +++ b/Gui/src/main/java/mezz/jei/gui/overlay/bookmarks/BookmarkOverlay.java @@ -13,7 +13,7 @@ import mezz.jei.common.util.ImmutableRect2i; import mezz.jei.core.config.IWorldConfig; import mezz.jei.gui.bookmarks.BookmarkList; -import mezz.jei.gui.config.IClientConfig; +import mezz.jei.api.config.IClientConfig; import mezz.jei.gui.elements.GuiIconToggleButton; import mezz.jei.gui.input.IRecipeFocusSource; import mezz.jei.gui.input.IUserInputHandler; diff --git a/Gui/src/main/java/mezz/jei/gui/recipes/RecipesGui.java b/Gui/src/main/java/mezz/jei/gui/recipes/RecipesGui.java index aaf031100..0cd08cf46 100644 --- a/Gui/src/main/java/mezz/jei/gui/recipes/RecipesGui.java +++ b/Gui/src/main/java/mezz/jei/gui/recipes/RecipesGui.java @@ -30,7 +30,7 @@ import mezz.jei.common.util.MathUtil; import mezz.jei.common.util.StringUtil; import mezz.jei.gui.GuiProperties; -import mezz.jei.gui.config.IClientConfig; +import mezz.jei.api.config.IClientConfig; import mezz.jei.gui.elements.GuiIconButtonSmall; import mezz.jei.gui.input.IRecipeFocusSource; import mezz.jei.gui.input.IUserInputHandler; diff --git a/Gui/src/main/java/mezz/jei/gui/search/ElementPrefixParser.java b/Gui/src/main/java/mezz/jei/gui/search/ElementPrefixParser.java index fdcffadd5..c5d1a6967 100644 --- a/Gui/src/main/java/mezz/jei/gui/search/ElementPrefixParser.java +++ b/Gui/src/main/java/mezz/jei/gui/search/ElementPrefixParser.java @@ -7,9 +7,9 @@ import mezz.jei.common.util.Translator; import mezz.jei.core.search.LimitedStringStorage; import mezz.jei.core.search.PrefixInfo; -import mezz.jei.core.search.SearchMode; +import mezz.jei.api.config.SearchMode; import mezz.jei.core.search.suffixtree.GeneralizedSuffixTree; -import mezz.jei.gui.config.IIngredientFilterConfig; +import mezz.jei.api.config.IIngredientFilterConfig; import mezz.jei.gui.ingredients.IListElementInfo; import java.util.ArrayList; diff --git a/Gui/src/main/java/mezz/jei/gui/search/ElementSearch.java b/Gui/src/main/java/mezz/jei/gui/search/ElementSearch.java index ef51410a3..07d5d1677 100644 --- a/Gui/src/main/java/mezz/jei/gui/search/ElementSearch.java +++ b/Gui/src/main/java/mezz/jei/gui/search/ElementSearch.java @@ -5,7 +5,7 @@ import mezz.jei.core.search.ISearchable; import mezz.jei.core.search.PrefixInfo; import mezz.jei.core.search.PrefixedSearchable; -import mezz.jei.core.search.SearchMode; +import mezz.jei.api.config.SearchMode; import mezz.jei.gui.ingredients.IListElementInfo; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/Gui/src/main/java/mezz/jei/gui/startup/GuiConfigData.java b/Gui/src/main/java/mezz/jei/gui/startup/GuiConfigData.java index dfd4d217f..f21e39adc 100644 --- a/Gui/src/main/java/mezz/jei/gui/startup/GuiConfigData.java +++ b/Gui/src/main/java/mezz/jei/gui/startup/GuiConfigData.java @@ -1,36 +1,34 @@ package mezz.jei.gui.startup; -import mezz.jei.core.config.file.FileWatcher; import mezz.jei.gui.config.IngredientTypeSortingConfig; import mezz.jei.gui.config.ModNameSortingConfig; import mezz.jei.common.platform.Services; import mezz.jei.gui.config.BookmarkConfig; import mezz.jei.gui.config.IBookmarkConfig; -import mezz.jei.gui.config.IJeiClientConfigs; -import mezz.jei.gui.config.JeiClientConfigs; +import mezz.jei.api.config.IClientConfigs; import java.nio.file.Path; public record GuiConfigData( - IJeiClientConfigs jeiClientConfigs, + IClientConfigs jeiClientConfigs, IBookmarkConfig bookmarkConfig, ModNameSortingConfig modNameSortingConfig, IngredientTypeSortingConfig ingredientTypeSortingConfig ) { - public static GuiConfigData create(FileWatcher fileWatcher) { + public static GuiConfigData create(IClientConfigs configs) { Path configDir = Services.PLATFORM.getConfigHelper().createJeiConfigDir(); - JeiClientConfigs jeiClientConfigs = new JeiClientConfigs(configDir.resolve("jei-client.ini")); - jeiClientConfigs.register(fileWatcher); IBookmarkConfig bookmarkConfig = new BookmarkConfig(configDir); - ModNameSortingConfig ingredientModNameSortingConfig = new ModNameSortingConfig(configDir.resolve("ingredient-list-mod-sort-order.ini")); - IngredientTypeSortingConfig ingredientTypeSortingConfig = new IngredientTypeSortingConfig(configDir.resolve("ingredient-list-type-sort-order.ini")); + ModNameSortingConfig ingredientModNameSortingConfig = + new ModNameSortingConfig(configDir.resolve("ingredient-list-mod-sort-order.ini")); + IngredientTypeSortingConfig ingredientTypeSortingConfig = + new IngredientTypeSortingConfig(configDir.resolve("ingredient-list-type-sort-order.ini")); return new GuiConfigData( - jeiClientConfigs, - bookmarkConfig, - ingredientModNameSortingConfig, - ingredientTypeSortingConfig + configs, + bookmarkConfig, + ingredientModNameSortingConfig, + ingredientTypeSortingConfig ); } } diff --git a/Gui/src/main/java/mezz/jei/gui/startup/JeiGuiStarter.java b/Gui/src/main/java/mezz/jei/gui/startup/JeiGuiStarter.java index 63f526c75..17bdd1cb5 100644 --- a/Gui/src/main/java/mezz/jei/gui/startup/JeiGuiStarter.java +++ b/Gui/src/main/java/mezz/jei/gui/startup/JeiGuiStarter.java @@ -18,13 +18,12 @@ import mezz.jei.common.network.IConnectionToServer; import mezz.jei.common.util.LoggedTimer; import mezz.jei.core.config.IWorldConfig; -import mezz.jei.core.config.file.FileWatcher; import mezz.jei.gui.bookmarks.BookmarkList; import mezz.jei.gui.config.IBookmarkConfig; -import mezz.jei.gui.config.IClientConfig; -import mezz.jei.gui.config.IIngredientFilterConfig; -import mezz.jei.gui.config.IIngredientGridConfig; -import mezz.jei.gui.config.IJeiClientConfigs; +import mezz.jei.api.config.IClientConfig; +import mezz.jei.api.config.IIngredientFilterConfig; +import mezz.jei.api.config.IIngredientGridConfig; +import mezz.jei.api.config.IClientConfigs; import mezz.jei.gui.config.IngredientTypeSortingConfig; import mezz.jei.gui.config.ModNameSortingConfig; import mezz.jei.gui.events.GuiEventHandler; @@ -60,7 +59,7 @@ public class JeiGuiStarter { private static final Logger LOGGER = LogManager.getLogger(); - public static JeiEventHandlers start(IRuntimeRegistration registration, FileWatcher fileWatcher) { + public static JeiEventHandlers start(IRuntimeRegistration registration, IClientConfigs configs) { LOGGER.info("Starting JEI GUI"); LoggedTimer timer = new LoggedTimer(); @@ -87,18 +86,17 @@ public static JeiEventHandlers start(IRuntimeRegistration registration, FileWatc timer.stop(); timer.start("Building ingredient filter"); - GuiConfigData configData = GuiConfigData.create(fileWatcher); + GuiConfigData configData = GuiConfigData.create(configs); ModNameSortingConfig modNameSortingConfig = configData.modNameSortingConfig(); IngredientTypeSortingConfig ingredientTypeSortingConfig = configData.ingredientTypeSortingConfig(); IWorldConfig worldConfig = Internal.getWorldConfig(); IBookmarkConfig bookmarkConfig = configData.bookmarkConfig(); - IJeiClientConfigs jeiClientConfigs = configData.jeiClientConfigs(); - IClientConfig clientConfig = jeiClientConfigs.getClientConfig(); - IIngredientGridConfig ingredientListConfig = jeiClientConfigs.getIngredientListConfig(); - IIngredientGridConfig bookmarkListConfig = jeiClientConfigs.getBookmarkListConfig(); - IIngredientFilterConfig ingredientFilterConfig = jeiClientConfigs.getIngredientFilterConfig(); + IClientConfig clientConfig = configs.getClientConfig(); + IIngredientGridConfig ingredientListConfig = configs.getIngredientListConfig(); + IIngredientGridConfig bookmarkListConfig = configs.getBookmarkListConfig(); + IIngredientFilterConfig ingredientFilterConfig = configs.getIngredientFilterConfig(); IIngredientSorter ingredientSorter = new IngredientSorter( clientConfig, diff --git a/Gui/src/main/java/mezz/jei/gui/startup/OverlayHelper.java b/Gui/src/main/java/mezz/jei/gui/startup/OverlayHelper.java index 0b415f275..f6f6f6890 100644 --- a/Gui/src/main/java/mezz/jei/gui/startup/OverlayHelper.java +++ b/Gui/src/main/java/mezz/jei/gui/startup/OverlayHelper.java @@ -11,9 +11,9 @@ import mezz.jei.common.network.IConnectionToServer; import mezz.jei.core.config.IWorldConfig; import mezz.jei.gui.bookmarks.BookmarkList; -import mezz.jei.gui.config.IClientConfig; -import mezz.jei.gui.config.IIngredientFilterConfig; -import mezz.jei.gui.config.IIngredientGridConfig; +import mezz.jei.api.config.IClientConfig; +import mezz.jei.api.config.IIngredientFilterConfig; +import mezz.jei.api.config.IIngredientGridConfig; import mezz.jei.gui.filter.IFilterTextSource; import mezz.jei.gui.overlay.IIngredientGridSource; import mezz.jei.gui.overlay.IngredientGrid; diff --git a/Gui/src/main/java/mezz/jei/gui/util/AlignmentUtil.java b/Gui/src/main/java/mezz/jei/gui/util/AlignmentUtil.java index d1ae979ed..810e1dca6 100644 --- a/Gui/src/main/java/mezz/jei/gui/util/AlignmentUtil.java +++ b/Gui/src/main/java/mezz/jei/gui/util/AlignmentUtil.java @@ -2,6 +2,8 @@ import mezz.jei.common.util.ImmutableRect2i; import mezz.jei.common.util.ImmutableSize2i; +import mezz.jei.api.config.gui.HorizontalAlignment; +import mezz.jei.api.config.gui.VerticalAlignment; public class AlignmentUtil { public static ImmutableRect2i align(ImmutableSize2i size, ImmutableRect2i availableArea, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment) { diff --git a/Gui/src/main/java/mezz/jei/gui/util/CommandUtil.java b/Gui/src/main/java/mezz/jei/gui/util/CommandUtil.java index 235e5d0bf..65fbff30f 100644 --- a/Gui/src/main/java/mezz/jei/gui/util/CommandUtil.java +++ b/Gui/src/main/java/mezz/jei/gui/util/CommandUtil.java @@ -5,8 +5,8 @@ import mezz.jei.common.network.packets.PacketSetHotbarItemStack; import mezz.jei.common.util.ErrorUtil; import mezz.jei.common.util.ServerCommandUtil; -import mezz.jei.core.config.GiveMode; -import mezz.jei.gui.config.IClientConfig; +import mezz.jei.api.config.GiveMode; +import mezz.jei.api.config.IClientConfig; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen; import net.minecraft.client.multiplayer.MultiPlayerGameMode; diff --git a/Library/src/main/java/mezz/jei/library/gui/recipes/layout/builder/package-info.java b/Library/src/main/java/mezz/jei/library/gui/recipes/layout/builder/package-info.java index 5736beedc..78e06baa0 100644 --- a/Library/src/main/java/mezz/jei/library/gui/recipes/layout/builder/package-info.java +++ b/Library/src/main/java/mezz/jei/library/gui/recipes/layout/builder/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.library.gui.recipes.layout.builder; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Library/src/main/java/mezz/jei/library/load/registration/RuntimeRegistration.java b/Library/src/main/java/mezz/jei/library/load/registration/RuntimeRegistration.java index 8c330f9d3..72c516ff4 100644 --- a/Library/src/main/java/mezz/jei/library/load/registration/RuntimeRegistration.java +++ b/Library/src/main/java/mezz/jei/library/load/registration/RuntimeRegistration.java @@ -1,5 +1,6 @@ package mezz.jei.library.load.registration; +import mezz.jei.api.config.IClientConfigs; import mezz.jei.api.helpers.IJeiHelpers; import mezz.jei.api.recipe.IRecipeManager; import mezz.jei.api.recipe.transfer.IRecipeTransferManager; @@ -25,6 +26,8 @@ public class RuntimeRegistration implements IRuntimeRegistration { private final IIngredientVisibility ingredientVisibility; private final IRecipeTransferManager recipeTransferManager; private final IScreenHelper screenHelper; + private final IClientConfigs clientConfigs; + private IIngredientListOverlay ingredientListOverlay = IngredientListOverlayDummy.INSTANCE; private IBookmarkOverlay bookmarkOverlay = BookmarkOverlayDummy.INSTANCE; @@ -38,8 +41,8 @@ public RuntimeRegistration( IIngredientManager ingredientManager, IIngredientVisibility ingredientVisibility, IRecipeTransferManager recipeTransferManager, - IScreenHelper screenHelper - ) { + IScreenHelper screenHelper, + IClientConfigs clientConfigs) { this.recipeManager = recipeManager; this.jeiHelpers = jeiHelpers; this.editModeConfig = editModeConfig; @@ -47,6 +50,7 @@ public RuntimeRegistration( this.ingredientVisibility = ingredientVisibility; this.recipeTransferManager = recipeTransferManager; this.screenHelper = screenHelper; + this.clientConfigs = clientConfigs; } @Override @@ -104,6 +108,11 @@ public IEditModeConfig getEditModeConfig() { return this.editModeConfig; } + @Override + public IClientConfigs getClientConfigs() { + return this.clientConfigs; + } + public IIngredientListOverlay getIngredientListOverlay() { return ingredientListOverlay; } diff --git a/Library/src/main/java/mezz/jei/library/plugins/jei/info/package-info.java b/Library/src/main/java/mezz/jei/library/plugins/jei/info/package-info.java index 6dc1ea550..3f29dda81 100644 --- a/Library/src/main/java/mezz/jei/library/plugins/jei/info/package-info.java +++ b/Library/src/main/java/mezz/jei/library/plugins/jei/info/package-info.java @@ -4,4 +4,4 @@ import javax.annotation.ParametersAreNonnullByDefault; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; diff --git a/Library/src/main/java/mezz/jei/library/plugins/jei/ingredients/package-info.java b/Library/src/main/java/mezz/jei/library/plugins/jei/ingredients/package-info.java index ef017a675..cad621cc1 100644 --- a/Library/src/main/java/mezz/jei/library/plugins/jei/ingredients/package-info.java +++ b/Library/src/main/java/mezz/jei/library/plugins/jei/ingredients/package-info.java @@ -4,4 +4,4 @@ import javax.annotation.ParametersAreNonnullByDefault; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; diff --git a/Library/src/main/java/mezz/jei/library/plugins/jei/package-info.java b/Library/src/main/java/mezz/jei/library/plugins/jei/package-info.java index f65baf00d..70baa9947 100644 --- a/Library/src/main/java/mezz/jei/library/plugins/jei/package-info.java +++ b/Library/src/main/java/mezz/jei/library/plugins/jei/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.library.plugins.jei; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Library/src/main/java/mezz/jei/library/plugins/vanilla/anvil/package-info.java b/Library/src/main/java/mezz/jei/library/plugins/vanilla/anvil/package-info.java index a5d8cd7a0..c3eb7490a 100644 --- a/Library/src/main/java/mezz/jei/library/plugins/vanilla/anvil/package-info.java +++ b/Library/src/main/java/mezz/jei/library/plugins/vanilla/anvil/package-info.java @@ -4,4 +4,4 @@ import javax.annotation.ParametersAreNonnullByDefault; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; diff --git a/Library/src/main/java/mezz/jei/library/plugins/vanilla/brewing/package-info.java b/Library/src/main/java/mezz/jei/library/plugins/vanilla/brewing/package-info.java index edb1b4aab..107c1739c 100644 --- a/Library/src/main/java/mezz/jei/library/plugins/vanilla/brewing/package-info.java +++ b/Library/src/main/java/mezz/jei/library/plugins/vanilla/brewing/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.library.plugins.vanilla.brewing; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Library/src/main/java/mezz/jei/library/plugins/vanilla/compostable/package-info.java b/Library/src/main/java/mezz/jei/library/plugins/vanilla/compostable/package-info.java index 4eb89754a..7c9e54259 100644 --- a/Library/src/main/java/mezz/jei/library/plugins/vanilla/compostable/package-info.java +++ b/Library/src/main/java/mezz/jei/library/plugins/vanilla/compostable/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.library.plugins.vanilla.compostable; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Library/src/main/java/mezz/jei/library/plugins/vanilla/cooking/fuel/package-info.java b/Library/src/main/java/mezz/jei/library/plugins/vanilla/cooking/fuel/package-info.java index 310cdd4c5..16f9f5a45 100644 --- a/Library/src/main/java/mezz/jei/library/plugins/vanilla/cooking/fuel/package-info.java +++ b/Library/src/main/java/mezz/jei/library/plugins/vanilla/cooking/fuel/package-info.java @@ -4,4 +4,4 @@ import javax.annotation.ParametersAreNonnullByDefault; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; diff --git a/Library/src/main/java/mezz/jei/library/plugins/vanilla/cooking/package-info.java b/Library/src/main/java/mezz/jei/library/plugins/vanilla/cooking/package-info.java index c6aee3de3..2ba8c7ba0 100644 --- a/Library/src/main/java/mezz/jei/library/plugins/vanilla/cooking/package-info.java +++ b/Library/src/main/java/mezz/jei/library/plugins/vanilla/cooking/package-info.java @@ -4,4 +4,4 @@ import javax.annotation.ParametersAreNonnullByDefault; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; diff --git a/Library/src/main/java/mezz/jei/library/plugins/vanilla/crafting/package-info.java b/Library/src/main/java/mezz/jei/library/plugins/vanilla/crafting/package-info.java index 2d61d3efd..9d12239b1 100644 --- a/Library/src/main/java/mezz/jei/library/plugins/vanilla/crafting/package-info.java +++ b/Library/src/main/java/mezz/jei/library/plugins/vanilla/crafting/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.library.plugins.vanilla.crafting; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Library/src/main/java/mezz/jei/library/plugins/vanilla/crafting/replacers/package-info.java b/Library/src/main/java/mezz/jei/library/plugins/vanilla/crafting/replacers/package-info.java index 763dad82c..9d70e5285 100644 --- a/Library/src/main/java/mezz/jei/library/plugins/vanilla/crafting/replacers/package-info.java +++ b/Library/src/main/java/mezz/jei/library/plugins/vanilla/crafting/replacers/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.library.plugins.vanilla.crafting.replacers; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Library/src/main/java/mezz/jei/library/plugins/vanilla/ingredients/package-info.java b/Library/src/main/java/mezz/jei/library/plugins/vanilla/ingredients/package-info.java index dc3e6a8b9..4f2b72282 100644 --- a/Library/src/main/java/mezz/jei/library/plugins/vanilla/ingredients/package-info.java +++ b/Library/src/main/java/mezz/jei/library/plugins/vanilla/ingredients/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.library.plugins.vanilla.ingredients; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Library/src/main/java/mezz/jei/library/plugins/vanilla/stonecutting/package-info.java b/Library/src/main/java/mezz/jei/library/plugins/vanilla/stonecutting/package-info.java index ba78bca5d..0c5816de6 100644 --- a/Library/src/main/java/mezz/jei/library/plugins/vanilla/stonecutting/package-info.java +++ b/Library/src/main/java/mezz/jei/library/plugins/vanilla/stonecutting/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.library.plugins.vanilla.stonecutting; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Library/src/main/java/mezz/jei/library/recipes/collect/package-info.java b/Library/src/main/java/mezz/jei/library/recipes/collect/package-info.java index 11ee66992..c732e81a5 100644 --- a/Library/src/main/java/mezz/jei/library/recipes/collect/package-info.java +++ b/Library/src/main/java/mezz/jei/library/recipes/collect/package-info.java @@ -2,6 +2,6 @@ @FieldsAndMethodsAreNonnullByDefault package mezz.jei.library.recipes.collect; -import mezz.jei.core.FieldsAndMethodsAreNonnullByDefault; +import mezz.jei.api.FieldsAndMethodsAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Library/src/main/java/mezz/jei/library/startup/JeiStarter.java b/Library/src/main/java/mezz/jei/library/startup/JeiStarter.java index 0c8f2bc10..5fffc5123 100644 --- a/Library/src/main/java/mezz/jei/library/startup/JeiStarter.java +++ b/Library/src/main/java/mezz/jei/library/startup/JeiStarter.java @@ -133,8 +133,8 @@ public void start() { ingredientManager, ingredientVisibility, recipeTransferManager, - screenHelper - ); + screenHelper, + this.data.clientConfigs()); PluginCaller.callOnPlugins("Registering Runtime", plugins, p -> p.registerRuntime(runtimeRegistration)); JeiRuntime jeiRuntime = new JeiRuntime( diff --git a/Library/src/main/java/mezz/jei/library/startup/StartData.java b/Library/src/main/java/mezz/jei/library/startup/StartData.java index 09810be69..fa60abbae 100644 --- a/Library/src/main/java/mezz/jei/library/startup/StartData.java +++ b/Library/src/main/java/mezz/jei/library/startup/StartData.java @@ -1,6 +1,7 @@ package mezz.jei.library.startup; import mezz.jei.api.IModPlugin; +import mezz.jei.api.config.IClientConfigs; import mezz.jei.common.gui.textures.Textures; import mezz.jei.common.input.IInternalKeyMappings; import mezz.jei.common.network.IConnectionToServer; @@ -11,6 +12,8 @@ public record StartData( List plugins, Textures textures, IConnectionToServer serverConnection, - IInternalKeyMappings keyBindings + IInternalKeyMappings keyBindings, + + IClientConfigs clientConfigs ) { } diff --git a/gradle.properties b/gradle.properties index 0f5cd1cf3..c0d184de0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ minecraftVersion=1.19.2 minecraftVersionRange=[1.19, 1.19.2] # Forge -forgeVersion=43.0.0 +forgeVersion=43.2.0 loaderVersionRange=[41,) forgeVersionRange=[41.0.94,)