Convert Minecraft server world files into MCserver world files. - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html) +--- Forum: Development (https://forum.cuberite.org/forum-13.html) +--- Thread: Convert Minecraft server world files into MCserver world files. (/thread-195.html) |
RE: Convert Minecraft server world files into MCserver world files. - rs2k - 10-28-2011 Yeah, the data looks valid, an NBT level editor was able to read it. Now I just have to parse this mess of an array and put it into your format. Going back into this format from your format wouldn't be too difficult either. just really annoying. lol. I'm not sure which method is better or faster or whatever, but your method is easier to understand at least. lol, NBT sucks. RE: Convert Minecraft server world files into MCserver world files. - rs2k - 10-28-2011 I'm going to save the data I've harvested into the pak format and see what happens. I hope notch stores the blocks in the same order he sends them in. :/ Code: Blocks are laid out in sets of vertical columns, with the rows going east-west through chunk, and columns going north-south. Blocks in each chunk are accessed via the following method: What zlib standard do you use? Do you compress, deflate or encode? The first four bytes in your pak files are easy to understand (first two are version numbers, next two are number of chunks), I'm not sure how to read your chunk headers. This is what I think: It looks like the information is written in little-endian format. The next four bytes are supposed to be an integer representing an X coordinate. In this header it's: 00 FF FF FF. I can't imagine that's supposed to represent 16,777,215 or 4294967040. Maybe it's a negative number? I don't know how to read or convert to a hex negative number. The next four bytes are supposed to be an integer representing a Z (Should be Y!) coordinate. In this header it's, 80 00 00 00. which is either 2147483648 or 128 depending on if it's big or little-endian. (I assume 128) The next four are compressed size: In this header: 6A 0E 00 00 (I assume this is 3690 bytes) and uncompressed size for the last four: In this header: 00 40 01 00 (I assume this is 81920 bytes) RE: Convert Minecraft server world files into MCserver world files. - rs2k - 10-28-2011 I found this: http://www.physicsforums.com/showthread.php?t=157612 Quote:Another is two's complement. Here you invert all the bits and then add 1 to the result. thus 01 still represents +1 and FF represents -1. So 05 FF FF FF - 1 = 04 FF FF FF which inverted is FB 00 00 00 which his equal to 251 So my guess is the chunk location is x = -251 and z(SHOULD BE Y!) = 80 This is in pak labeled X-8_Z4.pak. How many chunks do you place in one pak? Notch uses a max of 1024, or 32 x 32 chunks per region. RE: Convert Minecraft server world files into MCserver world files. - FakeTruth - 10-28-2011 (10-28-2011, 03:07 PM)rs2k Wrote: I found this:PC's use two's complement, yup. Maybe you should look at chunks in positive coordinates first (10-28-2011, 03:07 PM)rs2k Wrote: How many chunks do you place in one pak? Notch uses a max of 1024, or 32 x 32 chunks per region.A maximum of 1024 (32*32), like Notch's format. It seemed to be the best size to me (and like I said, I never looked @ notch's format, I only knew the new format stores lots of chunks in one file) RE: Convert Minecraft server world files into MCserver world files. - rs2k - 10-29-2011 The first MCR => PAK convesion is running now.... <5.23 minutes later> It worked! http://dl.dropbox.com/u/14526521/2011-10-28_13.36.46.png I'm kind of astonished, I didn't think the first time I'd make the conversion that it'd actually work, but I'm standing on a 32*32 region in MCServer that was created on Bukkit. I completely ignored the entity information for this run. The PHP script is painfully slow though. over 5 minutes per region, and the map I want to fully convert first has 86 regions. One of the reasons it's so slow is that one of the steps involves inflating the chunk info and deflating it into a different format then saving it to disk so the nbt parser can open it, inflate it, save it to disk again, and parse it. With that level of efficiency, Notch would be proud. Now that I know this thing actually works, I'll go back and make my own parser to eliminate the extra CPU hogging steps. RE: Convert Minecraft server world files into MCserver world files. - Giggaflop - 10-29-2011 rs2k I love you for this £> really great work on this RE: Convert Minecraft server world files into MCserver world files. - rs2k - 10-29-2011 (10-29-2011, 05:07 AM)Giggaflop Wrote: rs2k I love you for this £> It's not there yet, but it's getting closer. I got rid of the extra compressions steps and the script didn't improve much in speed (shaved off 23 seconds). PHP is just really slow at parsing that much data. RE: Convert Minecraft server world files into MCserver world files. - FakeTruth - 10-29-2011 Cool, good job! I'm sure once you port this to C++ it will be much faster (100~1000x faster is my guess) RE: Convert Minecraft server world files into MCserver world files. - necavi - 10-29-2011 Hey, if you want to, my brother was saying that he would be happy to go over your PHP and optimize it, maybe getting it fast enough to be used as a web-based converter (i.e. someone uploads it to a site and downloads the converted version). RE: Convert Minecraft server world files into MCserver world files. - rs2k - 10-30-2011 (10-29-2011, 07:59 AM)necavi Wrote: Hey, if you want to, my brother was saying that he would be happy to go over your PHP and optimize it, maybe getting it fast enough to be used as a web-based converter (i.e. someone uploads it to a site and downloads the converted version). I honestly don't think the PHP is ever going to be fast enough to do something like that, but I can give you what I have. I've been working on the c++ version and am getting closer. I can open, read, and decompress the gzipped data now. Al that takes about 2 milliseconds per region file according to my execution timer. Soooooooo much faster. I've included FakeTruth's NBT parser into the program, I'm looking through it now, but if you can give me an example of its use that would a lot. right now I'm loading the uncompressed chunk data into a char array of about 80K in length. I need the parser to look through that and spit out valuable information so I can reformat it and save it in the deNotchified FakeTruth format. Oh yeah, the name of this program is deNotch. |