Skip to content

Commit c017060

Browse files
committed
chore: Split bootstrap into separate classes (class loading mess)
1 parent c95ae71 commit c017060

File tree

3 files changed

+74
-15
lines changed

3 files changed

+74
-15
lines changed

src/deploader/java/com/falsepattern/deploader/Bootstrap.java

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@
2222

2323
package com.falsepattern.deploader;
2424

25-
import com.gtnewhorizons.retrofuturabootstrap.RfbApiImpl;
26-
import lombok.val;
27-
28-
import net.minecraft.launchwrapper.Launch;
29-
import cpw.mods.fml.relauncher.FMLLaunchHandler;
30-
import cpw.mods.fml.relauncher.Side;
31-
32-
import java.net.URLClassLoader;
3325
import java.nio.file.Path;
3426

3527
public class Bootstrap {
@@ -38,14 +30,9 @@ public class Bootstrap {
3830
public static void bootstrap(boolean rfb, Path homePath) {
3931
MINECRAFT_HOME_PATH = homePath;
4032
if (rfb) {
41-
val loader = RfbApiImpl.INSTANCE.launchClassLoader();
42-
PreShare.initDevState(((URLClassLoader)loader).findResource("net/minecraft/world/World.class") != null);
43-
PreShare.initClientState(((URLClassLoader)loader).findResource("net/minecraft/client/Minecraft.class") != null ||
44-
((URLClassLoader)loader).findResource("bao.class") != null);
45-
LowLevelCallMultiplexer.rfbDetected();
33+
BootstrapRFB.init();
4634
} else {
47-
PreShare.initDevState(Launch.classLoader.findResource("net/minecraft/world/World.class") != null);
48-
PreShare.initClientState(FMLLaunchHandler.side() == Side.CLIENT);
35+
BootstrapLW.init();
4936
}
5037
LetsEncryptHelper.replaceSSLContext();
5138
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* This file is part of FalsePatternLib.
3+
*
4+
* Copyright (C) 2022-2025 FalsePattern
5+
* All Rights Reserved
6+
*
7+
* The above copyright notice and this permission notice shall be included
8+
* in all copies or substantial portions of the Software.
9+
*
10+
* FalsePatternLib is free software: you can redistribute it and/or modify
11+
* it under the terms of the GNU Lesser General Public License as published by
12+
* the Free Software Foundation, only version 3 of the License.
13+
*
14+
* FalsePatternLib is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* GNU Lesser General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU Lesser General Public License
20+
* along with FalsePatternLib. If not, see <https://www.gnu.org/licenses/>.
21+
*/
22+
23+
package com.falsepattern.deploader;
24+
25+
import net.minecraft.launchwrapper.Launch;
26+
import cpw.mods.fml.relauncher.FMLLaunchHandler;
27+
import cpw.mods.fml.relauncher.Side;
28+
29+
class BootstrapLW {
30+
static void init() {
31+
PreShare.initDevState(Launch.classLoader.findResource("net/minecraft/world/World.class") != null);
32+
PreShare.initClientState(FMLLaunchHandler.side() == Side.CLIENT);
33+
}
34+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* This file is part of FalsePatternLib.
3+
*
4+
* Copyright (C) 2022-2025 FalsePattern
5+
* All Rights Reserved
6+
*
7+
* The above copyright notice and this permission notice shall be included
8+
* in all copies or substantial portions of the Software.
9+
*
10+
* FalsePatternLib is free software: you can redistribute it and/or modify
11+
* it under the terms of the GNU Lesser General Public License as published by
12+
* the Free Software Foundation, only version 3 of the License.
13+
*
14+
* FalsePatternLib is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* GNU Lesser General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU Lesser General Public License
20+
* along with FalsePatternLib. If not, see <https://www.gnu.org/licenses/>.
21+
*/
22+
23+
package com.falsepattern.deploader;
24+
25+
import com.gtnewhorizons.retrofuturabootstrap.RfbApiImpl;
26+
import lombok.val;
27+
28+
import java.net.URLClassLoader;
29+
30+
class BootstrapRFB {
31+
static void init() {
32+
val loader = (URLClassLoader) RfbApiImpl.INSTANCE.launchClassLoader();
33+
PreShare.initDevState(loader.findResource("net/minecraft/world/World.class") != null);
34+
PreShare.initClientState(loader.findResource("net/minecraft/client/Minecraft.class") != null
35+
|| loader.findResource("bao.class") != null);
36+
LowLevelCallMultiplexer.rfbDetected();
37+
}
38+
}

0 commit comments

Comments
 (0)