diff options
author | Lorenz <ESs95s3P5z8Pheb> | 2022-07-08 12:29:56 +0200 |
---|---|---|
committer | Lorenz <ESs95s3P5z8Pheb> | 2022-07-08 12:29:56 +0200 |
commit | 7a17d4a288b572687eccef42286e03c12cdb7a12 (patch) | |
tree | 8fba1ae9c8860b1b3ece7a550a23cf7cf7dee764 /src/main | |
parent | c167f4e84e22da7b7c4405b5d59c817734654fc0 (diff) | |
download | skyhanni-7a17d4a288b572687eccef42286e03c12cdb7a12.tar.gz skyhanni-7a17d4a288b572687eccef42286e03c12cdb7a12.tar.bz2 skyhanni-7a17d4a288b572687eccef42286e03c12cdb7a12.zip |
first elements in new gui
Diffstat (limited to 'src/main')
9 files changed, 134 insertions, 18 deletions
diff --git a/src/main/java/at/lorenz/mod/Features.java b/src/main/java/at/lorenz/mod/Features.java new file mode 100644 index 000000000..2553f1d8d --- /dev/null +++ b/src/main/java/at/lorenz/mod/Features.java @@ -0,0 +1,110 @@ +package at.lorenz.mod; + +import com.google.gson.annotations.Expose; +import com.thatgravyboat.skyblockhud.SkyblockHud; +import com.thatgravyboat.skyblockhud.config.SBHConfigEditor; +import com.thatgravyboat.skyblockhud.core.GuiScreenElementWrapper; +import com.thatgravyboat.skyblockhud.core.config.Config; +import com.thatgravyboat.skyblockhud.core.config.Position; +import com.thatgravyboat.skyblockhud.core.config.annotations.Category; +import com.thatgravyboat.skyblockhud.core.config.annotations.ConfigEditorBoolean; +import com.thatgravyboat.skyblockhud.core.config.annotations.ConfigOption; +import com.thatgravyboat.skyblockhud.core.config.gui.GuiPositionEditor; +import net.minecraft.client.Minecraft; + +public class Features extends Config { + + private void editOverlay(String activeConfig, int width, int height, Position position) { + Minecraft.getMinecraft().displayGuiScreen(new GuiPositionEditor(position, width, height, () -> { + }, () -> { + }, () -> SkyblockHud.screenToOpen = new GuiScreenElementWrapper(new SBHConfigEditor(SkyblockHud.config, activeConfig)))); + } + + @Override + public void executeRunnable(String runnableId) { +// String activeConfigCategory = null; +// if (Minecraft.getMinecraft().currentScreen instanceof GuiScreenElementWrapper) { +// GuiScreenElementWrapper wrapper = (GuiScreenElementWrapper) Minecraft.getMinecraft().currentScreen; +// if (wrapper.element instanceof SBHConfigEditor) { +// activeConfigCategory = ((SBHConfigEditor) wrapper.element).getSelectedCategoryName(); +// } +// } +// +// switch (runnableId) { +// case "rpg": +// editOverlay(activeConfigCategory, 120, 47, rpg.rpgHudPosition); +// return; +// case "d1": +// editOverlay(activeConfigCategory, 120, 32, dungeon.dungeonPlayer1); +// return; +// case "d2": +// editOverlay(activeConfigCategory, 120, 32, dungeon.dungeonPlayer2); +// return; +// case "d3": +// editOverlay(activeConfigCategory, 120, 32, dungeon.dungeonPlayer3); +// return; +// case "d4": +// editOverlay(activeConfigCategory, 120, 32, dungeon.dungeonPlayer4); +// return; +// case "main": +// editOverlay(activeConfigCategory, 1000, 34, main.mainHudPos); +// return; +// case "ultimate": +// editOverlay(activeConfigCategory, 182, 5, dungeon.barPosition); +// return; +// case "map": +// editOverlay(activeConfigCategory, 72, 72, map.miniMapPosition); +// return; +// case "tracker": +// editOverlay(activeConfigCategory, 130, 70, trackers.trackerPosition); +// return; +// case "drill": +// editOverlay(activeConfigCategory, 136, 7, mining.drillBar); +// return; +// case "heat": +// editOverlay(activeConfigCategory, 45, 7, mining.heatBar); +// return; +// case "dialogue": +// editOverlay(activeConfigCategory, 182, 68, misc.dialoguePos); +// return; +// } + } + + + @Expose + @Category(name = "Chat", desc = "Chat related features.") + public Chat chat = new Chat(); + + @Expose + @Category(name = "Dungeon", desc = "Features that change the catacombs dungeon experience.") + public Dungeon dungeon = new Dungeon(); + + @Expose + @Category(name = "Inventory", desc = "Changing the behavior around the inventory.") + public Inventory inventory = new Inventory(); + + public static class Chat { + + @Expose + @ConfigOption(name = "Main Chat Filter", desc = "Hides all the annoying chat messages.") + @ConfigEditorBoolean + public boolean filter = false; + } + + public static class Dungeon { + + @Expose + @ConfigOption(name = "Hide Dungeon Messages", desc = "Hides annoyung dungeon messages.") + @ConfigEditorBoolean + public boolean hideAnnoyingMessages = false; + } + + public static class Inventory { + + @Expose + @ConfigOption(name = "Hide Not Clickable Items", desc = "Hide items that are not clickable in " + + "the current inventory: ah, bz, accessory bag, etc") + @ConfigEditorBoolean + public boolean hideNotClickableItems = false; + } +} diff --git a/src/main/java/at/lorenz/mod/HideNotClickableItems.kt b/src/main/java/at/lorenz/mod/HideNotClickableItems.kt index e58dbd92c..8c9e28d83 100644 --- a/src/main/java/at/lorenz/mod/HideNotClickableItems.kt +++ b/src/main/java/at/lorenz/mod/HideNotClickableItems.kt @@ -10,6 +10,8 @@ import at.lorenz.mod.utils.LorenzColor import at.lorenz.mod.utils.LorenzUtils import at.lorenz.mod.utils.LorenzUtils.removeColorCodes import at.lorenz.mod.utils.RenderUtils.highlight +import com.thatgravyboat.skyblockhud.SkyblockHud +import com.thatgravyboat.skyblockhud.config.SBHConfig import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.client.renderer.GlStateManager @@ -135,7 +137,7 @@ class HideNotClickableItems { private fun isDisabled(): Boolean { if (bypassUntil > System.currentTimeMillis()) return true - return !LorenzConfig.hideNotClickableItems + return !SkyblockHud.feature.inventory.hideNotClickableItems } private fun hide(chestName: String, stack: ItemStack): Boolean { diff --git a/src/main/java/at/lorenz/mod/chat/ChatFilter.kt b/src/main/java/at/lorenz/mod/chat/ChatFilter.kt index 0951b3d4b..8ac709681 100644 --- a/src/main/java/at/lorenz/mod/chat/ChatFilter.kt +++ b/src/main/java/at/lorenz/mod/chat/ChatFilter.kt @@ -1,16 +1,16 @@ package at.lorenz.mod.chat -import at.lorenz.mod.config.LorenzConfig +import at.lorenz.mod.events.LorenzChatEvent import at.lorenz.mod.utils.LorenzUtils import at.lorenz.mod.utils.LorenzUtils.matchRegex -import at.lorenz.mod.events.LorenzChatEvent +import com.thatgravyboat.skyblockhud.SkyblockHud import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class ChatFilter { @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { - if (!LorenzConfig.chatFilter) return + if (!SkyblockHud.feature.chat.filter) return val blockReason = block(event.message) if (blockReason != "") { diff --git a/src/main/java/at/lorenz/mod/config/LorenzConfig.kt b/src/main/java/at/lorenz/mod/config/LorenzConfig.kt index 4d34134f8..5106075d6 100644 --- a/src/main/java/at/lorenz/mod/config/LorenzConfig.kt +++ b/src/main/java/at/lorenz/mod/config/LorenzConfig.kt @@ -3,10 +3,6 @@ package at.lorenz.mod.config class LorenzConfig { companion object { - val chatFilter = true - val dungeonHideAnnoyingMessages = true - val hideNotClickableItems = true - val lorenzBazaarOrderHelper = true val lorenzDungeonHighlightClickedBlocks = true diff --git a/src/main/java/at/lorenz/mod/dungeon/DungeonChatFilter.kt b/src/main/java/at/lorenz/mod/dungeon/DungeonChatFilter.kt index 1fc986f7b..0db9b9e8f 100644 --- a/src/main/java/at/lorenz/mod/dungeon/DungeonChatFilter.kt +++ b/src/main/java/at/lorenz/mod/dungeon/DungeonChatFilter.kt @@ -3,13 +3,15 @@ package at.lorenz.mod.dungeon import at.lorenz.mod.config.LorenzConfig import at.lorenz.mod.events.LorenzChatEvent import at.lorenz.mod.utils.LorenzUtils.matchRegex +import com.thatgravyboat.skyblockhud.SkyblockHud import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class DungeonChatFilter { @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { - if (!LorenzConfig.dungeonHideAnnoyingMessages) return + + if (!SkyblockHud.feature.dungeon.hideAnnoyingMessages) return val blockReason = block(event.message) if (blockReason != "") { diff --git a/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java b/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java index 15fff4928..5b9bf179c 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java @@ -1,5 +1,6 @@ package com.thatgravyboat.skyblockhud; +import at.lorenz.mod.Features; import at.lorenz.mod.HideNotClickableItems; import at.lorenz.mod.ItemDisplayOverlayFeatures; import at.lorenz.mod.bazaar.BazaarApi; @@ -32,7 +33,8 @@ public class SkyblockHud { public static final String MODID = "lorenzmod"; public static final String VERSION = "0.1"; - public static SBHConfig config; + public static SBHConfig config;//TODO delete + public static Features feature; private File configFile; // private static final Set<String> SKYBLOCK_IN_ALL_LANGUAGES = Sets.newHashSet("SKYBLOCK", "\u7A7A\u5C9B\u751F\u5B58"); @@ -43,6 +45,7 @@ public class SkyblockHud { @EventHandler public void preInit(FMLPreInitializationEvent event) { + new BazaarApi(); MinecraftForge.EVENT_BUS.register(this); @@ -53,7 +56,9 @@ public class SkyblockHud { MinecraftForge.EVENT_BUS.register(new HideNotClickableItems()); MinecraftForge.EVENT_BUS.register(new DungeonHighlightClickedBlocks()); MinecraftForge.EVENT_BUS.register(new ItemDisplayOverlayFeatures()); + Commands.init(); + // MinecraftForge.EVENT_BUS.register(new LeaderboardGetter()); // MinecraftForge.EVENT_BUS.register(new SeasonDateHandler()); // MinecraftForge.EVENT_BUS.register(new LocationHandler()); @@ -94,13 +99,13 @@ public class SkyblockHud { if (configFile.exists()) { try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8))) { - config = gson.fromJson(reader, SBHConfig.class); + feature = gson.fromJson(reader, Features.class); } catch (Exception ignored) { } } - if (config == null) { - config = new SBHConfig(); + if (feature == null) { + feature = new Features(); saveConfig(); } // @@ -120,7 +125,7 @@ public class SkyblockHud { configFile.createNewFile(); try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(configFile), StandardCharsets.UTF_8))) { - writer.write(gson.toJson(config)); + writer.write(gson.toJson(feature)); } } catch (IOException ignored) { } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java b/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java index 517390a5d..67f340cf0 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java @@ -15,9 +15,9 @@ public class Commands { private static final SimpleCommand.ProcessCommandRunnable settingsRunnable = new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { if (args.length > 0) { - SkyblockHud.screenToOpen = new GuiScreenElementWrapper(new SBHConfigEditor(SkyblockHud.config, StringUtils.join(args, " "))); + SkyblockHud.screenToOpen = new GuiScreenElementWrapper(new SBHConfigEditor(SkyblockHud.feature, StringUtils.join(args, " "))); } else { - SkyblockHud.screenToOpen = new GuiScreenElementWrapper(new SBHConfigEditor(SkyblockHud.config)); + SkyblockHud.screenToOpen = new GuiScreenElementWrapper(new SBHConfigEditor(SkyblockHud.feature)); } } }; diff --git a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java index 08e72d40d..f62eba4dc 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java @@ -112,12 +112,12 @@ public class SBHConfig extends Config { public boolean test = false; @Expose - @ConfigOption(name = "Lorenz Small Test B", desc = "def") + @ConfigOption(name = "Lorenz Small Test B", desc = "abc") @ConfigEditorBoolean public boolean test2 = false; @Expose - @ConfigOption(name = "Lorenz Small Test C", desc = "ghi") + @ConfigOption(name = "Lorenz Small Test C", desc = "abc") @ConfigEditorBoolean public boolean test3 = false; } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/CooldownHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/CooldownHandler.java index 7f382d56d..7ae92df55 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/CooldownHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/CooldownHandler.java @@ -1,5 +1,6 @@ package com.thatgravyboat.skyblockhud.handlers; +import at.lorenz.mod.Features; import com.google.common.collect.Sets; import com.thatgravyboat.skyblockhud.SkyblockHud; import com.thatgravyboat.skyblockhud.api.item.IAbility; |