@@ -87,45 +87,51 @@ public boolean render(MapChunkCache mapChunkCache, String s) {
87
87
map .cameraAdapter .apply (scene .camera (), tx , ty , map .getMapZoomOutLevels (),
88
88
world .getExtraZoomOutLevels ());
89
89
90
- if (renderer instanceof RemoteRenderer && ((RemoteRenderer ) renderer )
91
- .shouldInitializeLocally ()) {
92
- scene .loadChunks (SilentTaskTracker .INSTANCE , chunkyWorld ,
93
- perspective .getRequiredChunks (this ).stream ()
90
+ if (renderer instanceof RemoteRenderer ) {
91
+ if (((RemoteRenderer ) renderer ).shouldInitializeLocally ()) {
92
+ scene .loadChunks (SilentTaskTracker .INSTANCE , chunkyWorld ,
93
+ perspective .getRequiredChunks (this ).stream ()
94
+ .flatMap (c -> getChunksAround (c .x , c .z , map .getChunkPadding ()).stream ())
95
+ .collect (Collectors .toSet ()));
96
+ scene .getActors ().removeIf (actor -> actor instanceof PlayerEntity );
97
+ try {
98
+ scene .saveScene (context , new TaskTracker (ProgressListener .NONE ));
99
+ } catch (IOException e ) {
100
+ throw new RuntimeException ("Could not save scene" , e );
101
+ }
102
+ } else {
103
+ try {
104
+ Field chunks = Scene .class .getDeclaredField ("chunks" );
105
+ chunks .setAccessible (true );
106
+ Collection <ChunkPosition > chunksList = (Collection <ChunkPosition >) chunks .get (scene );
107
+ chunksList .clear ();
108
+ chunksList .addAll (perspective .getRequiredChunks (this ).stream ()
94
109
.flatMap (c -> getChunksAround (c .x , c .z , map .getChunkPadding ()).stream ())
95
110
.collect (Collectors .toSet ()));
96
- scene .getActors ().removeIf (actor -> actor instanceof PlayerEntity );
97
- try {
98
- scene .saveScene (context , new TaskTracker (ProgressListener .NONE ));
99
- } catch (IOException e ) {
100
- throw new RuntimeException ("Could not save scene" , e );
111
+ } catch (ReflectiveOperationException e ) {
112
+ throw new RuntimeException ("Could not set chunks" , e );
113
+ }
114
+ try {
115
+ Field worldPath = Scene .class .getDeclaredField ("worldPath" );
116
+ worldPath .setAccessible (true );
117
+ worldPath .set (scene , bukkitWorld .getWorldFolder ().getAbsolutePath ());
118
+ Field worldDimension = Scene .class .getDeclaredField ("worldDimension" );
119
+ worldDimension .setAccessible (true );
120
+ worldDimension .setInt (scene , bukkitWorld .getEnvironment ().getId ());
121
+ } catch (ReflectiveOperationException e ) {
122
+ throw new RuntimeException ("Could not set world" , e );
123
+ }
124
+ try {
125
+ scene .saveDescription (context .getSceneDescriptionOutputStream (scene .name ));
126
+ } catch (IOException e ) {
127
+ throw new RuntimeException ("Could not save scene" , e );
128
+ }
101
129
}
102
130
} else {
103
- try {
104
- Field chunks = Scene .class .getDeclaredField ("chunks" );
105
- chunks .setAccessible (true );
106
- Collection <ChunkPosition > chunksList = (Collection <ChunkPosition >) chunks .get (scene );
107
- chunksList .clear ();
108
- chunksList .addAll (perspective .getRequiredChunks (this ).stream ()
109
- .flatMap (c -> getChunksAround (c .x , c .z , map .getChunkPadding ()).stream ())
110
- .collect (Collectors .toSet ()));
111
- } catch (ReflectiveOperationException e ) {
112
- throw new RuntimeException ("Could not set chunks" , e );
113
- }
114
- try {
115
- Field worldPath = Scene .class .getDeclaredField ("worldPath" );
116
- worldPath .setAccessible (true );
117
- worldPath .set (scene , bukkitWorld .getWorldFolder ().getAbsolutePath ());
118
- Field worldDimension = Scene .class .getDeclaredField ("worldDimension" );
119
- worldDimension .setAccessible (true );
120
- worldDimension .setInt (scene , bukkitWorld .getEnvironment ().getId ());
121
- } catch (ReflectiveOperationException e ) {
122
- throw new RuntimeException ("Could not set world" , e );
123
- }
124
- try {
125
- scene .saveDescription (context .getSceneDescriptionOutputStream (scene .name ));
126
- } catch (IOException e ) {
127
- throw new RuntimeException ("Could not save scene" , e );
128
- }
131
+ scene .loadChunks (SilentTaskTracker .INSTANCE , chunkyWorld ,
132
+ perspective .getRequiredChunks (this ).stream ()
133
+ .flatMap (c -> getChunksAround (c .x , c .z , map .getChunkPadding ()).stream ())
134
+ .collect (Collectors .toSet ()));
129
135
}
130
136
}).thenApply ((image ) -> {
131
137
MapStorage var52 = world .getMapStorage ();
0 commit comments