diff options
| author | syeyoung <cyoung06@naver.com> | 2023-02-02 23:27:51 +0900 |
|---|---|---|
| committer | syeyoung <cyoung06@naver.com> | 2023-02-02 23:27:51 +0900 |
| commit | 1c4eace48270b2c5ce1a7a8a9eb05fb32d900399 (patch) | |
| tree | d5825bcf2f6aa46c1dd26d9b271dc459660c50ec | |
| parent | 7e84e31619be4b7e545168b648bd18db54e158e7 (diff) | |
| download | Skyblock-Dungeons-Guide-1c4eace48270b2c5ce1a7a8a9eb05fb32d900399.tar.gz Skyblock-Dungeons-Guide-1c4eace48270b2c5ce1a7a8a9eb05fb32d900399.tar.bz2 Skyblock-Dungeons-Guide-1c4eace48270b2c5ce1a7a8a9eb05fb32d900399.zip | |
how many times do I have to revamp config
Signed-off-by: syeyoung <cyoung06@naver.com>
47 files changed, 1689 insertions, 109 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java index c1f5e8c8..509fbd79 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java @@ -258,6 +258,9 @@ public class DungeonsGuide implements DGInterface { ProgressManager.pop(progressbar); VersionInfo.checkAndOpen(); + + + Minecraft.getMinecraft().refreshResources(); } // hotswap fails in dev env due to intellij auto log collection or smth. it holds ref to stacktrace. diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDgDebug.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDgDebug.java index c1e3c48e..7bd4d489 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDgDebug.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDgDebug.java @@ -57,6 +57,7 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.Tuple; import net.minecraftforge.common.MinecraftForge; +import org.lwjgl.opengl.*; import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java index ef361065..c40a0a80 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java @@ -23,6 +23,8 @@ import kr.syeyoung.dungeonsguide.launcher.Main; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; import kr.syeyoung.dungeonsguide.mod.config.guiconfig.GuiConfigV2; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.configv3.MainConfigWidget; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location2.HUDLocationConfig; import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticsManager; import kr.syeyoung.dungeonsguide.mod.discord.DiscordIntegrationManager; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; @@ -30,12 +32,15 @@ import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.FeatureVi import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.HoverEventRenderPlayer; import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.ApiFetcher; import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.SkinFetcher; +import kr.syeyoung.dungeonsguide.mod.guiv2.GuiScreenAdapter; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.GlobalHUDScale; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.image.ImageTexture; import kr.syeyoung.dungeonsguide.mod.party.PartyManager; import kr.syeyoung.dungeonsguide.mod.stomp.StompManager; import kr.syeyoung.dungeonsguide.mod.stomp.StompPayload; import kr.syeyoung.dungeonsguide.mod.wsresource.StaticResourceCache; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.util.BlockPos; @@ -49,7 +54,6 @@ import java.util.Collections; import java.util.List; public class CommandDungeonsGuide extends CommandBase { - private boolean openConfig = false; @Override public String getCommandName() { @@ -65,6 +69,7 @@ public class CommandDungeonsGuide extends CommandBase { private static final String[] SUBCOMMANDS = { "reparty", "gui", + "v3", "pvall", "asktojoin", "atj", @@ -87,7 +92,7 @@ public class CommandDungeonsGuide extends CommandBase { public void processCommand(ICommandSender sender, String[] args) { if (args.length == 0) { - openConfig = true; + target = new GuiConfigV2(); return; } @@ -97,9 +102,11 @@ public class CommandDungeonsGuide extends CommandBase { break; case "gui": - openConfig = true; + target = new GuiScreenAdapter(new GlobalHUDScale(new HUDLocationConfig(null))); + break; + case "v3": + target = new GuiScreenAdapter(new GlobalHUDScale(new MainConfigWidget())); break; - case "pv": pvCommand(args[1], sender); //args[1] is the player name break; @@ -145,12 +152,14 @@ public class CommandDungeonsGuide extends CommandBase { } } + private GuiScreen target; + @SubscribeEvent public void onTick(TickEvent.ClientTickEvent e) { try { - if (openConfig && e.phase == TickEvent.Phase.START) { - openConfig = false; - Minecraft.getMinecraft().displayGuiScreen(new GuiConfigV2()); + if (target != null && e.phase == TickEvent.Phase.START) { + Minecraft.getMinecraft().displayGuiScreen(target); + target = null; } } catch (Throwable t) { t.printStackTrace(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/RootConfigPanel.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/RootConfigPanel.java index dd6251ae..6db1a9ae 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/RootConfigPanel.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/RootConfigPanel.java @@ -101,7 +101,7 @@ public class RootConfigPanel extends MPanelScaledGUI { guiRelocate = new MButton(); guiRelocate.setText("Edit Gui Locations"); guiRelocate.setOnActionPerformed(() -> { - Minecraft.getMinecraft().displayGuiScreen(new GuiScreenAdapter(new GlobalHUDScale(new HUDLocationConfig()))); + Minecraft.getMinecraft().displayGuiScreen(new GuiScreenAdapter(new GlobalHUDScale(new HUDLocationConfig(null)))); guiRelocate.setBeingClicked(false); }); guiRelocate.setBorder(RenderUtils.blendTwoColors(0xFF141414,0x7702EE67)); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/CategoryItem.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/CategoryItem.java new file mode 100644 index 00000000..5a2c6f6c --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/CategoryItem.java @@ -0,0 +1,55 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2023 cyoung06 (syeyoung) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.config.guiconfig.configv3; + +import kr.syeyoung.dungeonsguide.mod.features.AbstractFeature; +import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute; +import kr.syeyoung.dungeonsguide.mod.guiv2.Widget; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.Navigator; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedImportOnlyWidget; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.On; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.util.ResourceLocation; + +import java.util.function.Supplier; + +public class CategoryItem extends AnnotatedImportOnlyWidget { + + @Bind(variableName = "name") + public final BindableAttribute<String> name = new BindableAttribute<>(String.class); + @Bind(variableName = "description") + public final BindableAttribute<String> description = new BindableAttribute<>(String.class); + private Supplier<Widget> pageCreator; + + public CategoryItem(Supplier<Widget> pageCreator, String category, String description) { + super(new ResourceLocation("dungeonsguide:gui/config/categoryitem.gui")); + this.pageCreator = pageCreator; + + this.name.setValue(category); + this.description.setValue(description); + } + + @On(functionName = "click") + public void openPage() { + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + Navigator.getNavigator(getDomElement()).openPage(pageCreator.get()); + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/CategoryPageWidget.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/CategoryPageWidget.java new file mode 100644 index 00000000..8565167a --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/CategoryPageWidget.java @@ -0,0 +1,65 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2023 cyoung06 (syeyoung) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.config.guiconfig.configv3; + +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute; +import kr.syeyoung.dungeonsguide.mod.guiv2.Widget; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.Text; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedImportOnlyWidget; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.data.WidgetList; +import net.minecraft.util.ResourceLocation; + +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public class CategoryPageWidget extends AnnotatedImportOnlyWidget { + @Bind(variableName = "items") + public final BindableAttribute items = new BindableAttribute<>(WidgetList.class); + @Bind(variableName = "categories") + public final BindableAttribute categories = new BindableAttribute<>(WidgetList.class); + @Bind(variableName = "categoryShow") + public final BindableAttribute<String > showCategory = new BindableAttribute<>(String.class); + public CategoryPageWidget(String category) { + super(new ResourceLocation("dungeonsguide:gui/config/categorypage.gui")); + items.setValue(buildMenu(category)); + List<Widget> widgets; + categories.setValue(widgets = buildCategory(category)); + showCategory.setValue(widgets.isEmpty() ? "hide" : "show"); + } + + private List<Widget> buildCategory(String category) { + return FeatureRegistry.getFeaturesByCategory().keySet().stream().filter(a -> a.startsWith(category+".")) + .map(a -> a.substring(category.length()+1).split("\\.")[0]) + .collect(Collectors.toSet()).stream() + .map( a -> new CategoryItem(() -> new CategoryPageWidget(category+"."+a), a, + FeatureRegistry.getCategoryDescription().getOrDefault(category+"."+a, "idk"))) + .collect(Collectors.toList()); + } + + public List<Widget> buildMenu(String category) { + return FeatureRegistry.getFeaturesByCategory() + .getOrDefault(category, Collections.emptyList()).stream().map( + a -> new FeatureItem(a) + ).collect(Collectors.toList()); + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/FeatureItem.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/FeatureItem.java new file mode 100644 index 00000000..e91b20d3 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/FeatureItem.java @@ -0,0 +1,85 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2023 cyoung06 (syeyoung) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.config.guiconfig.configv3; + +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location2.HUDLocationConfig; +import kr.syeyoung.dungeonsguide.mod.features.AbstractFeature; +import kr.syeyoung.dungeonsguide.mod.features.AbstractHUDFeature; +import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute; +import kr.syeyoung.dungeonsguide.mod.guiv2.GuiScreenAdapter; +import kr.syeyoung.dungeonsguide.mod.guiv2.Widget; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.GlobalHUDScale; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.Navigator; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedImportOnlyWidget; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.On; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.util.ResourceLocation; + +import java.util.function.Supplier; + +public class FeatureItem extends AnnotatedImportOnlyWidget { + + @Bind(variableName = "name") + public final BindableAttribute<String> name = new BindableAttribute<>(String.class); + @Bind(variableName = "description") + public final BindableAttribute<String> description = new BindableAttribute<>(String.class); + + @Bind(variableName = "guiRelocate") + public final BindableAttribute<String> guiRelocateShow = new BindableAttribute<>(String.class); + @Bind(variableName = "configure") + public final BindableAttribute<String> configureShow = new BindableAttribute<>(String.class); + @Bind(variableName = "enable") + public final BindableAttribute<String> enableShow = new BindableAttribute<>(String.class); + + @Bind(variableName = "isEnabled") + public final BindableAttribute<Boolean> enabled = new BindableAttribute<>(Boolean.class); + private AbstractFeature feature; + + public FeatureItem(AbstractFeature feature) { + super(new ResourceLocation("dungeonsguide:gui/config/featureitem.gui")); + this.feature = feature; + + this.name.setValue(feature.getName()); + this.description.setValue(feature.getDescription()); + + guiRelocateShow.setValue(feature instanceof AbstractHUDFeature ? "show" : "hide"); + configureShow.setValue("show"); + enableShow.setValue(feature.isDisyllable() ? "show" : "hide"); + enabled.setValue(feature.isEnabled()); + + enabled.addOnUpdate((old, neu) -> { + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + feature.setEnabled(neu); + }); + } + + + @On(functionName = "configure") + public void onEdit() { + // do stuff + } + @On(functionName = "relocate") + public void onRelocate() { + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + Minecraft.getMinecraft().displayGuiScreen(new GuiScreenAdapter(new GlobalHUDScale(new HUDLocationConfig((AbstractHUDFeature) feature)))); + // do stuff + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/GUIOpenItem.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/GUIOpenItem.java new file mode 100644 index 00000000..0f3d9cda --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/GUIOpenItem.java @@ -0,0 +1,57 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2023 cyoung06 (syeyoung) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.config.guiconfig.configv3; + +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location2.HUDLocationConfig; +import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute; +import kr.syeyoung.dungeonsguide.mod.guiv2.GuiScreenAdapter; +import kr.syeyoung.dungeonsguide.mod.guiv2.Widget; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.GlobalHUDScale; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.Navigator; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedImportOnlyWidget; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.On; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.util.ResourceLocation; + +import java.util.function.Supplier; + +public class GUIOpenItem extends AnnotatedImportOnlyWidget { + + @Bind(variableName = "image") + public final BindableAttribute<String> image = new BindableAttribute<>(String.class); + @Bind(variableName = "category") + public final BindableAttribute<String> bindableAttribute = new BindableAttribute<>(String.class); + + private Supplier<Widget> pageCreator; + public GUIOpenItem(String category, Supplier<Widget> creator) { + super(new ResourceLocation("dungeonsguide:gui/config/menuitem.gui")); + this.pageCreator = creator; + + bindableAttribute.setValue(category); + image.setValue("dungeonsguide:textures/config/"+category+".png"); + } + + @On(functionName = "click") + public void openPage() { + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + Minecraft.getMinecraft().displayGuiScreen(new GuiScreenAdapter(new GlobalHUDScale(pageCreator.get()))); + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/MainConfigWidget.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/MainConfigWidget.java new file mode 100644 index 00000000..f22b0c07 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/MainConfigWidget.java @@ -0,0 +1,67 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2023 cyoung06 (syeyoung) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.config.guiconfig.configv3; + +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location2.HUDLocationConfig; +import kr.syeyoung.dungeonsguide.mod.features.AbstractFeature; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute; +import kr.syeyoung.dungeonsguide.mod.guiv2.Widget; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.Navigator; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.Text; +import kr.syeyoung.dunge |
