diff --git a/build.gradle.kts b/build.gradle.kts index 1d116cf..dac94d1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -81,6 +81,7 @@ val shade: Configuration by configurations.creating { sourceSets { val dummy by creating main { + dummy.compileClasspath += compileClasspath compileClasspath += dummy.output output.setResourcesDir(java.classesDirectory) } diff --git a/gradle.properties b/gradle.properties index 0b6c6ad..657f8d3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,10 +1,10 @@ mod_id=skyclientcosmetics mod_name=SkyClientCosmetics -mod_version=1.1.14 +mod_version=1.1.15 mod_archives_name=SkyClientCosmetics # Gradle Configuration -- DO NOT TOUCH THESE VALUES. -polyfrost.defaults.loom=2 +polyfrost.defaults.loom=3 org.gradle.daemon=true org.gradle.parallel=true org.gradle.configureoncommand=true diff --git a/settings.gradle.kts b/settings.gradle.kts index 24ef976..6973a98 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -7,7 +7,7 @@ pluginManagement { maven("https://repo.polyfrost.org/releases") // Adds the Polyfrost maven repository to get Polyfrost Gradle Toolkit } plugins { - val pgtVersion = "0.5.2" // Sets the default versions for Polyfrost Gradle Toolkit + val pgtVersion = "0.6.2" // Sets the default versions for Polyfrost Gradle Toolkit id("org.polyfrost.multi-version.root") version pgtVersion } } diff --git a/src/dummy/kotlin/me/partlysanestudios/partlysaneskies/config/OneConfigScreen.kt b/src/dummy/kotlin/me/partlysanestudios/partlysaneskies/config/OneConfigScreen.kt new file mode 100644 index 0000000..f12a1ed --- /dev/null +++ b/src/dummy/kotlin/me/partlysanestudios/partlysaneskies/config/OneConfigScreen.kt @@ -0,0 +1,11 @@ +package me.partlysanestudios.partlysaneskies.config + +import cc.polyfrost.oneconfig.config.Config +import cc.polyfrost.oneconfig.config.data.Mod +import cc.polyfrost.oneconfig.config.data.ModType + +object OneConfigScreen : Config( + Mod("Partly Sane Skies", ModType.SKYBLOCK, "/assets/partlysaneskies/textures/logo_oneconfig.png"), + "partly-sane-skies/config.json") { + var customMainMenu = true +} \ No newline at end of file diff --git a/src/main/java/co/skyclient/scc/SkyclientCosmetics.java b/src/main/java/co/skyclient/scc/SkyclientCosmetics.java index 05c44a9..de63643 100644 --- a/src/main/java/co/skyclient/scc/SkyclientCosmetics.java +++ b/src/main/java/co/skyclient/scc/SkyclientCosmetics.java @@ -17,12 +17,15 @@ package co.skyclient.scc; +import cc.polyfrost.oneconfig.utils.TickDelay; import cc.polyfrost.oneconfig.utils.commands.CommandManager; import club.sk1er.patcher.config.PatcherConfig; import co.skyclient.scc.commands.SccComand; import co.skyclient.scc.config.Settings; import co.skyclient.scc.cosmetics.TagCosmetics; +import co.skyclient.scc.gui.greeting.IntroductionGreetingSlide; import co.skyclient.scc.gui.greeting.OptimizationSlide; +import co.skyclient.scc.gui.greeting.components.GreetingSlide; import co.skyclient.scc.listeners.ChatListeners; import co.skyclient.scc.listeners.GuiListeners; import co.skyclient.scc.listeners.PlayerListeners; @@ -30,9 +33,12 @@ import co.skyclient.scc.rpc.RPC; import co.skyclient.scc.utils.Files; import de.jcm.discordgamesdk.Core; +import me.partlysanestudios.partlysaneskies.config.OneConfigScreen; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiMainMenu; import net.minecraft.client.multiplayer.ServerData; import net.minecraft.client.multiplayer.ServerList; +import net.minecraftforge.client.event.GuiOpenEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Mod; @@ -41,6 +47,8 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.eventhandler.EventPriority; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.versioning.DefaultArtifactVersion; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; @@ -150,6 +158,17 @@ public void onPostInit(FMLPostInitializationEvent event) { } } else if ("essential".equals(mod.getModId())) { isEssential = true; + } else if ("partlysaneskies".equals(mod.getModId())) { + try { + if (!Settings.hasWipedOutPSS) { + OneConfigScreen.INSTANCE.setCustomMainMenu(false); + OneConfigScreen.INSTANCE.save(); + Settings.hasWipedOutPSS = true; + config.save(); + } + } catch (Exception e) { + e.printStackTrace(); + } } } @@ -179,4 +198,18 @@ public void onPostInit(FMLPostInitializationEvent event) { ProgressManager.pop(progress); } + @SubscribeEvent + public void onGuiOpen(GuiOpenEvent event) { + if (event.gui instanceof GuiMainMenu && !Files.greetingFile.exists()) { + new TickDelay(() -> { + try { + Class> clazz = GreetingSlide.Companion.getCurrentSlide(); + Minecraft.getMinecraft().displayGuiScreen(clazz != null ? clazz.newInstance() : new IntroductionGreetingSlide()); + } catch (InstantiationException | IllegalAccessException e) { + e.printStackTrace(); + } + }, 3); + } + } + } diff --git a/src/main/java/co/skyclient/scc/config/Settings.java b/src/main/java/co/skyclient/scc/config/Settings.java index 6e15032..5cb454b 100644 --- a/src/main/java/co/skyclient/scc/config/Settings.java +++ b/src/main/java/co/skyclient/scc/config/Settings.java @@ -24,13 +24,30 @@ import cc.polyfrost.oneconfig.config.data.Mod; import cc.polyfrost.oneconfig.config.data.ModType; import cc.polyfrost.oneconfig.config.migration.VigilanceMigrator; +import cc.polyfrost.oneconfig.utils.TickDelay; import co.skyclient.scc.cosmetics.TagCosmetics; +import co.skyclient.scc.gui.greeting.IntroductionGreetingSlide; +import co.skyclient.scc.gui.greeting.components.GreetingSlide; +import co.skyclient.scc.utils.Files; +import net.minecraft.client.Minecraft; public class Settings extends Config { @Switch(name = "Custom Main Menu", description = "Enable the SkyClient Custom Main Menu.", category = "Main") public static boolean customMainMenu = true; + @Button( + name = "Setup SkyClient Again", + text = "Go", + category = "Main" + ) + public static void r() { + Files.greetingFile.delete(); + GreetingSlide.Companion.setCurrentSlide(null); + GreetingSlide.Companion.setPreviousScale(Integer.MIN_VALUE); + new TickDelay(() -> Minecraft.getMinecraft().displayGuiScreen(new IntroductionGreetingSlide()), 2); + } + @Switch(name = "Show Custom Tags", description = "Show the custom tags, which are the main focus of this mod.", category = "Main", subcategory = "Tags") public static boolean showTags = true; @@ -60,6 +77,8 @@ public static void reloadTags() { @Switch(name = "Tags in Display Names", description = "Shows tags above player names\n\u00A7c(May crash)", category = "Misc", subcategory = "Tags") public static boolean displayTags = false; + public static boolean hasWipedOutPSS = false; + public Settings() { super(new Mod("SkyClientCosmetics", ModType.UTIL_QOL, "/assets/scc/SkyClient.png", new VigilanceMigrator("./SkyclientCosmetics/skyclientcosmetics.toml")), "skyclientcosmetics.json"); diff --git a/src/main/java/co/skyclient/scc/gui/SkyClientMainMenu.java b/src/main/java/co/skyclient/scc/gui/SkyClientMainMenu.java index 295725c..bd0c83a 100644 --- a/src/main/java/co/skyclient/scc/gui/SkyClientMainMenu.java +++ b/src/main/java/co/skyclient/scc/gui/SkyClientMainMenu.java @@ -262,16 +262,6 @@ private void renderSkybox(float partialTicks) { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { - if (!Files.greetingFile.exists()) { - new TickDelay(() -> { - try { - Class> clazz = GreetingSlide.Companion.getCurrentSlide(); - Minecraft.getMinecraft().displayGuiScreen(clazz != null ? clazz.newInstance() : new IntroductionGreetingSlide()); - } catch (InstantiationException | IllegalAccessException e) { - e.printStackTrace(); - } - }, 2); - } //background GlStateManager.disableAlpha(); renderSkybox(partialTicks); diff --git a/src/main/java/co/skyclient/scc/mixins/GuiMainMenuMixin.java b/src/main/java/co/skyclient/scc/mixins/GuiMainMenuMixin.java deleted file mode 100644 index d510595..0000000 --- a/src/main/java/co/skyclient/scc/mixins/GuiMainMenuMixin.java +++ /dev/null @@ -1,22 +0,0 @@ -package co.skyclient.scc.mixins; - -import cc.polyfrost.oneconfig.utils.TickDelay; -import co.skyclient.scc.gui.greeting.IntroductionGreetingSlide; -import co.skyclient.scc.utils.Files; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiMainMenu; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(GuiMainMenu.class) -public class GuiMainMenuMixin { - - @Inject(method = "drawScreen", at = @At("HEAD")) - private void onDrawScreen(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) { - if (!Files.greetingFile.exists()) { - new TickDelay(() -> Minecraft.getMinecraft().displayGuiScreen(new IntroductionGreetingSlide()), 2); - } - } -} diff --git a/src/main/kotlin/co/skyclient/scc/gui/greeting/EndSlide.kt b/src/main/kotlin/co/skyclient/scc/gui/greeting/EndSlide.kt index 348de5f..47502c0 100644 --- a/src/main/kotlin/co/skyclient/scc/gui/greeting/EndSlide.kt +++ b/src/main/kotlin/co/skyclient/scc/gui/greeting/EndSlide.kt @@ -6,10 +6,10 @@ import cc.polyfrost.oneconfig.libs.elementa.constraints.SiblingConstraint import cc.polyfrost.oneconfig.libs.elementa.dsl.* import co.skyclient.scc.gui.greeting.components.GreetingSlide import co.skyclient.scc.utils.Files -import net.minecraft.client.gui.GuiMainMenu +import net.minecraft.client.gui.GuiScreen import java.awt.Color -class EndSlide : GreetingSlide(GuiMainMenu::class.java, { +class EndSlide : GreetingSlide(null, { Files.greetingFile.createNewFile() Files.greetingFile.writeText("DELETING OR EDITING THIS FILE WILL CAUSE WEIRD THINGS TO HAPPEN! DO NOT TOUCH THIS UNLESS A SKYCLIENT STAFF MEMBER HAS GIVEN YOU PERMISSION TO DO SO!\n2") Thread.sleep(1000) diff --git a/src/main/kotlin/co/skyclient/scc/gui/greeting/components/GreetingSlide.kt b/src/main/kotlin/co/skyclient/scc/gui/greeting/components/GreetingSlide.kt index 51fa12a..9e88bd0 100644 --- a/src/main/kotlin/co/skyclient/scc/gui/greeting/components/GreetingSlide.kt +++ b/src/main/kotlin/co/skyclient/scc/gui/greeting/components/GreetingSlide.kt @@ -17,7 +17,7 @@ import net.minecraft.client.Minecraft import net.minecraft.client.gui.GuiScreen import java.awt.Color -open class GreetingSlide(private val nextGui: Class, val onClick: () -> Unit = {}) : WindowScreen(version = ElementaVersion.V1, drawDefaultBackground = false, restoreCurrentGuiOnClose = false, newGuiScale = GuiScale.scaleForScreenSize().ordinal) { +open class GreetingSlide(private val nextGui: Class?, val onClick: () -> Unit = {}) : WindowScreen(version = ElementaVersion.V1, drawDefaultBackground = false, restoreCurrentGuiOnClose = false, newGuiScale = GuiScale.scaleForScreenSize().ordinal) { init { if (previousScale == Int.MIN_VALUE) { previousScale = Minecraft.getMinecraft().gameSettings.guiScale @@ -86,7 +86,7 @@ open class GreetingSlide(private val nextGui: Class, val onCli while (fade.getColor().alpha != 255) { ; } Minecraft.getMinecraft().addScheduledTask { onClick() - displayScreen(nextGui.getConstructor().newInstance()) + displayScreen(nextGui?.getConstructor()?.newInstance()) } } } diff --git a/src/main/resources/mixins.scc.json b/src/main/resources/mixins.scc.json index d708a13..59b042c 100644 --- a/src/main/resources/mixins.scc.json +++ b/src/main/resources/mixins.scc.json @@ -6,7 +6,6 @@ "refmap": "mixins.scc.refmap.json", "mixins": [ "SkytilsMixin", - "GuiMainMenuMixin", "GuiWinGameMixin", "MinecraftMixin", "ServerListAccessor",