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

Add serializer to EntitySnapshot #7509

Open
wants to merge 1 commit into
base: dev/feature
Choose a base branch
from

Conversation

TheLimeGlass
Copy link
Contributor

Description

Add serializer to EntitySnapshot


Target Minecraft Versions: 1.20+
Requirements: none
Related Issues: none

public EntitySnapshot deserialize(Fields fields) throws StreamCorruptedException, NotSerializableException {
EntityFactory factory = Bukkit.getEntityFactory();
String input = fields.getPrimitive("snapshot", String.class);
return factory.createEntitySnapshot(input);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My ONLY worry here is that the server (CraftBukkit/Paper/Whatever), doesn't handle data changes for entity snapshots.
Mojang lately has been changing NBT fields on entities quite a bit.
A user could save their snapshot in MC 1.21.4, and then load it in a future version (let's say 1.21.5), and any changed tags will get ignored.... the returned entity snapshot would have different values than the user originally had "saved", and they may have no clue what is going on.

Exhibit A:
(from a 1.21.5 snapshot)
Screenshot 2025-01-22 at 2 33 21 PM

In this instance, if you saved a Zombie with some cool armor (in 1.21.4), he's going to load (in 1.21.5) as a boring old, unprotected Zombie.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants