Skip to content
This repository was archived by the owner on Feb 2, 2026. It is now read-only.

Commit 8d61ec6

Browse files
committed
1.15.11 LoaderFix
1 parent b4ae8be commit 8d61ec6

18 files changed

Lines changed: 431 additions & 78 deletions

File tree

local.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Project settings
2-
project.version=1.15.9-TET
2+
project.version=1.15.11-TET
33
project.group=org.foxesworld
44
project.archivesBaseName=fox-engine
55
#UserAuth

logs/lastlog.log

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
[15:54:55.383][INFO] ===== Engine Initialization =====
2+
[15:54:55.385][INFO]
3+
_____ _____ _____
4+
/\ \ /\ \ /\ \
5+
/::\ \ /::\ \ /::\ \
6+
\:::\ \ /::::\ \ \:::\ \
7+
\:::\ \ /::::::\ \ \:::\ \
8+
\:::\ \ /:::/\:::\ \ \:::\ \
9+
\:::\ \ /:::/__\:::\ \ \:::\ \
10+
/::::\ \ /::::\ \:::\ \ /::::\ \
11+
/::::::\ \ /::::::\ \:::\ \ /::::::\ \
12+
/:::/\:::\ \ /:::/\:::\ \:::\ \ /:::/\:::\ \
13+
/:::/ \:::\____\/:::/__\:::\ \:::\____\ /:::/ \:::\____\
14+
/:::/ \::/ /\:::\ \:::\ \::/ / /:::/ \::/ /
15+
/:::/ / \/____/ \:::\ \:::\ \/____/ /:::/ / \/____/
16+
/:::/ / \:::\ \:::\ \ /:::/ /
17+
/:::/ / \:::\ \:::\____\ /:::/ /
18+
\::/ / \:::\ \::/ / \::/ /
19+
\/____/ \:::\ \/____/ \/____/
20+
\:::\ \
21+
\:::\____\
22+
\::/ /
23+
\/____/
24+
[15:54:55.391][INFO] Engine Version: 1.15.10
25+
[15:54:55.391][INFO] Application Title: FoxesLauncher-1.24.1
26+
[15:54:55.391][INFO] Operating System: windows
27+
[15:54:55.392][INFO] Available Processors: 20
28+
[15:54:55.392][INFO] System Load Average: -1.0
29+
[15:54:55.393][INFO] Log Level: INFO
30+
[15:54:55.397][INFO] Log level set to INFO
31+
[15:54:55.481][INFO] Initializing ExecutorService with pool size: 10
32+
[15:54:55.482][WARN] executor-config.properties not found, using default settings.
33+
[15:54:55.482][INFO] Creating default ExecutorService with pool size: 10
34+
[15:54:55.607][INFO]forge-0 Sounds loaded successfully
35+
[15:54:55.774][INFO] FrameConstructor initialization
36+
[15:54:55.778][INFO] Building FrameConstructor...
37+
[15:54:55.894][INFO]forge-1 Initializing StyleProvider with path: assets/styles/
38+
[15:54:55.904][INFO]forge-1 Registering json adapter...
39+
[15:54:55.905][INFO]forge-1 Registering json5 adapter...
40+
[15:54:55.905][INFO]forge-1 Registered adapters: [json5, json]
41+
[15:54:55.918][INFO]forge-1 - Registered component: label
42+
[15:54:55.919][INFO]forge-1 - Registered component: progressBar
43+
[15:54:55.919][INFO]forge-1 - Registered component: button
44+
[15:54:55.919][INFO]forge-1 - Registered component: textArea
45+
[15:54:55.920][INFO]forge-1 - Registered component: checkBox
46+
[15:54:55.920][INFO]forge-1 - Registered component: textField
47+
[15:54:55.920][INFO]forge-1 - Registered component: spriteImage
48+
[15:54:55.921][INFO]forge-1 - Registered component: passField
49+
[15:54:55.921][INFO]forge-1 - Registered component: spinner
50+
[15:54:55.921][INFO]forge-1 - Registered component: multiButton
51+
[15:54:55.921][INFO]forge-1 - Registered component: dropBox
52+
[15:54:55.922][INFO]forge-1 - Registered component: slider
53+
[15:54:55.922][INFO]forge-1 - Registered component: compositeSlider
54+
[15:54:55.922][INFO]forge-1 - Registered component: fileSelector
55+
[15:54:55.923][INFO]forge-1 - Registered component: compositeComponent
56+
[15:54:55.995][INFO] Created font - mcfontBold

