Bobby

Bobby

8M Downloads

Is it possible to re-create a server world from bobby's cache?

douira opened this issue ยท 9 comments

commented

Is there some tool or operation that can be used to convert a bobby cache of a server world into a playable world? (even if the seed is unknown) There was an unfortunate issue with our improvised hosting solution that made us loose the server data.

commented

Not easily, no. While Bobby's cache does use the same format as a normal world, it only contains the data that's necessary to load fake client-side chunks. To a server (including the integrated server in case of single player) they will appear as corrupted and be completely re-generated.
So you'll at the very least need an external program which "repairs" them without discarding the block data which is present (idk if such a program already exists).
Also note that you'll never be able to recover non-visual stuff cause that isn't ever sent to the client as part of the world in the first place (e.g. you might see the furnace burning but it'll be empty, chests will be empty too), there's no way around that unless you happened to have recorded everything with the ReplayMod (in which case, a world downloader mod may be able to recover the world from the replay).

commented

Is there some tool or operation that can be used to convert a bobby cache of a server world into a playable world? (even if the seed is unknown) There was an unfortunate issue with our improvised hosting solution that made us loose the server data.

An interesting note: I was able to open and see the chunks in the Amulet program.
So far, I don't know how to get Minecraft to play them.

commented

Is there some tool or operation that can be used to convert a bobby cache of a server world into a playable world? (even if the seed is unknown) There was an unfortunate issue with our improvised hosting solution that made us loose the server data.

An interesting note: I was able to open and see the chunks in the Amulet program. So far, I don't know how to get Minecraft to play them.

Have you tried copying those chunks into an existing world?

commented

Is there some tool or operation that can be used to convert a bobby cache of a server world into a playable world? (even if the seed is unknown) There was an unfortunate issue with our improvised hosting solution that made us loose the server data.

An interesting note: I was able to open and see the chunks in the Amulet program. So far, I don't know how to get Minecraft to play them.

Have you tried copying those chunks into an existing world?

yes, they are replaced. most likely because of the structure inside.
image
if somehow it was possible to add lines to this file .. but alas, I could not add anything to it
image

commented

Use this tool to set the status of chunks to full

https://github.com/Querz/mcaselector

commented

I was able to do this some months ago, from what I remember it worked like this:

  1. Make 2 new worlds in whatever version, make sure you know where they are
  2. In one of them replace the loaded chunks with the ones in .minecraft/bobby
  3. Open that world in the Amulet World Editor, it should work
  4. Do anything you need.
  5. Once you finish go to Convert on the left hand side of the screen and select the other new world.
  6. It should make a fully functional and playable world.
commented

Bobby cache files only lack the Status: full tag in chunk data. By appending this to each chunk, the cache files can be loaded in single player worlds correctly. I made myself a simple Python script for converting them, as all previously mentioned methods are not easy to use (MCA Selector seems to only support editing chunks one by one and cannot be automated; Amulet conversion is inefficient and takes a long time to finish).

Here is the code (you have to install the nbt package before running it - pip install nbt):

from glob import glob
from nbt import nbt, region

for file_name in glob("*.mca"):
  region_file = region.RegionFile(file_name, "rb")

  for m in region_file.get_metadata():
    chunk = region_file.get_chunk(m.x, m.z)
    if "Status" not in chunk:
      chunk.tags.append(nbt.TAG_String(value="full", name="Status"))
    region_file.write_chunk(m.x, m.z, chunk)
  
  print(f"{file_name} converted")

Note: this code currently converts all *.mca region files in the same directory so you can just put your bobby cache region files with the code in a same directory and run the code, then put all converted region files into a single player world.

This code converts ALL files in the same directory and even a single file can take several seconds to complete, and I'm NOT sure if the converted file can be reused by bobby, so copy your desired bobby files and this code to a conversion directory first.

commented

Bobby cache files only lack the Status: full tag in chunk data. By appending this to each chunk, the cache files can be loaded in single player worlds correctly. I made myself a simple Python script for converting them, as all previously mentioned methods are not easy to use (MCA Selector seems to only support editing chunks one by one and cannot be automated; Amulet conversion is inefficient and takes a long time to finish).

Here is the code (you have to install the nbt package before running it - pip install nbt):

from glob import glob
from nbt import nbt, region

for file_name in glob("*.mca"):
  region_file = region.RegionFile(file_name, "rb")

  for m in region_file.get_metadata():
    chunk = region_file.get_chunk(m.x, m.z)
    if "Status" not in chunk:
      chunk.tags.append(nbt.TAG_String(value="full", name="Status"))
    region_file.write_chunk(m.x, m.z, chunk)
  
  print(f"{file_name} converted")

Note: this code currently converts all *.mca region files in the same directory so you can just put your bobby cache region files with the code in a same directory and run the code, then put all converted region files into a single player world.

This code converts ALL files in the same directory and even a single file can take several seconds to complete, and I'm NOT sure if the converted file can be reused by bobby, so copy your desired bobby files and this code to a conversion directory first.

MCA Selector - you can change the status of ALL chunks in the world, the program will say something like: "Are you sure you want to change the unknown number of chunks in the world?" Then it will set the status to all chunks.
I have instructions on how to do this, although it is in Russian. But I can try to translate it and publish it here (I was just too lazy to do it, but if necessary, I will do it)

commented

MCA Selector - you can change the status of ALL chunks in the world, the program will say something like: "Are you sure you want to change the unknown number of chunks in the world?" Then it will set the status to all chunks. I have instructions on how to do this, although it is in Russian. But I can try to translate it and publish it here (I was just too lazy to do it, but if necessary, I will do it)

That's great, I do want to see the instructions. If translation is too tedious you can just post the original text - MCA Selector doesn't seem to be too complicated so maybe I can just use a translator?

Edit: I figured it out myself - thanks for the help though because it was a problem I didn't realize before. After reading MCA Selector's Wiki and some relevant issue reports I found that you can use the "Change fields" option to add Status: full to all selected chunks but the latest version has a bug that prevents me from opening it, so I thought I had to change each chunk one by one manually. I tried using an older version (2.0.1) and it worked - I successfully added that tag to all selected chunks. Now I can just use MCA Selector without bothering with scripts.