26
26
import org .terasology .engine .core .modes .loadProcesses .InitialisePhysics ;
27
27
import org .terasology .engine .core .modes .loadProcesses .InitialiseRecordAndReplay ;
28
28
import org .terasology .engine .core .modes .loadProcesses .InitialiseRemoteWorld ;
29
+ import org .terasology .engine .core .modes .loadProcesses .InitialiseRendering ;
29
30
import org .terasology .engine .core .modes .loadProcesses .InitialiseSystems ;
30
31
import org .terasology .engine .core .modes .loadProcesses .InitialiseWorld ;
31
32
import org .terasology .engine .core .modes .loadProcesses .InitialiseWorldGenerator ;
32
- import org .terasology .engine .core .modes .loadProcesses .InitialiseRendering ;
33
33
import org .terasology .engine .core .modes .loadProcesses .JoinServer ;
34
34
import org .terasology .engine .core .modes .loadProcesses .LoadEntities ;
35
35
import org .terasology .engine .core .modes .loadProcesses .LoadExtraBlockData ;
@@ -110,8 +110,10 @@ public void init(GameEngine engine) {
110
110
111
111
systemConfig = context .get (SystemConfig .class );
112
112
113
- this .nuiManager = new NUIManagerInternal ((TerasologyCanvasRenderer ) context .get (CanvasRenderer .class ), context );
114
- context .put (NUIManager .class , nuiManager );
113
+ if (netMode .hasLocalClient ()) {
114
+ this .nuiManager = new NUIManagerInternal ((TerasologyCanvasRenderer ) context .get (CanvasRenderer .class ), context );
115
+ context .put (NUIManager .class , nuiManager );
116
+ }
115
117
116
118
EngineTime time = (EngineTime ) context .get (Time .class );
117
119
time .setPaused (true );
@@ -134,9 +136,10 @@ public void init(GameEngine engine) {
134
136
}
135
137
136
138
popStep ();
137
- loadingScreen = nuiManager .pushScreen ("engine:loadingScreen" , LoadingScreen .class );
138
- loadingScreen .updateStatus (current .getMessage (), current .getProgress ());
139
-
139
+ if (nuiManager != null ) {
140
+ loadingScreen = nuiManager .pushScreen ("engine:loadingScreen" , LoadingScreen .class );
141
+ loadingScreen .updateStatus (current .getMessage (), current .getProgress ());
142
+ }
140
143
chunkGenerationStarted = false ;
141
144
}
142
145
@@ -167,16 +170,20 @@ private void initClient() {
167
170
168
171
private void initHost () {
169
172
loadProcesses .add (new RegisterMods (context , gameManifest ));
170
- if (netMode .hasLocalClient ()) {
173
+ if (netMode .hasLocalClient ()) {
171
174
loadProcesses .add (new InitialiseRendering (context ));
172
175
}
173
176
loadProcesses .add (new InitialiseEntitySystem (context ));
174
177
loadProcesses .add (new RegisterBlocks (context , gameManifest ));
175
- loadProcesses .add (new InitialiseGraphics (context ));
178
+ if (netMode .hasLocalClient ()) {
179
+ loadProcesses .add (new InitialiseGraphics (context ));
180
+ }
176
181
loadProcesses .add (new LoadPrefabs (context ));
177
182
loadProcesses .add (new ProcessBlockPrefabs (context ));
178
183
loadProcesses .add (new InitialiseComponentSystemManager (context ));
179
- loadProcesses .add (new RegisterInputSystem (context ));
184
+ if (netMode .hasLocalClient ()) {
185
+ loadProcesses .add (new RegisterInputSystem (context ));
186
+ }
180
187
loadProcesses .add (new RegisterSystems (context , netMode ));
181
188
loadProcesses .add (new InitialiseCommandSystem (context ));
182
189
loadProcesses .add (new LoadExtraBlockData (context ));
@@ -252,14 +259,17 @@ public void update(float delta) {
252
259
}
253
260
}
254
261
if (current == null ) {
255
- nuiManager .closeScreen (loadingScreen );
256
- nuiManager .setHUDVisible (true );
262
+ if (nuiManager != null ) {
263
+ nuiManager .closeScreen (loadingScreen );
264
+ nuiManager .setHUDVisible (true );
265
+ }
257
266
context .get (GameEngine .class ).changeState (new StateIngame (gameManifest , context ));
258
267
} else {
259
268
float progressValue = (progress + current .getExpectedCost () * current .getProgress ()) / maxProgress ;
260
- loadingScreen .updateStatus (current .getMessage (), progressValue );
261
- nuiManager .update (delta );
262
-
269
+ if (nuiManager != null ) {
270
+ loadingScreen .updateStatus (current .getMessage (), progressValue );
271
+ nuiManager .update (delta );
272
+ }
263
273
// chunk generation begins at the AwaitCharacterSpawn step
264
274
if (current instanceof AwaitCharacterSpawn && !chunkGenerationStarted ) {
265
275
chunkGenerationStarted = true ;
@@ -280,7 +290,9 @@ public void update(float delta) {
280
290
281
291
@ Override
282
292
public void render () {
283
- nuiManager .render ();
293
+ if (nuiManager != null ) {
294
+ nuiManager .render ();
295
+ }
284
296
}
285
297
286
298
@ Override
0 commit comments