Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly fix invalid block entities being created #10768

Closed

Conversation

Machine-Maker
Copy link
Member

@Machine-Maker Machine-Maker commented May 22, 2024

Fixes #10750
Replaces #10375 which fixed #10022


This fixes the invalid block entities, not by removing them which the original fix did. that causes data loss as evidenced by the new issue this fixes relating to loot tables disappearing. The correct fix is to not mutate the WorldGenRegion's ProtoChunks when calling BlockGetter#getBlockEntity. Vanilla, if calling getBlockEntity on a block which doesn't have one and has a BlockState that should have one, cretes a BlockEntity and inserts it into the map (the mutation). Then if the block is later changed, the block entity and blockstate might not match. This isn't an issue in vanilla, because getBlockEntity is only caused in very specific places, but the BLockTransformer system was making it be called for every block in order to create a BlockState for the API. The fix is to just get a block entity as well as a "saving callback" in order to write the block entity back to the correct map to save changes to it.


Some testing around on worlds being generated would be appreciated so as to ensure there isn't any new data loss issue that was created.


Download the paperclip jar for this pull request: paper-10768.zip

@Machine-Maker Machine-Maker added the build-pr-jar Enables a workflow to build Paperclip jars on the pull request. label May 22, 2024
@Machine-Maker Machine-Maker requested a review from a team as a code owner May 22, 2024 19:02
@kennytv kennytv added the priority: high This issue is either a gamebreaking bug or crash and needs to be addressed soon. label May 25, 2024
@lynxplay
Copy link
Contributor

Replaced by #10794.

@lynxplay lynxplay closed this May 26, 2024
@Machine-Maker Machine-Maker deleted the fix/invalid-block-entities branch May 28, 2024 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build-pr-jar Enables a workflow to build Paperclip jars on the pull request. priority: high This issue is either a gamebreaking bug or crash and needs to be addressed soon.
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

Underwater ruined portal chests don't spawn loot. Failed to handle packet
3 participants