Cuberite Forum
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)

Pages: 1 2 3 4 5 6 7 8 9


RE: Convert Minecraft server world files into MCserver world files. - FakeTruth - 10-30-2011

I fixed it for ya, check out the changes Smile The fix should be quite obvious, though hard to fix yourself when you're not familiar with the parser

http://code.google.com/p/mc-server/source/detail?r=27&path=/trunk/


RE: Convert Minecraft server world files into MCserver world files. - rs2k - 10-31-2011

(10-30-2011, 09:43 PM)FakeTruth Wrote: I fixed it for ya, check out the changes Smile The fix should be quite obvious, though hard to fix yourself when you're not familiar with the parser

http://code.google.com/p/mc-server/source/detail?r=27&path=/trunk/

Thanks!Big Grin

I made a few more changes, and cleaned up the code quite a bit in cConvert.cpp as well as split off a few of the functions.

The current problem is the converter seems to bug out when it gets to the entity lists when it contains entities. Some chunks also cause the parser to segfault. I'll have to do more printf troubleshooting.


RE: Convert Minecraft server world files into MCserver world files. - FakeTruth - 10-31-2011

If you can't figure it out, upload the segfaulting chunk and I'll take a look


RE: Convert Minecraft server world files into MCserver world files. - rs2k - 10-31-2011

Thanks, I think it will be best to fix the entities tag first though. I have a feeling it might have to do with that. 2 chunks before the first one that segfaults throws an unknown tag error while parsing what looks like this tag:

TAG_List("Motion"): 3 TAG_Doubles describing the current dX,dY,dZ velocity of the entity. (Note: Falling into the Void appears to set this to ridiculously high speeds. 0,0,0 is no motion.)


Code:
UNKNOWN TAG 3b
16446 6f 111 o
16447 74 116 t
16448 69 105 i
16449 6f 111 o
16450 6e 110 n
16451 06   6
16452 00   0
16453 00   0
16454 00   0
16455 03   3
16456 3b  59 ;
16457 61  97 a
16458 07   7
16459 cd 205 Í
16460 e8 232 è
16461 e9 233 é
16462 b0 176 °
16463 73 115 s
16464 bf 191 ¿
16465 b4 180 ´
Working on chunk 102
Working on chunk 103
Working on chunk 104
UNKNOWN TAG ffffffbf
16446 6f 111 o
16447 74 116 t
16448 69 105 i
16449 6f 111 o
16450 6e 110 n
16451 06   6
16452 00   0
16453 00   0
16454 00   0
16455 03   3
16456 bf 191 ¿
16457 9f 159
16458 10  16
16459 19  25
16460 63  99 c
16461 87 135
16462 94 148
16463 ca 202 Ê
16464 bf 191 ¿
16465 b4 180 ´



RE: Convert Minecraft server world files into MCserver world files. - rs2k - 10-31-2011

I'm pretty sure the segfault happens when it tries to parse a tag and doesn't do it right. The seg fault happens when it tries to parse what it thinks is Tag: 63. (This was the same tag is segfaulted on when I first added the bytearray tag incorrectly)

The problem only seems to happen when the program loops through multiple chunks.

(Starts with chunk 0)
Chunk 3 and 4 both show unknown tag, and chunk 32 throws a segfault.

When I run those chunks separately it parses them without trouble. If I skip those chunks it will process the other chunks around them just fine.

I think there might be a problem with data carrying over between chunks in the parser (My guess is the compound tag since that's what the entity tag is). Am I supposed to clear the data with a function I'm not aware of? Is this just a bug with the parser?


RE: Convert Minecraft server world files into MCserver world files. - rs2k - 10-31-2011

I was wrong about parsing the chunks separately didn't throw the error, when I tried to parse the chunks separate the program foes for chunk 0 first.


The tag it is having trouble with is here:
Code:
Tag: 4
LONG: UUIDLeast 2749487079


I'll take a look at what the program is doing one byte at a time to see what's going on.


RE: Convert Minecraft server world files into MCserver world files. - FakeTruth - 10-31-2011

Remember that the error in parsing (which needs fixing) happens anywhere before (or during) the segfault, so it can happen a couple of tags before the crash


RE: Convert Minecraft server world files into MCserver world files. - rs2k - 10-31-2011

I've got the converter parsing everything without crashing or coming up with unknown tag errors now. There's still a problem with the converter closing compound tags too early if there's an entity list that contains double or float tags though.

http://code.google.com/p/mc-server/source/diff?spec=svn30&r=30&format=side&path=/trunk/converter/cNBTData.cpp


The converter is closing the compound before it parses a list that should belong to that compound. Here's an example:

Code:
Coord(X,Z): 29,13
Working on chunk 1012 :: 4587520
==== STRUCTURED NBT DATA ====
COMPOUND ( )
     COMPOUND
         COMPOUND (Level)
            LIST (Entities)
                 COMPOUND (...)
                     COMPOUND (Item)
                        SHORT Damage (0)
                        SHORT id (368)
                        BYTE Count (1)
                    LIST (Motion)
                    LIST (Pos)
                    SHORT Age (4395)
                    SHORT Air (300)
                    SHORT Health (5)
                    LONG UUIDLeast (6750471726475532170)
                    LONG UUIDMost (-123531473670072665)
                    LONG WorldUUIDLeast (-3115241454721806157)
                    Double  (0.000000)
                    BYTE OnGround (1)
            LIST (Rotation)
            SHORT Fire (-1)
            FLOAT  (0.000000)
            FLOAT FallDistance (0.000000)
            LONG WorldUUIDMost (-3365198326412606504)
            BYTE ARRAY Data (length: 8)
    LIST (TileEntities)
    INTEGER xPos (27)
    INTEGER zPos (16)
    LONG LastUpdate (17511934580490240)
    BYTE TerrainPopulated (1)
    BYTE ARRAY BlockLight (length: 8)
    BYTE ARRAY Blocks (length: 8)
    BYTE ARRAY HeightMap (length: 8)
    BYTE ARRAY SkyLight (length: 8)
=============================

and how it *should* look:

Code:
Coord(X,Z): 29,13
Working on chunk 1012 :: 4587520
==== STRUCTURED NBT DATA ====
COMPOUND ( )
     COMPOUND
         COMPOUND (Level)
            LIST (Entities)
                 COMPOUND (...)
                     COMPOUND (Item)
                        SHORT Damage (0)
                        SHORT id (368)
                        BYTE Count (1)
                        LIST (Motion)
                        LIST (Pos)
                        SHORT Age (4395)
                        SHORT Air (300)
                        SHORT Health (5)
                        LONG UUIDLeast (6750471726475532170)
                        LONG UUIDMost (-123531473670072665)
                        LONG WorldUUIDLeast (-3115241454721806157)
                        Double  (0.000000)
                        BYTE OnGround (1)
                        LIST (Rotation)
                        SHORT Fire (-1)
                        FLOAT  (0.000000)
                        FLOAT FallDistance (0.000000)
                        LONG WorldUUIDMost (-3365198326412606504)
            BYTE ARRAY Data (length: 8)
            LIST (TileEntities)
            INTEGER xPos (27)
            INTEGER zPos (16)
            LONG LastUpdate (17511934580490240)
            BYTE TerrainPopulated (1)
            BYTE ARRAY BlockLight (length: 8)
            BYTE ARRAY Blocks (length: 8)
            BYTE ARRAY HeightMap (length: 8)
            BYTE ARRAY SkyLight (length: 8)
=============================


I'm not sure what's up with "FLOAT (0.000000)" That would be another tag that's not getting parsed correctly.


RE: Convert Minecraft server world files into MCserver world files. - FakeTruth - 10-31-2011

Fixed it for ya. It had something to do with inconsistent incrementing m_Index

http://code.google.com/p/mc-server/source/detail?r=32


RE: Convert Minecraft server world files into MCserver world files. - rs2k - 10-31-2011

Thanks again. Big Grin

I got the converter to the point where it can create the files, but everything after the pak header is one byte off and loading the map causes the server to crash.

I'll fix it tomorrow.