diff options
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rwxr-xr-x | build.gradle | 46 | ||||
| -rw-r--r-- | gradle.properties | 6 | ||||
| -rw-r--r-- | src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java | 39 | ||||
| -rw-r--r-- | src/main/java/me/shedaniel/rei/impl/ConfigObjectImpl.java | 8 |
5 files changed, 49 insertions, 51 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index a6178a097..000000000 --- a/CHANGELOG.md +++ /dev/null @@ -1 +0,0 @@ -View changelog [here](https://gist.github.com/shedaniel/b7593e692319976f3349263208792922). diff --git a/build.gradle b/build.gradle index edb8a884a..a97a7ea77 100755 --- a/build.gradle +++ b/build.gradle @@ -1,3 +1,5 @@ +import net.fabricmc.loom.task.RemapJarTask + import java.text.SimpleDateFormat plugins { @@ -33,9 +35,6 @@ license { } repositories { - maven { url "https://tehnut.info/maven/" } - maven { url "https://oss.sonatype.org/content/repositories/snapshots" } - maven { url "https://dl.bintray.com/shedaniel/autoconfig1u/" } } processResources { @@ -46,18 +45,25 @@ processResources { } dependencies { - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_version}:v2" - modApi "net.fabricmc:fabric-loader:${project.fabricloader_version}" - modApi "net.fabricmc.fabric-api:fabric-api:${project.fabric_api}" + minecraft("com.mojang:minecraft:${project.minecraft_version}") + mappings("net.fabricmc:yarn:${project.yarn_version}:v2") + modApi("net.fabricmc:fabric-loader:${project.fabricloader_version}") + modApi("net.fabricmc.fabric-api:fabric-api:${project.fabric_api}") modApi("me.shedaniel.cloth:cloth-events:${cloth_events_version}") { transitive = false } - modImplementation("me.shedaniel.cloth:config-2:${cloth_config_version}") { -// include group: "me.shedaniel.cloth", name: "basic-math" - } + modImplementation("me.shedaniel.cloth:config-2:${cloth_config_version}") modApi("me.sargunvohra.mcmods:autoconfig1u:${project.autoconfig1u}") - modApi ("org.jetbrains:annotations:18.0.0") + modApi("org.jetbrains:annotations:18.0.0") + modCompileOnly("io.github.prospector:modmenu:${modmenu_version}") { + transitive = false + } + modRuntime("io.github.prospector:modmenu:${modmenu_version}") { + transitive = false + } + modRuntime("com.lettuce.fudge:notenoughcrashes:1.1.5+1.15.1") { + transitive = false + } if (includeDep) { afterEvaluate { def listAdded = [] @@ -82,15 +88,6 @@ dependencies { configurations.runtimeClasspath.resolvedConfiguration.firstLevelModuleDependencies.each eachDep } } - modCompileOnly("io.github.prospector:modmenu:${modmenu_version}") { - transitive = false - } - modRuntime("io.github.prospector:modmenu:${modmenu_version}") { - transitive = false - } - modRuntime("com.lettuce.fudge:notenoughcrashes:1.1.5+1.15.1") { - transitive = false - } } task sourcesJar(type: Jar, dependsOn: classes) { @@ -98,11 +95,13 @@ task sourcesJar(type: Jar, dependsOn: classes) { from sourceSets.main.allSource } -task remapMavenJar(type: net.fabricmc.loom.task.RemapJarTask, dependsOn: jar) { +task remapMavenJar(type: RemapJarTask, dependsOn: jar) { // classifier = "maven" afterEvaluate { + //noinspection GroovyAccessibility input = file("${project.buildDir}/libs/${archivesBaseName}-${version}-dev.jar") archiveName = "${archivesBaseName}-${version}.jar" + //noinspection GroovyAccessibility addNestedDependencies = false } } @@ -114,7 +113,10 @@ curseforge { id = '310111' releaseType = 'release' changelogType = "html" - changelog = "<a href=\"https://gist.github.com/shedaniel/b7593e692319976f3349263208792922\">Click here for changelog</a>" + def df = new SimpleDateFormat("yyyy-MM-dd HH:mm") + df.setTimeZone(TimeZone.getTimeZone("UTC")) + def time = df.format(new Date()) + changelog = "<h2>REI v$project.version</h2>Updated at <b>$time</b>.<br><a href=\"https://gist.github.com/shedaniel/b7593e692319976f3349263208792922\">Click here for full changelog</a>" addGameVersion '1.15' addGameVersion '1.15.1' addGameVersion '1.15.2' diff --git a/gradle.properties b/gradle.properties index 929f853a4..e50dcf984 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,11 @@ -mod_version=3.3.16 +mod_version=3.3.17 minecraft_version=1.15.2 yarn_version=1.15.2+build.1 fabricloader_version=0.7.2+build.174 cloth_events_version=1.1.0 -cloth_config_version=2.8.3 +cloth_config_version=2.9.1 modmenu_version=1.8.5+build.23 fabric_api=0.4.29+build.290-1.15 autoconfig1u=1.2.4 api_include=me.shedaniel.cloth:cloth-events,me.shedaniel.cloth:config-2,me.sargunvohra.mcmods:autoconfig1u,org.jetbrains:annotations -#api_include=me.shedaniel.cloth:cloth-events,me.shedaniel.cloth:config-2,me.sargunvohra.mcmods:autoconfig1u,net.fabricmc.fabric-api:fabric-
\ No newline at end of file +#api_include=me.shedaniel.cloth:cloth-events,me.shedaniel.cloth:config-2,me.sargunvohra.mcmods:autoconfig1u,org.jetbrains:annotations,net.fabricmc.fabric-api:fabric-
\ No newline at end of file diff --git a/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java b/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java index 07049ac62..2d74500f3 100644 --- a/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java +++ b/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java @@ -49,7 +49,6 @@ import net.minecraft.text.LiteralText; import net.minecraft.util.math.MathHelper; import org.jetbrains.annotations.ApiStatus; -import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Optional; @@ -61,7 +60,8 @@ import static me.sargunvohra.mcmods.autoconfig1u.util.Utils.setUnsafely; public class ConfigManagerImpl implements ConfigManager { private boolean craftableOnly; - private List<EntryStack> favorites = new ArrayList<>(); + // private List<EntryStack> favorites = new ArrayList<>(); + private Gson gson = new GsonBuilder().create(); public ConfigManagerImpl() { this.craftableOnly = false; @@ -76,11 +76,14 @@ public class ConfigManagerImpl implements ConfigManager { object.put("keyCode", new JsonPrimitive(keyCode.getKeyCode().getName())); object.put("modifier", new JsonPrimitive(keyCode.getModifier().getValue())); return object; + }).registerSerializer(EntryStack.class, (stack, marshaller) -> { + return new JsonPrimitive(gson.toJson(stack.toJson())); + }).registerPrimitiveTypeAdapter(EntryStack.class, it -> { + return it instanceof String ? EntryStack.readFromJson(gson.fromJson((String) it, JsonElement.class)) : null; }).build())); GuiRegistry guiRegistry = AutoConfig.getGuiRegistry(ConfigObjectImpl.class); //noinspection rawtypes guiRegistry.registerAnnotationProvider((i13n, field, config, defaults, guiProvider) -> Collections.singletonList(ConfigEntryBuilder.create().startEnumSelector(i13n, (Class) field.getType(), getUnsafely(field, config, null)).setDefaultValue(() -> getUnsafely(field, defaults)).setSaveConsumer(newValue -> setUnsafely(field, config, newValue)).build()), field -> field.getType().isEnum(), ConfigObject.UseEnumSelectorInstead.class); - loadFavoredEntries(); // guiRegistry.registerAnnotationProvider((i13n, field, config, defaults, guiProvider) -> { // @SuppressWarnings("rawtypes") List<AbstractConfigListEntry> entries = new ArrayList<>(); // for (FabricKeyBinding binding : ClientHelper.getInstance().getREIKeyBindings()) { @@ -164,36 +167,24 @@ public class ConfigManagerImpl implements ConfigManager { } }); }, (field) -> field.getType() == RecipeScreenType.class, ConfigObject.UseSpecialRecipeTypeScreen.class); - loadFavoredEntries(); + saveConfig(); RoughlyEnoughItemsCore.LOGGER.info("[REI] Config is loaded."); } @Override public List<EntryStack> getFavorites() { - return favorites; - } - - public void loadFavoredEntries() { - favorites.clear(); - Gson gson = new GsonBuilder().create(); - for (String entry : ((ConfigObjectImpl) getConfig()).general.favorites) { - EntryStack stack = EntryStack.readFromJson(gson.fromJson(entry, JsonElement.class)); - if (!stack.isEmpty()) - favorites.add(stack); - } - saveConfig(); + return ((ConfigObjectImpl) getConfig()).general.favorites; } @Override public void saveConfig() { - Gson gson = new GsonBuilder().create(); - ConfigObjectImpl object = (ConfigObjectImpl) getConfig(); - object.general.favorites.clear(); - for (EntryStack stack : favorites) { - JsonElement element = stack.toJson(); - if (element != null) - object.general.favorites.add(gson.toJson(element)); - } + // ConfigObjectImpl object = (ConfigObjectImpl) getConfig(); + // object.general.favorites.clear(); + // for (EntryStack stack : favorites) { + // JsonElement element = stack.toJson(); + // if (element != null) + // object.general.favorites.add(gson.toJson(element)); + // } ((me.sargunvohra.mcmods.autoconfig1u.ConfigManager<ConfigObjectImpl>) AutoConfig.getConfigHolder(ConfigObjectImpl.class)).save(); } diff --git a/src/main/java/me/shedaniel/rei/impl/ConfigObjectImpl.java b/src/main/java/me/shedaniel/rei/impl/ConfigObjectImpl.java index f520184f0..efc483162 100644 --- a/src/main/java/me/shedaniel/rei/impl/ConfigObjectImpl.java +++ b/src/main/java/me/shedaniel/rei/impl/ConfigObjectImpl.java @@ -12,6 +12,7 @@ import me.sargunvohra.mcmods.autoconfig1u.shadowed.blue.endless.jankson.Comment; import me.shedaniel.clothconfig2.api.Modifier; import me.shedaniel.clothconfig2.api.ModifierKeyCode; import me.shedaniel.rei.api.ConfigObject; +import me.shedaniel.rei.api.EntryStack; import me.shedaniel.rei.gui.config.ItemListOrdering; import me.shedaniel.rei.gui.config.ItemListOrderingConfig; import me.shedaniel.rei.gui.config.RecipeScreenType; @@ -31,6 +32,7 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData { @ConfigEntry.Category("modules") @ConfigEntry.Gui.TransitiveObject @DontApplyFieldName private Modules modules = new Modules(); @ConfigEntry.Category("technical") @ConfigEntry.Gui.TransitiveObject @DontApplyFieldName private Technical technical = new Technical(); @ConfigEntry.Category("performance") @ConfigEntry.Gui.TransitiveObject @DontApplyFieldName private Performance performance = new Performance(); + // @ConfigEntry.Category("filtering") @ConfigEntry.Gui.TransitiveObject @DontApplyFieldName private Filtering filtering = new Filtering(); @Override public boolean isLighterButtonHover() { @@ -279,7 +281,7 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData { } public static class General { - @ConfigEntry.Gui.Excluded public List<String> favorites = new ArrayList<>(); + @ConfigEntry.Gui.Excluded public List<EntryStack> favorites = new ArrayList<>(); @Comment("Declares whether cheating mode is on.") private boolean cheating = false; @Comment("Declares whether REI is visible.") @ConfigEntry.Gui.Excluded private boolean overlayVisible = true; private boolean favoritesEnabled = true; @@ -339,4 +341,8 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData { @Comment("Whether REI should render entry's enchantment glint") private boolean renderEntryEnchantmentGlint = true; private boolean newFastEntryRendering = true; } + + public static class Filtering { + private List<EntryStack> filteredStacks = new ArrayList<>(); + } } |