src/main/java/Test.java

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
import org.foxesworld.engine.Engine;
2+
import org.foxesworld.engine.gui.ComponentValue;
3+
import org.foxesworld.engine.gui.GuiBuilder;
4+
import org.foxesworld.engine.gui.components.ComponentAttributes;
5+
import org.foxesworld.engine.gui.components.ComponentFactoryListener;
6+
import org.foxesworld.engine.gui.components.frame.FrameConstructor;
7+
import org.foxesworld.engine.gui.components.frame.OptionGroups;
8+
import org.foxesworld.engine.gui.styles.StyleProvider;
9+
import org.foxesworld.engine.locale.LanguageProvider;
10+
import org.foxesworld.engine.sound.Sound;
11+
import org.foxesworld.engine.utils.Crypt.CryptUtils;
12+
import org.foxesworld.engine.utils.IconUtils;
13+
import org.foxesworld.engine.utils.ServerInfo;
14+
import org.foxesworld.engine.utils.hook.HookException;
15+
16+
import javax.swing.*;
17+
import java.awt.*;
18+
import java.awt.event.ActionEvent;
19+
import java.util.Map;
20+
21+
public class Test extends Engine {
22+
public Test(int poolSize, String worker, Map<String, Class<?>> configFiles) {
23+
super(poolSize, worker, configFiles);
24+
preInit();
25+
init();
26+
}
27+
28+
public static void main(String[] args){
29+
new Test(10, "forge", null);
30+
}
31+
private void buildGui(String[] styles) {
32+
setStyleProvider(new StyleProvider(styles));
33+
setGuiBuilder(new GuiBuilder(this));
34+
getGuiBuilder().getComponentFactory().setComponentFactoryListener(new InitialValue(this));
35+
getGuiBuilder().addGuiBuilderListener(this);
36+
getGuiBuilder().buildGuiAsync(getFileProperties().getFrameTpl(), getFrame().getRootPanel());
37+
setIconUtils(new IconUtils(this));
38+
}
39+
40+
@Override
41+
public void init() {
42+
safeSubmitTask(() -> {
43+
buildGui(getEngineData().getStyles());
44+
loadMainPanel(getFileProperties().getMainFrame());
45+
}, "init");
46+
}
47+
48+
@Override
49+
protected void preInit() {
50+
System.setProperty("AppDir", System.getenv("APPDATA"));
51+
System.setProperty("RamAmount", String.valueOf(Runtime.getRuntime().maxMemory() / 45));
52+
try {
53+
if (getPreInitHooks().hook(null, null)) {
54+
LOGGER.info("Pre-init hooks прервали инициализацию");
55+
return;
56+
}
57+
} catch (HookException e) {
58+
LOGGER.error("Ошибка в pre-init hooks", e);
59+
}
60+
61+
this.LANG = new LanguageProvider(this, getFileProperties().getLocaleFile(), 0);
62+
this.SOUND = new Sound(this, getClass().getClassLoader().getResourceAsStream(getFileProperties().getSoundsFile()));
63+
this.frameConstructor = new FrameConstructor(this);
64+
this.CRYPTO = new CryptUtils();
65+
this.frameConstructor.setFocusStatusListener(this);
66+
}
67+
68+
@Override
69+
protected void postInit() {
70+
71+
}
72+
73+
@Override
74+
public void onPanelsBuilt() {
75+
76+
}
77+
78+
@Override
79+
public void onAdditionalPanelBuild(JPanel panel) {
80+
81+
}
82+
83+
@Override
84+
public void onGuiBuilt() {
85+
this.getFrame().repaint();
86+
}
87+
88+
@Override
89+
public void onPanelBuild(Map<String, OptionGroups> panels, String componentGroup, Container parentPanel) {
90+
91+
}
92+
93+
@Override
94+
public void actionPerformed(ActionEvent e) {
95+
96+
}
97+
98+
@Override
99+
public void updateFocus(boolean hasFocus) {
100+
101+
}
102+
103+
public static class InitialValue extends ComponentValue implements ComponentFactoryListener {
104+
105+
private int count;
106+
private final Test launcher;
107+
public InitialValue(Test launcher) {
108+
super(launcher);
109+
this.launcher = launcher;
110+
}
111+
112+
@Override
113+
public void onComponentCreation(ComponentAttributes componentAttributes) {
114+
if (componentAttributes.getInitialValue() != null) {
115+
this.setInitialData(componentAttributes);
116+
}
117+
count+=1;
118+
}
119+
120+
@Override
121+
public void setInitialData(ComponentAttributes componentAttributes) {
122+
String[] splitValue = String.valueOf(componentAttributes.getInitialValue()).split("#");
123+
switch (splitValue[0]) {
124+
case "version" -> componentAttributes.setInitialValue(this.launcher.getEngineData().getLauncherVersion());
125+
case "build" -> componentAttributes.setInitialValue(this.launcher.getEngineData().getLauncherBuild());
126+
}
127+
}
128+
}
129+
}

