Skip to content

Commit 48143e1

Browse files
soloturnclaude
andcommitted
fix(headless): actually check readiness in pregenerateChunks
#5024: PrepareWorld.step() loops until worldRenderer.pregenerateChunks() returns true or 5 seconds elapse. HeadlessWorldRenderer.pregenerateChunks() was an unimplemented stub that always returned false, so headless runs (including every MTE test) always burned the full 5 second wait regardless of how quickly the world actually generated. ## Fix Implemented pregenerateChunks() using the same chunk-loaded/local-view check updateChunksInProximity() already performs for per-frame updates: advance chunkProvider, force a full rescan of the current view region, and report done once every chunk in it is loaded. The rescan has to be forced: updateChunksInProximity's own "did the camera move" shortcut is keyed off chunkPos, which never changes in headless (NullCamera reports a constant position), so an unforced call would never re-examine chunk state and permanently report "nothing pending" from its zero-value default - a different way to end up with the always-true failure mode keturn already ran into on a bare `return true`, without ever confirming anything actually loaded. ## Verification :engine:compileJava clean. Ran the full integrationenvironment test suite (engine-tests:integrationTest, 18 MTE test classes covering per-class and per-method lifecycles back-to-back in the same JVM, 34 tests total) - the exact scenario keturn's earlier attempt broke ("first test fine, next one had problems") - all 34 pass, 0 failures. Fixes #5024 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 338d7dd commit 48143e1

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

engine/src/main/java/org/terasology/engine/core/subsystem/headless/renderer/HeadlessWorldRenderer.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,12 @@ public void dispose() {
132132

133133
@Override
134134
public boolean pregenerateChunks() {
135-
// TODO Auto-generated method stub
136-
return false;
135+
chunkProvider.update();
136+
// force=true: updateChunksInProximity's "did the camera move" shortcut never fires here since the
137+
// headless camera position never changes, so a forced full rescan is the only way to learn whether
138+
// every chunk in view distance has actually loaded (see #5024).
139+
updateChunksInProximity(true);
140+
return !pendingChunks;
137141
}
138142

139143
@Override

0 commit comments

Comments
 (0)