diff options
| author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2023-03-29 21:59:35 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-29 21:59:35 +0200 |
| commit | 74dddef692b944a16e82f7f55ddb9846abaec2e8 (patch) | |
| tree | 9607abb880d04125226befcf946cbfebbac7e2ae | |
| parent | 0a6ae67c122057dddbc8c6c94aa8484aa5f654e9 (diff) | |
| parent | 96808d7d3c2dd1abd8d619b4b97d075db6a154e0 (diff) | |
| download | SkyHanni-74dddef692b944a16e82f7f55ddb9846abaec2e8.tar.gz SkyHanni-74dddef692b944a16e82f7f55ddb9846abaec2e8.tar.bz2 SkyHanni-74dddef692b944a16e82f7f55ddb9846abaec2e8.zip | |
Merge pull request #22
The non controversial config changes
81 files changed, 231 insertions, 6746 deletions
diff --git a/build.gradle.kts b/build.gradle.kts index 641c114b3..c020d8936 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -40,6 +40,10 @@ val shadowImpl by configurations.creating { configurations.implementation.get().extendsFrom(this) } +val shadowModImpl by configurations.creating { + configurations.modImplementation.get().extendsFrom(this) +} + val devenvMod by configurations.creating { isTransitive = false isVisible = false @@ -66,6 +70,9 @@ dependencies { implementation("com.github.hannibal002:notenoughupdates:4957f0b:all") devenvMod("com.github.hannibal002:notenoughupdates:4957f0b:all") + + shadowModImpl("com.github.notenoughupdates:moulconfig:df01eda") + devenvMod("com.github.notenoughupdates:moulconfig:df01eda:test") } // Minecraft configuration: @@ -121,15 +128,14 @@ val remapJar by tasks.named<net.fabricmc.loom.task.RemapJarTask>("remapJar") { tasks.shadowJar { archiveClassifier.set("all-dev") - configurations = listOf(shadowImpl) + configurations = listOf(shadowImpl, shadowModImpl) doLast { configurations.forEach { println("Config: ${it.files}") } } - // If you want to include other dependencies and shadow them, you can relocate them in here -// fun relocate(name: String) = relocate(name, "com.examplemod.deps.$name") + relocate("io.github.moulberry.moulconfig", "at.hannibal2.skyhanni.deps.moulconfig") } tasks.assemble.get().dependsOn(tasks.remapJar) @@ -141,4 +147,4 @@ compileKotlin.kotlinOptions { val compileTestKotlin: KotlinCompile by tasks compileTestKotlin.kotlinOptions { jvmTarget = "1.8" -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index a242ccbc8..073c4e514 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -84,6 +84,9 @@ public class SkyHanniMod { public static RepoManager repo; public static ConfigManager configManager; private static Logger logger; + public static org.slf4j.Logger getLogger(String name) { + return org.slf4j.LoggerFactory.getLogger("SkyHanni." + name); + } public static List<Object> modules = new ArrayList<>(); public static Job globalJob = JobKt.Job(null); @@ -244,7 +247,6 @@ public class SkyHanniMod { configManager = new ConfigManager(); configManager.firstLoad(); - new FirstConfigLoadedEvent().postAndCatch(); MinecraftConsoleFilter.Companion.initLogging(); diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigEditor.java b/src/main/java/at/hannibal2/skyhanni/config/ConfigEditor.java deleted file mode 100644 index f0e4398d5..000000000 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigEditor.java +++ /dev/null @@ -1,884 +0,0 @@ -/* - * Copyright (C) 2022 NotEnoughUpdates contributors - * - * This file is part of NotEnoughUpdates. - * - * NotEnoughUpdates is free software: you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation, either - * version 3 of the License, or (at your option) any later version. - * - * NotEnoughUpdates is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>. - */ - -package at.hannibal2.skyhanni.config; - -import at.hannibal2.skyhanni.SkyHanniMod; -import at.hannibal2.skyhanni.config.core.GlScissorStack; -import at.hannibal2.skyhanni.config.core.GuiElement; -import at.hannibal2.skyhanni.config.core.GuiElementTextField; -import at.hannibal2.skyhanni.config.core.config.gui.GuiOptionEditor; -import at.hannibal2.skyhanni.config.core.config.gui.GuiOptionEditorAccordion; -import at.hannibal2.skyhanni.config.core.config.struct.ConfigProcessor; -import at.hannibal2.skyhanni.config.core.util.lerp.LerpUtils; -import at.hannibal2.skyhanni.config.core.util.lerp.LerpingInteger; -import at.hannibal2.skyhanni.config.core.util.render.GuiRenderUtils; -import at.hannibal2.skyhanni.config.core.util.render.TextRenderUtils; -import at.hannibal2.skyhanni.utils.StringUtils; -import com.google.common.collect.Lists; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.ResourceLocation; -import org.lwjgl.input.Keyboard; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.net.URI; -import java.util.List; -import java.util.*; - -import static at.hannibal2.skyhanni.config.GuiTextures.DISCORD; -import static at.hannibal2.skyhanni.config.GuiTextures.GITHUB; - -public class ConfigEditor extends GuiElement { - private static final ResourceLocation[] socialsIco = new ResourceLocation[]{ - DISCORD, GITHUB - }; - private static final String[] socialsLink = new String[]{ - "https://discord.gg/8DXVN4BJz3", - "https://github.com/hannibal002/SkyHanni" - }; - private static final ResourceLocation SEARCH_ICON = new ResourceLocation("notenoughupdates:core/search.png"); - public static ConfigEditor editor = new ConfigEditor(SkyHanniMod.feature); - private final long openedMillis; - private final LerpingInteger optionsScroll = new LerpingInteger(0, 150); - private final LerpingInteger categoryScroll = new LerpingInteger(0, 150); - private final LinkedHashMap<String, ConfigProcessor.ProcessedCategory> processedConfig; - private final TreeMap<String, Set<ConfigProcessor.ProcessedOption>> searchOptionMap = new TreeMap<>(); - private final HashMap<ConfigProcessor.ProcessedOption, ConfigProcessor.ProcessedCategory> categoryForOption = - new HashMap<>(); - private final LerpingInteger minimumSearchSize = new LerpingInteger(0, 150); - private final GuiElementTextField searchField = new GuiElementTextField("", 0, 20, 0); - private String selectedCategory = null; - private Set<ConfigProcessor.ProcessedCategory> searchedCategories = null; - private Map<ConfigProcessor.ProcessedCategory, Set<Integer>> searchedAccordions = null; - private Set<ConfigProcessor.ProcessedOption> searchedOptions = null; - private float optionsBarStart; - private float optionsBarend; - private int lastMouseX = 0; - private int keyboardScrollXCutoff = 0; - - public ConfigEditor(Features config) { - this(config, null); - } - - public ConfigEditor(Features config, String categoryOpen) { - this.openedMillis = System.currentTimeMillis(); - this.processedConfig = ConfigProcessor.create(config); - - for (ConfigProcessor.ProcessedCategory category : processedConfig.values()) { - for (ConfigProcessor.ProcessedOption option : category.options.values()) { - categoryForOption.put(option, category); - - String combined = category.name + " " + category.desc + " " + option.name + " " + option.desc; - combined = combined.replaceAll("[^a-zA-Z_ ]", "").toLowerCase(); - for (String word : combined.split("[ _]")) { - searchOptionMap.computeIfAbsent(word, k -> new HashSet<>()).add(option); - } - } - } - - if (categoryOpen != null) { - for (Map.Entry<String, ConfigProcessor.ProcessedCategory> category : processedConfig.entrySet()) { - if (category.getValue().name.equalsIgnoreCase(categoryOpen)) { - selectedCategory = category.getKey(); - break; - } - } - if (selectedCategory == null) { - for (Map.Entry<String, ConfigProcessor.ProcessedCategory> |
