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

Multiple issues when offsetting imported chunks #30

Closed
daniel4farias opened this issue Aug 12, 2019 · 13 comments
Closed

Multiple issues when offsetting imported chunks #30

daniel4farias opened this issue Aug 12, 2019 · 13 comments
Labels
bug Something isn't working

Comments

@daniel4farias
Copy link

I am trying to merge two worlds by offsetting all the chunks in world B by +1024 chunks (x).

I encountered some issues in the process, and am wondering if there is a workaround.

First, I had to individually import all files greater than 2MB or the importer would get stuck indefinitely. This took a while but eventually it seemed to work.

When I teleported to the new location, things seemed fine at first, but when I try moving further away the world stops loading new chunks and it isnt able to save when exiting.

Also, all the chests seemed to have been deleted, but they are "invisible" until touched, at which point I noticed all of the chest data (items) were deleted and the chests were empty. Is this intended?

@Querz Querz added the bug Something isn't working label Aug 25, 2019
@Querz
Copy link
Owner

Querz commented Aug 28, 2019

Sorry for the delay in responding, I was on holiday :)

From my experiences with .schematic files I wrongly assumed that region files store coordinates of tile entities, entities and bounding boxes relative to the chunk location.
I'll need to look through everything that uses absolute coordinates:

  • entities
  • tile entities (everything that stores more than the block state like containers or note blocks)
  • bounding boxes of structures

If you know of anything else that might be affected, please let me know.

@daniel4farias
Copy link
Author

daniel4farias commented Aug 28, 2019

Thanks for responding! Here is a list of entities that may have to be offset for it to work:

https://pastebin.com/c39xHTii

@Querz
Copy link
Owner

Querz commented Aug 30, 2019

Thank you very much!
While working on this I found some more places where Minecraft uses absolute coordinates.
They are:

  • Chunk location (absolute chunk coordinates)
  • Entities:
    • Location
    • Location of the fence block when they are leashed to a fence
    • Location of their sleeping place
    • Dolphins:
      • Location of a treasure chest
    • Phantoms:
      • Location they are aiming for when they do their dive attack
    • Shulkers:
      • "Approximate" location (?)
    • Turtles:
      • Location of their breeding ground
      • Location where they travel to
    • Vex:
      • Location of a box where they stay in (?)
    • Wandering trader:
      • Location where they wander to
    • Shulker bullet:
      • Location of the shulker that shot it
      • Target location
    • End crystal:
      • Beam target location
    • Item frames, Paintings:
      • Location of the block they are attached to
    • Villager:
      • Location of their meeting point
      • Location of their job site
      • Location of their home
    • Pillager, Witch, Vindicator, Ravager, Illusioner, Evoker:
      • Patrol target location
  • Tile entities:
    • Location
    • Bee hive:
      • Location of a near flower
    • End gateway:
      • Target location
  • Tile ticks:
    • Locations of the ticked tiles
  • Liquid ticks:
    • Locations of the ticked liquids
  • Structures:
    • Reference locations (locations of structures that make up a bigger structure like a village)
    • Starts:
      • Chunk location of the structure
      • Bounding box of the structure
      • Chunk location of processed structures (ocean monuments)
      • Children:
        • The origin coordinates of ocean monuments and shipwrecks
        • The origin coordinates of village parts
        • Bounding box of the structure
        • Bounding boxes of entrances (mine shafts)
        • Junction locations for villages

I made a branch that applies alle those changes if you would like to test it:
https://github.com/Querz/mcaselector/tree/chunk-import-offset-fix

I only had the time to do a very simple test using cows and a sign. :)

@daniel4farias
Copy link
Author

Thanks for the quick fix! I'm used to using the exe with the GUI to run this. Could you point me to the directions on how to use the source files you linked directly?

@Querz
Copy link
Owner

Querz commented Sep 2, 2019

Here's a compiled version: mcaselector-1.8.2-all.jar.zip

@daniel4farias
Copy link
Author

Incredible! I spent ~30 minutes testing all the corner cases and entities I could think of and everything seems in place. 0 crashes, 0 issues, all items and chests unaffected. Works perfectly as far as I can tell.

@daniel4farias
Copy link
Author

Actually, there may still be an issue. When I went to import the region files not all of them get properly imported:

https://imgur.com/a/Ac4WJxG

Any idea what could be causing this? When I try to import the region files directly, it still won't work. They did import nominally under 1.8.1, though without properly handling entities so the game would crash. Now it seems to not be importing at all.

@daniel4farias
Copy link
Author

daniel4farias commented Sep 3, 2019

Here are two region files demonstrating this (11MB):

https://drive.google.com/drive/folders/1-N6DSiKHl99T6IBYYIwEJlvioPLtefFA?usp=sharing

One of the files successfully imports (0,0), the other one is skipped (0,-1). Even when importing with zero offset, that region is skipped.

@Querz
Copy link
Owner

Querz commented Sep 3, 2019

Thanks for testing!

cannot cast ListTag<ByteTag> to ListTag<CompoundTag>

Apparently Mojang decided to sometimes have a list of byte tags to save entities (???).
I added a check to every access of a value in the chunk import now, just to be on the safe side :)

Here's a new version with a fix:
mcaselector-1.8.2-all.jar.zip

Another thing i thought about are contents of command blocks (commands). I really won't be able to change coordinates in those without writing a complete command parser (which I won't do). I added a warning to the chunk import dialog to make that clear.

@daniel4farias
Copy link
Author

Awesome! Will test tonight as soon as I get home.

Command blocks are no problem! Reasonable that commands won't work when you shift stuff if they rely on absolute coordinates. Thanks for the heads up though.

@Querz
Copy link
Owner

Querz commented Sep 5, 2019

Found another thing to consider: Maps.
They are saved with a center-x and center-z coordinate in region files, but their data is stored in separate files.
See Item data for data stored in the region file and Map item format for data stored in map files.

I will most likely not update coordinates of maps when importing chunks, as the map files are not part of the region files. Also merging different worlds into one might create conflicting map files.

@daniel4farias
Copy link
Author

Fortunately, there are no maps in that world file so it didnt affect my use case. I tested it and have merged the two worlds with no problems. Feel free to close this bug out whenever you feel comfortable. Truly appreciate all the help!

@Querz
Copy link
Owner

Querz commented Sep 6, 2019

Thank you very much for testing! Have fun with release 1.8.2!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants