Skip to content

Commit 6428a60

Browse files
committed
Refactor Catalyst Optimization Helpers and Update Settings UI
- Removed CatalystNetworkHelper, CatalystPhysicsHelper, CatalystSpatialIndex, CatalystTickHelper classes to streamline optimization logic. - Updated CatalystSettingsGui to focus on lazy loading options, removing references to other optimizations. - Adjusted UI layout in CriticalRange_Catalyst_Settings.ui for improved presentation and clarity. - Added new transformers for lazy loading: LazyBlockEntityTransformer, LazyBlockTickTransformer, and LazyFluidTransformer. - Introduced a project configuration file for better integration with development tools.
1 parent 752f291 commit 6428a60

38 files changed

Lines changed: 235 additions & 4102 deletions

.project

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>Catalyst</name>
4+
<comment>Project Catalyst created by Buildship.</comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
16+
</natures>
17+
<filteredResources>
18+
<filter>
19+
<id>1768737238398</id>
20+
<name></name>
21+
<type>30</type>
22+
<matcher>
23+
<id>org.eclipse.core.resources.regexFilterMatcher</id>
24+
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
25+
</matcher>
26+
</filter>
27+
</filteredResources>
28+
</projectDescription>

build.gradle

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,7 @@ def assetsPath = hytaleBaseDir + "/" + patchline + "/package/game/latest/Assets.
7474

