From c017060698cd7d14b739a78742003d179ac78992 Mon Sep 17 00:00:00 2001 From: FalsePattern Date: Mon, 15 Dec 2025 17:13:23 +0100 Subject: [PATCH] chore: Split bootstrap into separate classes (class loading mess) --- .../com/falsepattern/deploader/Bootstrap.java | 17 +-------- .../falsepattern/deploader/BootstrapLW.java | 34 +++++++++++++++++ .../falsepattern/deploader/BootstrapRFB.java | 38 +++++++++++++++++++ 3 files changed, 74 insertions(+), 15 deletions(-) create mode 100644 src/deploader/java/com/falsepattern/deploader/BootstrapLW.java create mode 100644 src/deploader/java/com/falsepattern/deploader/BootstrapRFB.java diff --git a/src/deploader/java/com/falsepattern/deploader/Bootstrap.java b/src/deploader/java/com/falsepattern/deploader/Bootstrap.java index f7a2bdb..4124deb 100644 --- a/src/deploader/java/com/falsepattern/deploader/Bootstrap.java +++ b/src/deploader/java/com/falsepattern/deploader/Bootstrap.java @@ -22,14 +22,6 @@ package com.falsepattern.deploader; -import com.gtnewhorizons.retrofuturabootstrap.RfbApiImpl; -import lombok.val; - -import net.minecraft.launchwrapper.Launch; -import cpw.mods.fml.relauncher.FMLLaunchHandler; -import cpw.mods.fml.relauncher.Side; - -import java.net.URLClassLoader; import java.nio.file.Path; public class Bootstrap { @@ -38,14 +30,9 @@ public class Bootstrap { public static void bootstrap(boolean rfb, Path homePath) { MINECRAFT_HOME_PATH = homePath; if (rfb) { - val loader = RfbApiImpl.INSTANCE.launchClassLoader(); - PreShare.initDevState(((URLClassLoader)loader).findResource("net/minecraft/world/World.class") != null); - PreShare.initClientState(((URLClassLoader)loader).findResource("net/minecraft/client/Minecraft.class") != null || - ((URLClassLoader)loader).findResource("bao.class") != null); - LowLevelCallMultiplexer.rfbDetected(); + BootstrapRFB.init(); } else { - PreShare.initDevState(Launch.classLoader.findResource("net/minecraft/world/World.class") != null); - PreShare.initClientState(FMLLaunchHandler.side() == Side.CLIENT); + BootstrapLW.init(); } LetsEncryptHelper.replaceSSLContext(); } diff --git a/src/deploader/java/com/falsepattern/deploader/BootstrapLW.java b/src/deploader/java/com/falsepattern/deploader/BootstrapLW.java new file mode 100644 index 0000000..e1e7497 --- /dev/null +++ b/src/deploader/java/com/falsepattern/deploader/BootstrapLW.java @@ -0,0 +1,34 @@ +/* + * This file is part of FalsePatternLib. + * + * Copyright (C) 2022-2025 FalsePattern + * All Rights Reserved + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * FalsePatternLib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, only version 3 of the License. + * + * FalsePatternLib 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with FalsePatternLib. If not, see . + */ + +package com.falsepattern.deploader; + +import net.minecraft.launchwrapper.Launch; +import cpw.mods.fml.relauncher.FMLLaunchHandler; +import cpw.mods.fml.relauncher.Side; + +class BootstrapLW { + static void init() { + PreShare.initDevState(Launch.classLoader.findResource("net/minecraft/world/World.class") != null); + PreShare.initClientState(FMLLaunchHandler.side() == Side.CLIENT); + } +} diff --git a/src/deploader/java/com/falsepattern/deploader/BootstrapRFB.java b/src/deploader/java/com/falsepattern/deploader/BootstrapRFB.java new file mode 100644 index 0000000..dd79d81 --- /dev/null +++ b/src/deploader/java/com/falsepattern/deploader/BootstrapRFB.java @@ -0,0 +1,38 @@ +/* + * This file is part of FalsePatternLib. + * + * Copyright (C) 2022-2025 FalsePattern + * All Rights Reserved + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * FalsePatternLib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, only version 3 of the License. + * + * FalsePatternLib 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with FalsePatternLib. If not, see . + */ + +package com.falsepattern.deploader; + +import com.gtnewhorizons.retrofuturabootstrap.RfbApiImpl; +import lombok.val; + +import java.net.URLClassLoader; + +class BootstrapRFB { + static void init() { + val loader = (URLClassLoader) RfbApiImpl.INSTANCE.launchClassLoader(); + PreShare.initDevState(loader.findResource("net/minecraft/world/World.class") != null); + PreShare.initClientState(loader.findResource("net/minecraft/client/Minecraft.class") != null + || loader.findResource("bao.class") != null); + LowLevelCallMultiplexer.rfbDetected(); + } +}