src/main/java/org/foxesworld/engine/Engine.java

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,8 @@
3737
import java.lang.management.ThreadMXBean;
3838
import java.net.URLDecoder;
3939
import java.nio.charset.StandardCharsets;
40-
import java.util.LinkedList;
40+
import java.util.*;
4141
import java.util.List;
42-
import java.util.Map;
43-
import java.util.Objects;
4442
import java.util.concurrent.TimeUnit;
4543
import java.util.concurrent.atomic.AtomicBoolean;
4644

@@ -51,7 +49,7 @@ public abstract class Engine implements ActionListener, GuiBuilderListener, Focu
5149
private final OperatingSystemMXBean osBean;
5250
public static String currentOS = "";
5351
protected LoadingManager loadingManager;
54-
private final Map<String, Class<?>> configFiles;
52+
private Map<String, Class<?>> configFiles = new HashMap<>();
5553
private final String appTitle;
5654
protected Sound SOUND;
5755
protected Config config;
@@ -81,7 +79,9 @@ public Engine(int poolSize, String worker, Map<String, Class<?>> configFiles) {
8179
currentOS = OS.determineCurrentOS();
8280
osBean = ManagementFactory.getOperatingSystemMXBean();
8381
this.engineData = new EngineData();
84-
this.configFiles = configFiles;
82+
if(configFiles!=null) {
83+
this.configFiles = configFiles;
84+
}
8585

8686
InputStreamReader reader = new InputStreamReader(
8787
Objects.requireNonNull(this.getClass().getClassLoader().getResourceAsStream("buildInfo.json")),
@@ -107,7 +107,9 @@ public Engine(int poolSize, String worker, Map<String, Class<?>> configFiles) {
107107
LOGGER.info("Available Processors: {}", osBean.getAvailableProcessors());
108108
LOGGER.info("System Load Average: {}", osBean.getSystemLoadAverage());
109109
LOGGER.info("Log Level: {}", engineData.getLogLevel());
110-
LOGGER.info("Configuration Files: {}", configFiles.keySet());
110+
if(configFiles != null) {
111+
LOGGER.info("Configuration Files: {}", configFiles.keySet());
112+
}
111113

112114
this.FONTUTILS = new FontUtils(this);
113115
setLogLevel(Level.valueOf(engineData.getLogLevel()));
@@ -236,6 +238,16 @@ public void shutdownExecutorService(){
236238
}
237239
}
238240

241+
protected void safeSubmitTask(Runnable task, String taskName) {
242+
this.getExecutorServiceProvider().submitTask(() -> {
243+
try {
244+
task.run();
245+
} catch (Exception e) {
246+
getLOGGER().error("Task error - " + taskName, e);
247+
}
248+
}, taskName);
249+
}
250+
239251
public Map<String, Class<?>> getConfigFiles() {
240252
return configFiles;
241253
}
@@ -339,4 +351,8 @@ public BiHookSet<String, Object> getCustomHooks() {
339351
public IconUtils getIconUtils() {
340352
return iconUtils;
341353
}
354+
355+
public void setIconUtils(IconUtils iconUtils) {
356+
this.iconUtils = iconUtils;
357+
}
342358
}

src/main/java/org/foxesworld/engine/fileLoader/FileLoader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,14 @@ public void cancel() {
162162
//executorService.shutdownNow();
163163
fileLoaderListener.onCancel();
164164
}
165-
166165
public long getTotalSize() {
167166
if (totalSize == -1) {
168167
totalSize = fileAttributes.stream()
169168
.mapToLong(file -> {
170169
String localPath = file.getFilename().replace(file.getReplaceMask(), "");
171170
File localFile = new File(homeDir, localPath);
172-
return (localFile.exists() && localFile.length() == file.getSize()) ? 0 : file.getSize();
171+
return (localFile.exists() && !fileValidator.isInvalidFile(localFile, file.getHash(), file.getSize()))
172+
? 0 : file.getSize();
173173
})
174174
.sum();
175175
}

src/main/java/org/foxesworld/engine/gui/GuiBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ private JPanel createPanel(OptionGroups optionGroups, String componentGroup) {
277277
if (panelParent != null) {
278278
panelParent.setComponentZOrder(panel, optionGroups.getPanelOptions().getzIndex());
279279
} else {
280-
Engine.getLOGGER().warn("Parent for panel {} is null!", panel.getName());
280+
//Engine.getLOGGER().warn("Parent for panel {} is null!", panel.getName());
281281
}
282282
return panel;
283283
}

src/main/java/org/foxesworld/engine/gui/componentAccessor/ComponentsAccessor.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.foxesworld.engine.gui.componentAccessor;
22

33
import org.foxesworld.engine.gui.GuiBuilder;
4+
import org.foxesworld.engine.gui.components.CompositeComponent;
45
import org.foxesworld.engine.gui.components.checkbox.Checkbox;
56
import org.foxesworld.engine.gui.components.compositeSlider.CompositeSlider;
67
import org.foxesworld.engine.gui.components.dropBox.DropBox;
@@ -42,7 +43,8 @@ public ComponentsAccessor(GuiBuilder guiBuilder, String panelId, List<Class<?>>
4243
Slider.class, c -> String.valueOf(((Slider) c).getValue()),
4344
DropBox.class, c -> String.valueOf(((DropBox) c).getSelectedIndex()),
4445
FileSelector.class, c -> ((FileSelector)c).getValue(),
45-
CompositeSlider.class, c -> String.valueOf(((CompositeSlider) c).getValue())
46+
CompositeSlider.class, c -> String.valueOf(((CompositeSlider) c).getValue()),
47+
CompositeComponent.class, c -> ((CompositeComponent)c).getValue().toString()
4648
);
4749

4850
protected void initComponents() {
@@ -57,20 +59,18 @@ protected void initComponents() {
5759
JComponent component = componentMap.get(componentId);
5860
if (component != null) {
5961
try {
60-
boolean wasAccessible = field.isAccessible();
62+
boolean wasAccessible = field.canAccess(this);
6163
field.setAccessible(true);
6264
field.set(this, component);
6365
field.setAccessible(wasAccessible);
6466
} catch (IllegalAccessException e) {
6567
throw new RuntimeException(
66-
"Error injecting component '" + componentId + "' into field "
67-
+ field.getName(), e
68+
"Error injecting component '" + componentId + "' into field " + field.getName(), e
6869
);
6970
}
7071
} else {
7172
throw new IllegalArgumentException(
72-
"Component with ID '" + componentId + "' not found for field "
73-
+ field.getName()
73+
"Component with ID '" + componentId + "' not found for field " + field.getName()
7474
);
7575
}
7676
}

src/main/java/org/foxesworld/engine/gui/components/ComponentAttributes.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ public static class LayoutConfig {
180180
private ComponentConfig label;
181181
private ComponentConfig slider;
182182
private ComponentConfig spinner;
183+
private ComponentConfig textField;
184+
private ComponentConfig button;
183185

184186
public ComponentConfig getLabel() {
185187
return label;
@@ -192,44 +194,41 @@ public ComponentConfig getSlider() {
192194
public ComponentConfig getSpinner() {
193195
return spinner;
194196
}
197+
198+
public ComponentConfig getTextField() {
199+
return textField;
200+
}
201+
202+
public ComponentConfig getButton() {
203+
return button;
204+
}
195205
}
196206

197207
public static class ComponentConfig {
198208
private int x;
199209
private int y;
200210
private int width;
201211
private int height;
212+
private int zIndex = 0;
202213

203214
public int getX() {
204215
return x;
205216
}
206217

207-
public void setX(int x) {
208-
this.x = x;
209-
}
210-
211218
public int getY() {
212219
return y;
213220
}
214221

215-
public void setY(int y) {
216-
this.y = y;
217-
}
218-
219222
public int getWidth() {
220223
return width;
221224
}
222225

223-
public void setWidth(int width) {
224-
this.width = width;
225-
}
226-
227226
public int getHeight() {
228227
return height;
229228
}
230229

231-
public void setHeight(int height) {
232-
this.height = height;
230+
public int getZIndex() {
231+
return zIndex;
233232
}
234233
}
235234

0 commit comments

Comments
 (0)