Convert Minecraft maps to Minetest worlds

sofar
Developer
 
Posts: 768
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Convert Minecraft maps to Minetest worlds

by sofar » Wed May 04, 2016 14:09

theHalfBloodStanger wrote:Just an idea, but couldn't it be convenient to convert the programming into c++/c? It would be much faster.
Just an idea from an inexperienced programmer.


yes, and that's what likely will happen - people have already written c++ converters and we'll likely port all the code changes over.
 

MinisterFarrigut
Member
 
Posts: 39
Joined: Fri Oct 14, 2016 14:59

Re: Convert Minecraft maps to Minetest worlds

by MinisterFarrigut » Tue Dec 27, 2016 03:29

Dang its so weird. Minecraft maps look better in Minetest than Minecraft XD!!!
 

Schmeldric
Member
 
Posts: 19
Joined: Sat Nov 01, 2014 15:38
In-game: Schmeldric

Re: Convert Minecraft maps to Minetest worlds

by Schmeldric » Thu Jan 26, 2017 17:44

Hi!

I'm facing a "small" issue with this converter (great thanks for the work by the way).
I seems to me that what is called "north" in Minecraft (Z negative) becomes south in Minetest (which is logic since Minetest choosed Z positive for north).

Who bothers will you ask?
Well, I'm working with my students on a model of our town. We did parts of the town using the north as choosen in Minetest. But the whole town is a huge task.
So I found some help in using a service provided by IGN (french cartographers) who will provide a Minecraft version of a real France area. Great! So I got that map, converted it in Minetest, and... and if I do worldedit copy/paste the buildings are facing the wrong direction.

I know worldedit has the rotate option. That could be a solution, but my 13 years old student will have to learn to use it correctly.
I tried to edit the "block.py" file in order to have the conversion put north the right side. For now
- I know how to put the 16x16x16 blocks at the good place;
- but inside these blocks I have to also do a symetry : x = 15-x and z=15-z

For this problem, I tried to change line 231 " x, y, z = te["x"], te["y"], te["z"] " to " x, y, z = 15-te["x"], te["y"], 15-te["z"] " but failed.
Seems the blocks aren't taken one by one but converted as massive data.
I think the solution is in the "def extract_slice(data, yslice):" (line 150). During the conversion I'll have to cover X and Z the other way around.
The method's comment says "# Beware: impossible to understand code" so I'm now trying to figure out how it's working, but if one of you already solved that, it would really help me...

OR : there is a reverse_X_axis method called. Would replacing it by a reverse_Z_axis work?
 

sofar
Developer
 
Posts: 768
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Convert Minecraft maps to Minetest worlds

by sofar » Thu Jan 26, 2017 22:54

Schmeldric wrote:So I found some help in using a service provided by IGN (french cartographers) who will provide a Minecraft version of a real France area. Great! So I got that map, converted it in Minetest, and... and if I do worldedit copy/paste the buildings are facing the wrong direction.


Yup, have been breaking my head over it as well. I've been unable to solve it myself. I'm hoping we can make the C++ converter not make this mistake and push the content detail to that, since I doubt we'll maintain the python version - it is just so much slower.
 

Nore
Developer
 
Posts: 468
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

Re: Convert Minecraft maps to Minetest worlds

by Nore » Fri Jan 27, 2017 06:43

Hi, I'm the author of that "impossible to understand code" :).
Line 231 you're talking about is used for tile entities, which are not the bulk node data, so changing it is needed, but won't change much.
The solution is indeed in extract_slice; the idea of the code in it is just to reverse the order of the axes. For that, we process the positions in the order we want them in the output, and we compute the input positions that correspond to it by increasing with the xstride each time.
 

Schmeldric
Member
 
Posts: 19
Joined: Sat Nov 01, 2014 15:38
In-game: Schmeldric

Re: Convert Minecraft maps to Minetest worlds

by Schmeldric » Tue Feb 14, 2017 07:48

Hourray!

After spending many night hours I think I got it the right way around...

My first try was to change the "extract_slice" and "extract_slice_half_bytes" functions to read the nodes the other way around.Althought I think I understood the code, my maths didn't word :'(
Nota :
MC uses "blocks" as voxels in a 16x16x128 chunk
MT uses "nodes" as voxels in 16x16x16 blocks...


So I tried another way.

> In MTMap.save : changed
Code: Select all
(self.getBlockAsInteger((block.pos[0],block.pos[1],block.pos[2])),
to
Code: Select all
(self.getBlockAsInteger((-block.pos[0],block.pos[1],-block.pos[2])),

in order to get a first rotation. This puts the MT blocks at their right place, but didn't rotate their content.

> Instead of reversing X axis (MC and MT uses left/right "trièdre" - sorry, didn't find the english for that) , I reversed Z axis
In MCBlock.reverse_X_axis and MCBlock.expand_half_bytes (yeah, data on u12 ... so easy...) I changed the order data was read, reversing Z instead of X.
By the way : I think this code could be optimised but I'm not used enought to Python
Code: Select all
        l2 = l[locSt:locSt+16]
        for i in l2:
            l3.append(i)


So... Do you want my file?
 

sofar
Developer
 
Posts: 768
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Convert Minecraft maps to Minetest worlds

by sofar » Tue Feb 14, 2017 21:02

Schmeldric wrote:Hourray!

After spending many night hours I think I got it the right way around...

My first try was to change the "extract_slice" and "extract_slice_half_bytes" functions to read the nodes the other way around.Althought I think I understood the code, my maths didn't word :'(
Nota :
MC uses "blocks" as voxels in a 16x16x128 chunk
MT uses "nodes" as voxels in 16x16x16 blocks...


So I tried another way.

> In MTMap.save : changed
Code: Select all
(self.getBlockAsInteger((block.pos[0],block.pos[1],block.pos[2])),
to
Code: Select all
(self.getBlockAsInteger((-block.pos[0],block.pos[1],-block.pos[2])),

in order to get a first rotation. This puts the MT blocks at their right place, but didn't rotate their content.

> Instead of reversing X axis (MC and MT uses left/right "trièdre" - sorry, didn't find the english for that) , I reversed Z axis
In MCBlock.reverse_X_axis and MCBlock.expand_half_bytes (yeah, data on u12 ... so easy...) I changed the order data was read, reversing Z instead of X.
By the way : I think this code could be optimised but I'm not used enought to Python
Code: Select all
        l2 = l[locSt:locSt+16]
        for i in l2:
            l3.append(i)


So... Do you want my file?


I'll take it - can you make a PR? If not, throw the file on gist.github.com and post the URL.
 

Schmeldric
Member
 
Posts: 19
Joined: Sat Nov 01, 2014 15:38
In-game: Schmeldric
 

Schmeldric
Member
 
Posts: 19
Joined: Sat Nov 01, 2014 15:38
In-game: Schmeldric
 

sofar
Developer
 
Posts: 768
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Convert Minecraft maps to Minetest worlds

by sofar » Wed Feb 15, 2017 19:14



well, it works, but it does remove all the custom door/water code I added... Did you do that on purpose or did you just edit an older version?

There's some great git how-to documents how this git/github stuff all works.
 

Schmeldric
Member
 
Posts: 19
Joined: Sat Nov 01, 2014 15:38
In-game: Schmeldric

Re: Convert Minecraft maps to Minetest worlds

by Schmeldric » Wed Feb 15, 2017 23:05

Thought I used the latest release, my bad.
I'll modify a more recent version, sorry.
 

Schmeldric
Member
 
Posts: 19
Joined: Sat Nov 01, 2014 15:38
In-game: Schmeldric

Re: Convert Minecraft maps to Minetest worlds

by Schmeldric » Wed Feb 22, 2017 18:40

So... On GitHub I forked from your source code.
I uploaded the block.py file.
I asked for a "pull request"

Was it correctly done?
 

sofar
Developer
 
Posts: 768
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Convert Minecraft maps to Minetest worlds

by sofar » Wed Feb 22, 2017 19:25

Schmeldric wrote:So... On GitHub I forked from your source code.
I uploaded the block.py file.
I asked for a "pull request"

Was it correctly done?


yup! Will review but looks good so far!
 

sofar
Developer
 
Posts: 768
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Convert Minecraft maps to Minetest worlds

by sofar » Thu Feb 23, 2017 07:08

I upgraded the conversion test map I have to 1.11 and redid a ton of stuff, including node rotations and flowerpots (using my own flowerpot mod now! no more homedecor!) Fixed tile entites (signs!) while we're at it, although some are still not converting well (maybe I need to re-place them first).
 

Previous

Return to Maps

Who is online

Users browsing this forum: No registered users and 2 guests