Repository navigation
Add advancements - #1243
Closed
vlado00001 wants to merge 2 commits into
Closed
Add advancements#1243vlado00001 wants to merge 2 commits into
vlado00001 wants to merge 2 commits into
Conversation
|
The description of this PR reeks of AI. Most of the advancement JSON files are completely empty and the crate this PR adds is never used anywhere. This is not ready to be merged. |
Collaborator
You're absolutely right. |
Member
|
@vlado00001 The CI is failing, do you still work on this?, when yes you should mark it as draft |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This new system automatically reads and organizes Minecraft advancement files- the code scans folders like "Story" or "Nether" and creates a live map of every goal in the game. This makes it easy for server owners to add custom advancements just by dropping a file into a folder, without ever touching the actual code.
To keep the server running smoothly, all this information is stored in a HashMap during startup. This means the server can instantly check if a player earned an achievement—like mining a diamond—without slowing down the game or causing lag. It also includes "safety brakes" that prevent the server from crashing if a file is broken or formatted incorrectly, simply skipping the bad file and keeping the game running.
By tracking "parent" links between goals, the system understands the proper order of progression, ensuring players can't skip ahead to end-game rewards.
Testing
The test_load_advancements test performs the following checks:
-Directory Discovery: Confirms the system can find and enter the src/advancements/minecraft folders.
-Data Integrity: Validates that key advancements (like minecraft:story/root) are not only loaded but contain the correct titles and criteria.
-Error Resilience: Verifies that the AdvancementMap remains functional and populates fallback data even if a JSON file is missing expected fields.
-To run this specific test, use: cargo test advancements::tests::test_load_advancements