Skip to content

Support for snapshot 21w43a (Minecraft 1.18)#169

Merged
Fenixin merged 1 commit intomasterfrom
unknown repository
Dec 19, 2021
Merged

Support for snapshot 21w43a (Minecraft 1.18)#169
Fenixin merged 1 commit intomasterfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Nov 8, 2021

Hello ! ^^
In the 1.18 snapshot 21w43a, the Level tag doesn't exist anymore.
It means that for region chunks (Not entities or POI), data is now stored at the root of the chunk.
Changes in the code :

  • Detect chunk type with a central function (get_chunk_type()).
  • Adjustements on REGION chunks which do not have the Level tag.
  • Fix entities deletion in 1.17 entities chunks and 1.18 level chunks (Which shouldn't happen).

Wiki : https://minecraft.fandom.com/wiki/Java_Edition_21w43a

Important note : I use the tag DataVersion, which I think is the best thing to do.
I don't know if Mojang will make other changes, but just in case, please do not merge this PR yet, I think it's better to wait.
Have a nice day ! ^^

@Fenixin
Copy link
Copy Markdown
Owner

Fenixin commented Nov 9, 2021

Thank you!

I'll try to look into this the following days but I'm in a busy week.

@ghost
Copy link
Copy Markdown
Author

ghost commented Nov 11, 2021

Update : 1.18 pre-release 1 is out today, no other changes to report. Yay !
https://minecraft.fandom.com/wiki/Java_Edition_1.18_Pre-release_1

@ghost
Copy link
Copy Markdown
Author

ghost commented Nov 29, 2021

Update 1.18 will be released tomorrow, and there is no other change to world storage. Yay ! ^^
https://minecraft.fandom.com/wiki/Java_Edition_1.18#General_2

If you have some time, you can test this PR, and merge it if it's okay for you.

@Fenixin
Copy link
Copy Markdown
Owner

Fenixin commented Nov 29, 2021

Again, thank you for keeping track of the changes, I'll review this soon. I can review the code and test with the worlds I have around in a few days (this weekend if the week keeps being so busy).

@ghost
Copy link
Copy Markdown
Author

ghost commented Nov 29, 2021

You're welcome. Take your time for testing ! ^^

@prenetic
Copy link
Copy Markdown

prenetic commented Dec 16, 2021

Trying this out with a 1.5 world that was migrated forward through each major Minecraft version to 1.18 and I'm running into the following exception, not sure if this is relevant but noticed it's from get_chunk_type(). Happy to provide a copy of the world if necessary.

--------- Scanning region, POI and entities files ----------
Scanned region\r.-1.-1.mca (c:0, w:0, tme:0, so:0, mt:0, t:1024)...... 1/507
Scanned region\r.-1.-10.mca (c:0, w:0, tme:0, so:0, mt:0, t:0)......... 2/507
Scanned region\r.-1.-2.mca (c:0, w:0, tme:0, so:0, mt:0, t:1024)...... 3/507
Scanned region\r.-1.-3.mca (c:0, w:0, tme:0, so:0, mt:0, t:1024)...... 4/507
Scanned region\r.-1.-4.mca (c:0, w:0, tme:0, so:0, mt:0, t:1024)...... 5/507
Scanned region\r.-1.-5.mca (c:0, w:0, tme:0, so:0, mt:0, t:1024)...... 6/507
Scanned region\r.-1.-6.mca (c:0, w:0, tme:0, so:0, mt:0, t:1012)...... 7/507


Ops! Something went really wrong and regionfixer crashed.


Bug report:

**********
*** Exception while scanning:
*** r.-1.-7.mca
**********
*** Printing the child's traceback:
*** Exception:<class 'AssertionError'>Unrecognized chunk type in get_chunk_type().
**********
*** File E:\Source\Repos\Minecraft-Region-Fixer\regionfixer_core\scan.py, line 810, in scan_region_file
***   chunk, tup = scan_chunk(region_file,**********
*** File E:\Source\Repos\Minecraft-Region-Fixer\regionfixer_core\scan.py, line 913, in scan_chunk
***   chunk_type = world.get_chunk_type(chunk)**********
*** File E:\Source\Repos\Minecraft-Region-Fixer\regionfixer_core\world.py, line 1847, in get_chunk_type
***   raise AssertionError("Unrecognized chunk type in get_chunk_type().")
**********

@ghost
Copy link
Copy Markdown
Author

ghost commented Dec 16, 2021

Hello @prenetic ! ^^
Thank you for your test.
This is strange. Does a similar error happens with the current version ? You should see the following exception :

AssertionError("Unrecognized scanned chunk in scan_chunk().")

Because get_chunk_type() works the same as the chunk type detection in scan_chunk().
By the way, I would be glad if you could give me a copy of the world ? Or just the region\r.-1.-6.mca file.
Have a nice day !

@prenetic
Copy link
Copy Markdown

Yes that's correct, I receive AssertionError("Unrecognized scanned chunk in scan_chunk().") with the current version. I've attached both r.-1.-6.mca and r.-1.-7.mca since the exception seems to indicate an issue scanning the latter. Perhaps this is a different 1.18 compatibility issue.

region.zip

@ghost
Copy link
Copy Markdown
Author

ghost commented Dec 16, 2021

Thank you for those files. If I'm correct, this is an 1.18 world ?
Did you create it with 1.18, or is it an updated world ?

@ghost
Copy link
Copy Markdown
Author

ghost commented Dec 16, 2021

@prenetic It should be fixed now. ^^
Thank you very much for your tests ! :D

@prenetic
Copy link
Copy Markdown

Thank you for those files. If I'm correct, this is an 1.18 world ? Did you create it with 1.18, or is it an updated world ?

This is a VERY old world, I don't know exactly how old, but it was created pre-Anvil. I upgraded through every major release since then, and is currently a loaded as a 1.18 world.

I'll give your latest update another shot in the morning (it's late here), but if you don't hear back then no news is good news. :)

@prenetic
Copy link
Copy Markdown

Grabbed the latest and gave it another shot (through 3f3fcb1). Just to confirm, this does seem to be an issue with the world converted to 1.18. I pulled down a copy of the world from back when it was still 1.5 and the scans go through just fine. I don't have a copy of any intermediate conversions between the two versions for testing. Below is the latest exception and offending region file.

r.-1.0.mca.zip

--------- Scanning region, POI and entities files ----------
9 of 507|                                                        |ETA:  0:15:36

Ops! Something went really wrong and regionfixer crashed.


Bug report:

**********
*** Exception while scanning:
*** r.-1.0.mca
**********
*** Printing the child's traceback:
*** Exception:<class 'AssertionError'>Unrecognized chunk type in get_chunk_type().
**********
*** File E:\Source\Repos\Minecraft-Region-Fixer\regionfixer_core\scan.py, line 810, in scan_region_file
***   chunk, tup = scan_chunk(region_file,**********
*** File E:\Source\Repos\Minecraft-Region-Fixer\regionfixer_core\scan.py, line 913, in scan_chunk
***   chunk_type = world.get_chunk_type(chunk)**********
*** File E:\Source\Repos\Minecraft-Region-Fixer\regionfixer_core\world.py, line 1856, in get_chunk_type
***   raise AssertionError("Unrecognized chunk type in get_chunk_type().")
**********

@ghost
Copy link
Copy Markdown
Author

ghost commented Dec 16, 2021

Thank you for this new test.
The same problem is occurring : The tag that I use to tell that this is a region chunk (And not entities or POI) doesn't exists.
So, sections isn't mandatory, nor TerrainPopulated...
This is strange. I don't know if it's a Minecraft bug, or if it's normal, and there is no documentation.

@ghost
Copy link
Copy Markdown
Author

ghost commented Dec 16, 2021

@prenetic Here is another try : dd44ce4

@Fenixin
Copy link
Copy Markdown
Owner

Fenixin commented Dec 16, 2021

Hello! I'll dive into this and try to help this weekend. @734F96, thanks!!

@ghost
Copy link
Copy Markdown
Author

ghost commented Dec 16, 2021

@Fenixin You're welcome. ^^
Also, I took the liberty to answer to issues about 1.18 support (#170, #171, #172 and #173).

@prenetic
Copy link
Copy Markdown

@prenetic Here is another try : dd44ce4

Looks like that may have done the trick! I successfully scanned all of the migrated worlds that were leading to issues (overworld, nether, and end dimensions). :)

@ghost
Copy link
Copy Markdown
Author

ghost commented Dec 18, 2021

Thanks for the confirmation @prenetic ! :D
I merged my commits into one to make it easier for @Fenixin. ^^

In this snapshot, the "Level" tag doesn't exist anymore
It means that for region chunks (Not entities or POI), data is now stored at the root of the chunk
Changes in the code :
- Detect chunk type with a function ("get_chunk_type()"), to avoid code duplication
- Adjustements on REGION chunks which do not have the "Level" tag
- Fix entities deletion in 1.17 entities chunks and 1.18 level chunks (Which shouldn't happen)
Important note : I use the tag "DataVersion", which I think is the best thing to do
@Fenixin Fenixin merged commit 0102f77 into Fenixin:master Dec 19, 2021
@Fenixin
Copy link
Copy Markdown
Owner

Fenixin commented Dec 19, 2021

Merged! Thank you!

@Fenixin
Copy link
Copy Markdown
Owner

Fenixin commented Dec 19, 2021

I want to do a few more test with old and broken worlds, but I have delayed this enough.

@ghost
Copy link
Copy Markdown
Author

ghost commented Dec 19, 2021

Hello ! You're welcome @Fenixin ! ^^
It's a always a good idea to make more tests. If you find some errors, you can report them to me and I will try to fix them. ;)

@ghost
Copy link
Copy Markdown
Author

ghost commented Dec 19, 2021

@Fenixin
https://github.com/Fenixin/Minecraft-Region-Fixer/releases/tag/v0.3.5
"if you are using this version you should thank him!"
Thanks for the mention, but it's "her". ^^

@Fenixin
Copy link
Copy Markdown
Owner

Fenixin commented Dec 19, 2021

Ups! I'm really sorry! I've just fixed it!

@ghost
Copy link
Copy Markdown
Author

ghost commented Dec 19, 2021

@Fenixin No problem, thanks for the fix. :D
Have a nice evening ! ^^

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