mirror of
https://github.com/MovingBlocks/Terasology
synced 2026-05-24 09:28:22 +00:00
Merge pull request #5320 from SiliconSaga/review/post-di-phase4
review: remove null CoreRegistry, guard null binds/providers, fix Mermaid
This commit is contained in:
commit
68b01f53db
4 changed files with 22 additions and 15 deletions
|
|
@ -20,8 +20,8 @@ graph TD;
|
|||
subgraph Loading
|
||||
subgraph LoadingUpdate[Update]
|
||||
LoadingLoadingScreenUpdate[LoadingScreen::updateStatus] --> LoadingNUIManagerUpdate[NUIManager]
|
||||
LoadingNUIManagerUpdate--> LoadingStepUpdate[Step Update]
|
||||
subgraph LoadingStepUpdate
|
||||
LoadingNUIManagerUpdate--> LoadingStepUpdate
|
||||
subgraph LoadingStepUpdate[Step Update]
|
||||
direction TB
|
||||
RegisterMods --> InitRenderingHeadlessCheck{!headless}
|
||||
InitRenderingHeadlessCheck -->|true| InitialiseRendering --> InitialiseEntitySystem
|
||||
|
|
|
|||
|
|
@ -182,13 +182,8 @@ public TerasologyEngine(TimeSubsystem timeSubsystem, Collection<EngineSubsystem>
|
|||
rootContextRegistry.with(CharacterStateEventPositionMap.class).lifetime(Lifetime.Singleton).use(() -> characterStateEventPositionMap);
|
||||
DirectionAndOriginPosRecorderList directionAndOriginPosRecorderList = new DirectionAndOriginPosRecorderList();
|
||||
rootContextRegistry.with(DirectionAndOriginPosRecorderList.class).lifetime(Lifetime.Singleton).use(() -> directionAndOriginPosRecorderList);
|
||||
/*
|
||||
* We can't load the engine without core registry yet.
|
||||
* e.g. the statically created MaterialLoader needs the CoreRegistry to get the AssetManager.
|
||||
* And the engine loads assets while it gets created.
|
||||
*/
|
||||
// TODO: Remove
|
||||
CoreRegistry.setContext(rootContext);
|
||||
// Clear any stale context — rootContext is set in initialize().
|
||||
CoreRegistry.setContext(null);
|
||||
|
||||
this.allSubsystems = Queues.newArrayDeque();
|
||||
configurationSubsystem = new ConfigurationSubsystem();
|
||||
|
|
|
|||
|
|
@ -420,11 +420,11 @@ public List<Input> getInputsForBindButton(SimpleUri bindId) {
|
|||
}
|
||||
}
|
||||
|
||||
if (mouseWheelUpBind.getId().equals(bindId)) {
|
||||
if (mouseWheelUpBind != null && mouseWheelUpBind.getId().equals(bindId)) {
|
||||
inputs.add(MouseInput.WHEEL_UP);
|
||||
}
|
||||
|
||||
if (mouseWheelDownBind.getId().equals(bindId)) {
|
||||
if (mouseWheelDownBind != null && mouseWheelDownBind.getId().equals(bindId)) {
|
||||
inputs.add(MouseInput.WHEEL_DOWN);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -267,11 +267,19 @@ private void waitForCompletionOfPreviousSave() {
|
|||
}
|
||||
|
||||
private SaveTransaction createSaveTransaction() {
|
||||
ChunkProvider chunkProviderInstance = chunkProvider != null ? chunkProvider.get() : null;
|
||||
NetworkSystem networkSystemInstance = networkSystem != null ? networkSystem.get() : null;
|
||||
if (chunkProviderInstance == null) {
|
||||
throw new IllegalStateException("Cannot save: ChunkProvider not available");
|
||||
}
|
||||
if (networkSystemInstance == null) {
|
||||
throw new IllegalStateException("Cannot save: NetworkSystem not available");
|
||||
}
|
||||
SaveTransactionBuilder saveTransactionBuilder = new SaveTransactionBuilder(privateEntityManager,
|
||||
entitySetDeltaRecorder, isStoreChunksInZips(), getStoragePathProvider(), worldDirectoryWriteLock,
|
||||
recordAndReplaySerializer, recordAndReplayUtils, recordAndReplayCurrentStatus);
|
||||
addChunksToSaveTransaction(saveTransactionBuilder, chunkProvider.get());
|
||||
addPlayersToSaveTransaction(saveTransactionBuilder, networkSystem.get());
|
||||
addChunksToSaveTransaction(saveTransactionBuilder, chunkProviderInstance);
|
||||
addPlayersToSaveTransaction(saveTransactionBuilder, networkSystemInstance);
|
||||
addGlobalStoreBuilderToSaveTransaction(saveTransactionBuilder);
|
||||
addGameManifestToSaveTransaction(saveTransactionBuilder);
|
||||
|
||||
|
|
@ -403,9 +411,13 @@ public void update() {
|
|||
}
|
||||
|
||||
private boolean isRunModeAllowSaving() {
|
||||
if (networkSystem == null || chunkProvider == null) {
|
||||
return false;
|
||||
}
|
||||
NetworkSystem networkSystemInstance = networkSystem.get();
|
||||
return networkSystemInstance != null && networkSystemInstance.getMode().isAuthority() && chunkProvider.get() != null
|
||||
&& blockManager != null;
|
||||
ChunkProvider chunkProviderInstance = chunkProvider.get();
|
||||
return networkSystemInstance != null && networkSystemInstance.getMode().isAuthority()
|
||||
&& chunkProviderInstance != null && blockManager != null;
|
||||
}
|
||||
|
||||
private void startSaving() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue