@@ -43,7 +43,6 @@ public class TimeLoop implements ModInitializer {
4343 public boolean trackTimeOfDay ;
4444 public boolean isLooping ;
4545 public int maxLoops ;
46- public String sceneName ;
4746 private int tickCounter = 0 ; // Tracks elapsed ticks
4847 public int ticksLeft ;
4948
@@ -56,7 +55,7 @@ public class TimeLoop implements ModInitializer {
5655 public TimeLoopConfig config ;
5756
5857 // The loop scene manager object
59- private LoopSceneManager loopSceneManager ;
58+ public LoopSceneManager loopSceneManager ;
6059
6160 // Get the world folder path for config/recording loading
6261 private Path worldFolder ;
@@ -65,7 +64,6 @@ public class TimeLoop implements ModInitializer {
6564 @ Override
6665 public void onInitialize () {
6766 LOOP_LOGGER .info ("Initializing TimeLoop mod" );
68- loopSceneManager = new LoopSceneManager (config );
6967
7068 // Register the custom ArgumentType
7169 ArgumentTypeRegistry .registerArgumentType (Identifier .of ("timeloop" ,"" ), LoopTypesArgumentType .class , ConstantArgumentSerializer .of (LoopTypesArgumentType ::new ));
@@ -92,20 +90,24 @@ public void onInitialize() {
9290 worldFolder = server .getSavePath (WorldSavePath .ROOT );
9391 config = TimeLoopConfig .load (worldFolder );
9492
93+ // Loop scene manager
94+ loopSceneManager = new LoopSceneManager (config );
95+
9596 loopIteration = config .loopIteration ;
9697 loopLengthTicks = config .loopLengthTicks ;
9798 isLooping = config .isLooping ;
9899 startTimeOfDay = config .startTimeOfDay ;
99100 timeSetting = config .timeSetting ;
100101 trackTimeOfDay = config .trackTimeOfDay ;
101102 ticksLeft = config .ticksLeft ;
102- sceneName = config .sceneName ;
103103
104104 showLoopInfo = config .showLoopInfo ;
105105 displayTimeInTicks = config .displayTimeInTicks ;
106106 trackItems = config .trackItems ;
107107 loopType = config .loopType ;
108108
109+ loopSceneManager .setRecordingPlayers (config .recordingPlayers );
110+
109111 TimeLoop .server = server ;
110112 serverWorld = server .getOverworld ();
111113
@@ -121,6 +123,14 @@ public void onInitialize() {
121123 executeCommand ("mocap settings recording entity_tracking_distance 1" );
122124
123125 updateEntitiesToTrack (trackItems );
126+
127+ try {
128+ loopSceneManager .forEachPlayerSceneName (playerSceneName -> {
129+ executeCommand (String .format ("mocap scenes add %s" , playerSceneName ));
130+ });
131+ } catch (Error e ) {
132+ LOOP_LOGGER .error ("Failed to add player scenes to mocap scenes: {}" , e .getMessage ());
133+ }
124134 });
125135
126136 ServerLifecycleEvents .SERVER_STOPPING .register (server -> {
@@ -164,6 +174,7 @@ public void onInitialize() {
164174 loopBossBar .removePlayer (player );
165175 if (isLooping ) {
166176 saveRecordings ();
177+ loopSceneManager .saveRecordingPlayers ();
167178 }
168179 });
169180
@@ -216,7 +227,7 @@ public void startLoop() {
216227 LOOP_LOGGER .info ("Attempted to start already running recording loop" );
217228 return ;
218229 }
219- if (showLoopInfo ) {loopBossBar .visible (true );}
230+ if (showLoopInfo ) { loopBossBar .visible (true ); }
220231 isLooping = true ;
221232 config .isLooping = true ;
222233 tickCounter = 0 ;
@@ -237,7 +248,7 @@ private void runLoopIteration() {
237248 executeCommand ("mocap playback stop_all including_others" );
238249
239250 loopSceneManager .forEachPlayerSceneName (playerSceneName -> {
240- executeCommand (String .format ("mocap playback start .%s" , loopSceneManager . getPlayerSceneName ( playerSceneName ) ));
251+ executeCommand (String .format ("mocap playback start .%s" , playerSceneName ));
241252 });
242253
243254 loopIteration ++;
@@ -285,6 +296,7 @@ public void stopLoop() {
285296 config .isLooping = false ;
286297 loopBossBar .visible (false );
287298 saveRecordings ();
299+ loopSceneManager .saveRecordingPlayers ();
288300 executeCommand ("mocap playback stop_all including_others" );
289301 tickCounter = 0 ;
290302 ticksLeft = loopLengthTicks ;
0 commit comments