2929import net .minecraft .world .NextTickListEntry ;
3030import net .minecraft .world .WorldServer ;
3131
32+ /**
33+ * <p>Extends the savestate storage to store {@link NextTickListEntry NextTickListEntries} from the {@link WorldServer}.
34+ * <p>TickListEntries are timed blocks like pressure plates,<br>
35+ * which schedule their update time, when they are pressed.<br>
36+ * The timer that is used is the world time.
37+ * <p>As we can "rewind" the world time with savestates,<br>
38+ * we also have to update the scheduledTime to account for that
39+ * @author Scribble
40+ */
3241public class NextTickListEntryStorage extends AbstractExtendStorage {
3342
3443 private Path file = Paths .get ("ticklistEntries.json" );
@@ -40,6 +49,7 @@ public void onServerSavestate(MinecraftServer server, int index, Path target, Pa
4049
4150 Path path = current .resolve (SavestateHandlerServer .storageDir ).resolve (file );
4251
52+ // Ticklistentries can be in every dimension, so this array stores them one by one. Also supports modded dimensions
4353 JsonArray dimensionJson = new JsonArray ();
4454 for (WorldServer world : worlds ) {
4555 WorldServerDuck worldserverDuck = (WorldServerDuck ) world ;
@@ -89,10 +99,12 @@ public void onServerLoadstate(MinecraftServer server, int index, Path target, Pa
8999 for (JsonElement jsonTickListEntries : dimensionJson ) {
90100 JsonArray jsonTickListEntriesArray = jsonTickListEntries .getAsJsonArray ();
91101 WorldServer world = worlds [i ];
102+
92103 WorldServerDuck worldserverDuck = (WorldServerDuck ) world ;
93104 Set <NextTickListEntry > tickListEntries = worldserverDuck .getTickListEntriesHashSet ();
94105 TreeSet <NextTickListEntry > tickListTreeSet = worldserverDuck .getTickListEntriesTreeSet ();
95106
107+ // Clear all existing tickListEntries
96108 tickListEntries .clear ();
97109 tickListTreeSet .clear ();
98110
0 commit comments