chore: Split bootstrap into separate classes (class loading mess)

This commit is contained in:
FalsePattern committed 2025-12-15 17:13:23 +01:00
1 parent c95ae71ecc
commit c017060698
3 files changed
+74 -15

No files matched your search

@@ -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();
}
@@ -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 <https://www.gnu.org/licenses/>.
*/
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);
}
}
@@ -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 <https://www.gnu.org/licenses/>.
*/
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();
}
}