Skip to content

Commit

Permalink
Update gradle workflow version
Browse files Browse the repository at this point in the history
  • Loading branch information
ScribbleTAS committed Dec 4, 2024
1 parent b6d43be commit 3b95faf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.6
gradle-version: 8.10
- name: Build TASmod with Gradle
run: gradle build
- name: Upload Test Report
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/buildandupload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.6
gradle-version: 8.10
- name: Build TASmod with Gradle
run: gradle build
- name: Upload artifact
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@
import net.minecraft.world.NextTickListEntry;
import net.minecraft.world.WorldServer;

/**
* <p>Extends the savestate storage to store {@link NextTickListEntry NextTickListEntries} from the {@link WorldServer}.
* <p>TickListEntries are timed blocks like pressure plates,<br>
* which schedule their update time, when they are pressed.<br>
* The timer that is used is the world time.
* <p>As we can "rewind" the world time with savestates,<br>
* we also have to update the scheduledTime to account for that
* @author Scribble
*/
public class NextTickListEntryStorage extends AbstractExtendStorage {

private Path file = Paths.get("ticklistEntries.json");
Expand All @@ -40,6 +49,7 @@ public void onServerSavestate(MinecraftServer server, int index, Path target, Pa

Path path = current.resolve(SavestateHandlerServer.storageDir).resolve(file);

// Ticklistentries can be in every dimension, so this array stores them one by one. Also supports modded dimensions
JsonArray dimensionJson = new JsonArray();
for (WorldServer world : worlds) {
WorldServerDuck worldserverDuck = (WorldServerDuck) world;
Expand Down Expand Up @@ -89,10 +99,12 @@ public void onServerLoadstate(MinecraftServer server, int index, Path target, Pa
for (JsonElement jsonTickListEntries : dimensionJson) {
JsonArray jsonTickListEntriesArray = jsonTickListEntries.getAsJsonArray();
WorldServer world = worlds[i];

WorldServerDuck worldserverDuck = (WorldServerDuck) world;
Set<NextTickListEntry> tickListEntries = worldserverDuck.getTickListEntriesHashSet();
TreeSet<NextTickListEntry> tickListTreeSet = worldserverDuck.getTickListEntriesTreeSet();

// Clear all existing tickListEntries
tickListEntries.clear();
tickListTreeSet.clear();

Expand Down

0 comments on commit 3b95faf

Please sign in to comment.