7575
dependencies {
7676
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.0'
77-
78-
// Auto-detect Maven requirement:
79-
// 1. Explicit flag (-PuseMavenHytale)
80-
// 2. CI environment (GITHUB_ACTIONS)
81-
// 3. Local file missing (fallback to Maven)
77+
8278
def useMaven = project.hasProperty('useMavenHytale') || System.getenv('GITHUB_ACTIONS') != null
8379
if (!useMaven && !file(hytaleServerPath).exists()) {
8480
useMaven = true
@@ -283,16 +279,13 @@ task runServer(type: JavaExec) {
283279
file("$runDir/mods").mkdirs()
284280

285281
// Copy JAR to both earlyplugins and mods directories
286-
def pluginSrc = file("${hytaleBaseDir}/earlyplugins/Catalyst-1.0.0.jar")
287-
if (pluginSrc.exists()) {
288-
copy {
289-
from pluginSrc
290-
into file("$runDir/earlyplugins")
291-
}
292-
copy {
293-
from pluginSrc
294-
into file("$runDir/mods")
295-
}
282+
copy {
283+
from jar.archiveFile
284+
into file("$runDir/earlyplugins")
285+
}
286+
copy {
287+
from jar.archiveFile
288+
into file("$runDir/mods")
296289
}
297290

298291
logger.lifecycle("Starting Hytale server...")

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
group=com.criticalrange
22
name=Catalyst
3-
version=1.0.0
3+
version=0.2.0
44
java_version=25
55
mod_description=Hytale Performance Optimization Mod - High-performance Early Plugin using bytecode transformation for server optimization
66
website=https://github.com/CriticalRange/catalyst

src/main/java/com/criticalrange/Catalyst.java

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,17 @@
1212
*
1313
* <p>Optimizes server performance through bytecode manipulation.</p>
1414
*
15+
* <p>Current optimizations:</p>
16+
* <ul>
17+
* <li>Lazy block entity initialization - defers creation until needed</li>
18+
* <li>Lazy block tick discovery - defers ticking block detection</li>
19+
* <li>Lazy fluid pre-processing - defers fluid simulation during chunk load</li>
20+
* </ul>
21+
*
1522
* @author CriticalRange
16-
* @version 2.0.0
1723
*/
1824
public class Catalyst extends JavaPlugin {
1925

20-
public static final String VERSION = "2.0.0";
2126
private static Catalyst instance;
2227
private CatalystTransformerManager transformerManager;
2328

@@ -30,6 +35,19 @@ public static Catalyst getInstance() {
3035
return instance;
3136
}
3237

38+
/**
39+
* Gets the version from the plugin manifest (set by gradle.properties).
40+
*
41+
* @return The version string, or "unknown" if not available
42+
*/
43+
public String getVersion() {
44+
try {
45+
return getManifest().getVersion().toString();
46+
} catch (Exception e) {
47+
return "unknown";
48+
}
49+
}
50+
3351
@Override
3452
protected void setup() {
3553
transformerManager = new CatalystTransformerManager();
@@ -40,7 +58,7 @@ protected void setup() {
4058
log("Failed to register command: " + t.getMessage());
4159
}
4260

43-
log("Catalyst " + VERSION + " initialized.");
61+
log("Catalyst " + getVersion() + " initialized.");
4462
}
4563

4664
@Override
@@ -60,21 +78,11 @@ protected void shutdown() {
6078
}
6179

6280
private void logConfig() {
63-
log("Active Optimizations:");
64-
log(" [+] Core: Tick(" + s(CatalystConfig.TICK_OPTIMIZATION_ENABLED) +
65-
"), Entity(" + s(CatalystConfig.ENTITY_TRACKING_ENABLED) +
66-
"), Chunk(" + s(CatalystConfig.CHUNK_CACHE_ENABLED) + ")");
67-
68-
log(" [+] Advanced: Light(" + s(CatalystConfig.LIGHTING_OPTIMIZATION_ENABLED) +
69-
"), Move(" + s(CatalystConfig.MOVEMENT_OPTIMIZATION_ENABLED) +
70-
"), Net(" + s(CatalystConfig.NETWORK_OPTIMIZATION_ENABLED) + ")");
71-
72-
log(" [+] Aggressive: Phys(" + s(CatalystConfig.PHYSICS_OPTIMIZATION_ENABLED) +
73-
"), AI(" + s(CatalystConfig.AI_OPTIMIZATION_ENABLED) + ")");
74-
75-
log(" [+] Deferred: Entities(" + s(CatalystConfig.LAZY_BLOCK_ENTITIES_ENABLED) +
76-
"), Tick(" + s(CatalystConfig.LAZY_BLOCK_TICK_ENABLED) +
77-
"), Fluid(" + s(CatalystConfig.LAZY_FLUID_ENABLED) + ")");
81+
log("Configuration:");
82+
log(" Lazy Loading:");
83+
log(" - Block Entities: " + s(CatalystConfig.LAZY_BLOCK_ENTITIES_ENABLED));
84+
log(" - Block Tick: " + s(CatalystConfig.LAZY_BLOCK_TICK_ENABLED));
85+
log(" - Fluid: " + s(CatalystConfig.LAZY_FLUID_ENABLED));
7886
}
7987

8088
private String s(boolean enabled) {

src/main/java/com/criticalrange/CatalystConfig.java

Lines changed: 2 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,7 @@
66
* <p>Allows runtime toggling of all optimization features. All fields are volatile
77
* to ensure thread-safe reads without explicit synchronization.</p>
88
*
9-
* <p>Core Optimizations:</p>
10-
* <ul>
11-
* <li>{@link #TICK_OPTIMIZATION_ENABLED} - Distributes entity updates across multiple ticks</li>
12-
* <li>{@link #ENTITY_TRACKING_ENABLED} - Batches packet sends under load</li>
13-
* <li>{@link #CHUNK_CACHE_ENABLED} - Tracks chunk I/O metrics</li>
14-
* </ul>
15-
*
16-
* <p>Advanced Optimizations:</p>
17-
* <ul>
18-
* <li>{@link #LIGHTING_OPTIMIZATION_ENABLED} - Rate-lights propagation calculations</li>
19-
* <li>{@link #MOVEMENT_OPTIMIZATION_ENABLED} - Throttles location/state updates</li>
20-
* <li>{@link #NETWORK_OPTIMIZATION_ENABLED} - Adaptive packet flush batching</li>
21-
* </ul>
22-
*
23-
* <p>Aggressive Optimizations:</p>
24-
* <ul>
25-
* <li>{@link #PHYSICS_OPTIMIZATION_ENABLED} - Throttles collision and item physics</li>
26-
* <li>{@link #AI_OPTIMIZATION_ENABLED} - Distributes NPC behavior updates</li>
27-
* </ul>
28-
*
29-
* <p>Chunk Loading Optimizations:</p>
9+
* <p>Chunk Loading Optimizations (Lazy Loading):</p>
3010
* <ul>
3111
* <li>{@link #LAZY_BLOCK_ENTITIES_ENABLED} - Defers block entity creation until accessed</li>
3212
* <li>{@link #LAZY_BLOCK_TICK_ENABLED} - Defers ticking block discovery</li>
@@ -41,37 +21,7 @@ public class CatalystConfig {
4121
private CatalystConfig() {
4222
}
4323

44-
// ========== Core Optimizations ==========
45-
46-
/** Enables tick optimization - distributes entity updates across multiple ticks */
47-
public static volatile boolean TICK_OPTIMIZATION_ENABLED = true;
48-
49-
/** Enables entity tracking optimization - batches packet sends under load */
50-
public static volatile boolean ENTITY_TRACKING_ENABLED = true;
51-
52-
/** Enables chunk caching and metrics tracking */
53-
public static volatile boolean CHUNK_CACHE_ENABLED = true;
54-
55-
// ========== Advanced Optimizations ==========
56-
57-
/** Enables lighting optimization - rate-limits propagation calculations */
58-
public static volatile boolean LIGHTING_OPTIMIZATION_ENABLED = true;
59-
60-
/** Enables movement optimization - throttles location/state updates */
61-
public static volatile boolean MOVEMENT_OPTIMIZATION_ENABLED = true;
62-
63-
/** Enables network optimization - adaptive packet flush batching */
64-
public static volatile boolean NETWORK_OPTIMIZATION_ENABLED = true;
65-
66-
// ========== Aggressive Optimizations ==========
67-
68-
/** Enables physics optimization - throttles collision and item physics */
69-
public static volatile boolean PHYSICS_OPTIMIZATION_ENABLED = true;
70-
71-
/** Enables AI optimization - distributes NPC behavior updates */
72-
public static volatile boolean AI_OPTIMIZATION_ENABLED = true;
73-
74-
// ========== Chunk Loading Optimizations ==========
24+
// ========== Chunk Loading Optimizations (Lazy Loading) ==========
7525

7626
/**
7727
* Enables lazy block entity initialization.

0 commit comments

Comments
 (0)