Skip to content

Commit

Permalink
Implement {worldPlayer} variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenny-Hui committed Jan 31, 2025
1 parent 5d3f703 commit cff258f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

**New:**
- Disneyland Resorts Line APG now reacts to redstone signal just like built-in APGs in MTR 4
- **JSON PIDS Preset**
- - The PIDS Variable `{worldPlayer}` is now implemented and displayed correctly again

**Changes:**
- Most blocks can now be crafted with a crafting recipe and drop items again, making it possible to use survival mode with JCM (Albeit still need improvements)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,18 @@ private static String parsePIDSVariable(String str, PIDSContext context) {
timeGreetings = "Night";
}

int playerInWorld;
#if LOADER == "forge"
playerInWorld = context.world.data.players().size();
#else
playerInWorld = context.world.data.getPlayers().size();
#endif

return str.replace("{time}", timeString)
.replace("{day}", String.valueOf(worldDay))
.replace("{weather}", weatherString)
.replace("{time_period}", timeGreetings)
.replace("{weatherChin}", weatherChinString)
.replace("{worldPlayer}", "?");
.replace("{worldPlayer}", String.valueOf(playerInWorld));
}
}

0 comments on commit cff258f

Please # to comment.