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

Deserialize crashes on empty sections #31

Closed
prydin opened this issue Jun 20, 2019 · 4 comments
Closed

Deserialize crashes on empty sections #31

prydin opened this issue Jun 20, 2019 · 4 comments

Comments

@prydin
Copy link
Contributor

prydin commented Jun 20, 2019

With Minecraft 1.14, there are sometimes empty sections in the chunks. They look something like this:

image

Not sure why they appear, but they should be handled gracefully.

The code in Chunk.deserialize() tries to create a new Section here:

this.sections[section.getByte("Y")] = new Section(section);

...but fails on a NullPointerException in the Section constructor since there's no Palette member here:

palette = sectionRoot.getListTag("Palette").asCompoundTagList();

@Querz
Copy link
Owner

Querz commented Jun 20, 2019

Ah yes, I faced this problem already some time ago in the MCASelector but didn't think this would be a problem here.
I'll fix that this weekend.

@Querz
Copy link
Owner

Querz commented Jun 24, 2019

I added an extra check for sections that have a Y index outside of 0-15 and a check for palette content. Empty sections like those added by Minecraft will be treated as non-existent.

The changes are currently available with the latest commit on the master branch, if everything works fine i'll make a release.

@prydin
Copy link
Contributor Author

prydin commented Jun 24, 2019

I uncovered another issue. Sometimes you have a valid index, but the section is still empty (or at least missing the Palette). Here's how I addressed that:

https://github.com/prydin/NBT/blob/18761711dc4b88ecb3a68dd8e53b746693ffbbb9/src/main/java/net/querz/nbt/mca/Chunk.java#L75

@Querz
Copy link
Owner

Querz commented Jun 25, 2019

Yes, I also addressed this issue, see
https://github.com/Querz/NBT/blob/master/src/main/java/net/querz/nbt/mca/Section.java#L21
If a Section is missing the Palette, it will be "empty" and won't be added to the chunk:
https://github.com/Querz/NBT/blob/master/src/main/java/net/querz/nbt/mca/Chunk.java#L75

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

No branches or pull requests

2 participants