Skip to content

Commit

Permalink
Porting stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Deftu committed Oct 15, 2024
1 parent bd30384 commit 63b17cc
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 390 deletions.
15 changes: 1 addition & 14 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,11 @@ toolkitLoomHelper {

// Adds the tweak class if we are building legacy version of forge as per the documentation (https://docs.polyfrost.org)
if (mcData.isLegacyForge) {
useTweaker("org.polyfrost.crashpatch.hooks.ModsCheckerPlugin", GameSide.CLIENT)
useTweaker("org.polyfrost.oneconfig.internal.legacy.OneConfigTweaker", GameSide.CLIENT)
useForgeMixin(modData.id) // Configures the mixins if we are building for forge, useful for when we are dealing with cross-platform projects.
}
}

loom {
if (mcData.isLegacyForge) {
runConfigs {
"client" {
programArgs("--tweakClass", "org.polyfrost.oneconfig.internal.legacy.OneConfigTweaker")
programArgs("--tweakClass", "org.spongepowered.asm.launch.MixinTweaker")
property("mixin.debug.export", "true")
//property("fml.coreMods.load", "")
}
}
}
}

// Configures the output directory for when building from the `src/resources` directory.
sourceSets {
main {
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pluginManagement {

plugins {
kotlin("jvm") version("2.0.0")
id("dev.deftu.gradle.multiversion-root") version("2.11.1")
id("dev.deftu.gradle.multiversion-root") version("2.11.2")
}
}

Expand Down
369 changes: 0 additions & 369 deletions src/main/java/org/polyfrost/crashpatch/hooks/ModsCheckerPlugin.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.lwjgl.opengl.GL14;
import org.polyfrost.crashpatch.CrashPatch;
import org.polyfrost.crashpatch.config.CrashPatchConfig;
import org.polyfrost.crashpatch.crashes.StateManager;
import org.polyfrost.crashpatch.gui.CrashGuiRewrite;
Expand Down Expand Up @@ -162,6 +163,10 @@ public void run(CallbackInfo ci) {
while (running) {
if (!hasCrashed || crashReporter == null) {
try {
if (CrashPatch.INSTANCE.getTest()) {
throw new RuntimeException("Test crash");
}

runGameLoop();
} catch (ReportedException e) {
crashpatch$clientCrashCount++;
Expand Down
15 changes: 11 additions & 4 deletions src/main/kotlin/org/polyfrost/crashpatch/CrashPatch.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import org.polyfrost.oneconfig.api.commands.v1.factories.annotated.Command
import org.polyfrost.crashpatch.config.CrashPatchConfig
import org.polyfrost.crashpatch.crashes.CrashHelper
import org.polyfrost.crashpatch.crashes.DeobfuscatingRewritePolicy
import org.polyfrost.crashpatch.hooks.ModsCheckerPlugin
import net.minecraft.util.ChatComponentText
import net.minecraftforge.fml.common.Mod
import net.minecraftforge.fml.common.event.FMLInitializationEvent
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent
import org.apache.logging.log4j.LogManager
import org.apache.logging.log4j.Logger
import org.polyfrost.utils.v1.dsl.openUI
import java.io.File


Expand All @@ -24,7 +24,9 @@ object CrashPatch {
const val NAME = "@MOD_NAME@"
const val VERSION = "@MOD_VERSION@"
val isSkyclient by lazy(LazyThreadSafetyMode.PUBLICATION) { File(mcDir, "OneConfig/CrashPatch/SKYCLIENT").exists() || File(
mcDir, "W-OVERFLOW/CrashPatch/SKYCLIENT").exists() || ModsCheckerPlugin.modsMap.keys.any { it == "skyclientcosmetics" || it == "scc" || it == "skyclientaddons" || it == "skyblockclientupdater" || it == "skyclientupdater" || it == "skyclientcore" } }
mcDir, "W-OVERFLOW/CrashPatch/SKYCLIENT").exists() }

var test = false

@Mod.EventHandler
fun onPreInit(e: FMLPreInitializationEvent) {
Expand All @@ -42,14 +44,14 @@ object CrashPatch {
CommandManager.registerCommand(CrashPatchCommand())
CrashPatchConfig
// uncomment to test init screen crashes
throw Throwable("java.lang.NoClassDefFoundError: xyz/matthewtgm/requisite/keybinds/KeyBind at lumien.custommainmenu.configuration.ConfigurationLoader.load(ConfigurationLoader.java:142) club.sk1er.bossbarcustomizer.BossbarMod.loadConfig cc.woverflow.hytils.handlers.chat.modules.modifiers.DefaultChatRestyler Failed to login: null The Hypixel Alpha server is currently closed! net.kdt.pojavlaunch macromodmodules")
// throw Throwable("java.lang.NoClassDefFoundError: xyz/matthewtgm/requisite/keybinds/KeyBind at lumien.custommainmenu.configuration.ConfigurationLoader.load(ConfigurationLoader.java:142) club.sk1er.bossbarcustomizer.BossbarMod.loadConfig cc.woverflow.hytils.handlers.chat.modules.modifiers.DefaultChatRestyler Failed to login: null The Hypixel Alpha server is currently closed! net.kdt.pojavlaunch macromodmodules")
}

@Command("crashpatch")
class CrashPatchCommand {
@Command
fun main() {
//CrashPatchConfig.openGui()
CrashPatchConfig.openUI()
}

@Command
Expand All @@ -61,6 +63,11 @@ object CrashPatch {
UMinecraft.getMinecraft().thePlayer.addChatMessage(ChatComponentText("${ChatColor.RED}[CrashPatch] Failed to reload the JSON file!"))
}
}

@Command
fun crash() {
test = true
}
}
}
val logger: Logger = LogManager.getLogger(CrashPatch)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ object CrashPatchConfig : Config("crashpatch.json", "/assets/crashpatch/crashpat
title = "Polyfrost support",
text = "Discord"
)
var supportDiscord = Runnable { browse(URI.create("https://polyfrost.cc/discord/")) }
fun supportDiscord() { browse(URI.create("https://polyfrost.cc/discord/")) }

@Button(
title = "Crash game",
text = "Crash"
)
var crashGame = Runnable { throw Throwable("java.lang.NoClassDefFoundError: xyz/matthewtgm/requisite/keybinds/KeyBind at lumien.custommainmenu.configuration.ConfigurationLoader.load(ConfigurationLoader.java:142) club.sk1er.bossbarcustomizer.BossbarMod.loadConfig cc.woverflow.hytils.handlers.chat.modules.modifiers.DefaultChatRestyler Failed to login: null The Hypixel Alpha server is currently closed! net.kdt.pojavlaunch macromodmodules") }
fun crashGame() { throw Throwable("java.lang.NoClassDefFoundError: xyz/matthewtgm/requisite/keybinds/KeyBind at lumien.custommainmenu.configuration.ConfigurationLoader.load(ConfigurationLoader.java:142) club.sk1er.bossbarcustomizer.BossbarMod.loadConfig cc.woverflow.hytils.handlers.chat.modules.modifiers.DefaultChatRestyler Failed to login: null The Hypixel Alpha server is currently closed! net.kdt.pojavlaunch macromodmodules") }
}
File renamed without changes.
3 changes: 3 additions & 0 deletions src/main/resources/polyfrost/stage0.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
oneconfig-stage1-class=org.polyfrost.oneconfig.loader.stage1.Stage1Loader
oneconfig-stage1-version=1.1.0-alpha.31
oneconfig-maven-uri=https://repo.polyfrost.org/mirror/

0 comments on commit 63b17cc

Please sign in to comment.