0
\$\begingroup\$

I'm looking to read block data from one Minecraft world and write the data into certain places in another.

I have a Minecraft world, let's say "TemplateWorld", and a 2D list of Point objects. I'm developing an application that should use the x and y values of these Points as x and z reference coordinates from which to read constant-sized areas of blocks from the TemplateWorld. It should then write these blocks into another Minecraft world at constant y coordinates, with x & z coordinates determined based on each Point's index in the 2D list.

The issue is that, while I've found a decent amount of information online regarding Minecraft world formats, I haven't found what I really need: more of a breakdown by hex address of where/what everything is.

For example, I could have the TemplateWorld actually be a .schematic file rather than a world; I just need to be able to read the bytes of the file, know that the actual block data starts always at a certain address (or after a certain instance of FF, etc.), and how it's stored. Once I know that, it's easy as pie to just read the bytes and store them.

\$\endgroup\$
  • \$\begingroup\$ Just to be clear, you are talking about reading and writing level data for the actual Minecraft game, right? Not a game you are making that is "Minecraft-like?" \$\endgroup\$ – Josh Aug 21 '14 at 22:09
  • \$\begingroup\$ It is for a game that is "Minecraft-like", it's just that I'm trying to use the same implementation that Minecraft uses; I''m just asking if anyone knows how it could be done in Minecraft, so that I can implement it in my design. \$\endgroup\$ – RapierMother Aug 21 '14 at 22:11
  • \$\begingroup\$ Down to the same file format? How can you load and save the file format and not be able to know where to put arbitrary chunks of data? If you aren't using the same file format, what format are you using? What have you tried, and where has that gone wrong? \$\endgroup\$ – Josh Aug 21 '14 at 22:12
  • \$\begingroup\$ It's not that I've "tried" something, or that I have a file format already — as my post states, I have the initial problem of not knowing how to <i>read</i> Minecraft data. This means that, while I will encounter the second issue of writing the data, I haven't reached a point where I have Minecraft data to write :p \$\endgroup\$ – RapierMother Aug 21 '14 at 22:17
  • \$\begingroup\$ Okay, so you want to read from actual Minecraft's world format into an in-memory format suitable for your purpose. Then copy certain parts of that world data into another in-memory world, according to some transformation. Then do you write the second world out as a Minecraft save, or are you writing it out in your own format? \$\endgroup\$ – Josh Aug 21 '14 at 22:21
0
\$\begingroup\$

Minecraft uses a tree-structured file format known as "NBT" (kind of like JSON or XML, but not text-based). There are no fixed offsets which you can rely on. You will need to use a library to parse NBT (or write your own parser) and then extract the information you want from the parsed structure.

\$\endgroup\$
  • \$\begingroup\$ Thanks Kevin. After doing my research and learning a whole lot more than I thought I would in the process, I've completed my project. It's a shiny new tool, check it out: link \$\endgroup\$ – RapierMother Aug 28 '14 at 23:15
0
\$\begingroup\$

Easiest way for you to achieve that would be to use already created world engine.

McEdit allows you to write plugins in python. You could write two plugins: First would load a file with points, create schematics of those regions. Second would load file with points and folder with schematics and paste them in.
I don't know if McEdit can be used in a scheme: automatically run a plugin and exit.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.