Skip to content

Commit

Permalink
1.1.15
Browse files Browse the repository at this point in the history
Fix custom main menu with PSS
Turn off PSS's custom main menu automatically
Add a button to go through SkyClient setup again
  • Loading branch information
Wyvest committed Jun 19, 2024
1 parent 78dc830 commit 3edfbe8
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 40 deletions.
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
33 changes: 33 additions & 0 deletions src/main/java/co/skyclient/scc/SkyclientCosmetics.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,28 @@

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;
import co.skyclient.scc.mixins.ServerListAccessor;
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;
Expand All @@ -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;
Expand Down Expand Up @@ -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();
}
}
}

Expand Down Expand Up @@ -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<GreetingSlide<?>> clazz = GreetingSlide.Companion.getCurrentSlide();
Minecraft.getMinecraft().displayGuiScreen(clazz != null ? clazz.newInstance() : new IntroductionGreetingSlide());
} catch (InstantiationException | IllegalAccessException e) {
e.printStackTrace();
}
}, 3);
}
}

}
19 changes: 19 additions & 0 deletions src/main/java/co/skyclient/scc/config/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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");

Expand Down
10 changes: 0 additions & 10 deletions src/main/java/co/skyclient/scc/gui/SkyClientMainMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<GreetingSlide<?>> 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);
Expand Down
22 changes: 0 additions & 22 deletions src/main/java/co/skyclient/scc/mixins/GuiMainMenuMixin.java

This file was deleted.

4 changes: 2 additions & 2 deletions src/main/kotlin/co/skyclient/scc/gui/greeting/EndSlide.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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>(GuiMainMenu::class.java, {
class EndSlide : GreetingSlide<GuiScreen>(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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import net.minecraft.client.Minecraft
import net.minecraft.client.gui.GuiScreen
import java.awt.Color

open class GreetingSlide<T : GuiScreen>(private val nextGui: Class<T>, val onClick: () -> Unit = {}) : WindowScreen(version = ElementaVersion.V1, drawDefaultBackground = false, restoreCurrentGuiOnClose = false, newGuiScale = GuiScale.scaleForScreenSize().ordinal) {
open class GreetingSlide<T : GuiScreen>(private val nextGui: Class<T>?, 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
Expand Down Expand Up @@ -86,7 +86,7 @@ open class GreetingSlide<T : GuiScreen>(private val nextGui: Class<T>, val onCli
while (fade.getColor().alpha != 255) { ; }
Minecraft.getMinecraft().addScheduledTask {
onClick()
displayScreen(nextGui.getConstructor().newInstance())
displayScreen(nextGui?.getConstructor()?.newInstance())
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/mixins.scc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"refmap": "mixins.scc.refmap.json",
"mixins": [
"SkytilsMixin",
"GuiMainMenuMixin",
"GuiWinGameMixin",
"MinecraftMixin",
"ServerListAccessor",
Expand Down

0 comments on commit 3edfbe8

Please sign in to comment.