Convert Minecraft maps to Minetest worlds

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

Re: Convert Minecraft maps to Minetest worlds

by sofar » Post

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.

User avatar
MinisterFarrigut
Member
Posts: 75
Joined: Fri Oct 14, 2016 14:59
In-game: singleplayer
Location: The ruins of my basement

Re: Convert Minecraft maps to Minetest worlds

by MinisterFarrigut » Post

Dang its so weird. Minecraft maps look better in Minetest than Minecraft XD!!!
I build buildings. I don't usually make mods...I use them.

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

Re: Convert Minecraft maps to Minetest worlds

by Schmeldric » Post

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: 2146
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Convert Minecraft maps to Minetest worlds

by sofar » Post

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: 501
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

Re: Convert Minecraft maps to Minetest worlds

by Nore » Post

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: 22
Joined: Sat Nov 01, 2014 15:38
In-game: Schmeldric

Re: Convert Minecraft maps to Minetest worlds

by Schmeldric » Post

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: 2146
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Convert Minecraft maps to Minetest worlds

by sofar » Post

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: 22
Joined: Sat Nov 01, 2014 15:38
In-game: Schmeldric

Re: Convert Minecraft maps to Minetest worlds

by Schmeldric » Post

Euh... What's a PR ? Personal Release on Github?

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

Re: Convert Minecraft maps to Minetest worlds

by Schmeldric » Post


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

Re: Convert Minecraft maps to Minetest worlds

by sofar » Post

Schmeldric wrote:Is this correctly done?
https://gist.github.com/anonymous/450c3 ... teadofx-py
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: 22
Joined: Sat Nov 01, 2014 15:38
In-game: Schmeldric

Re: Convert Minecraft maps to Minetest worlds

by Schmeldric » Post

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

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

Re: Convert Minecraft maps to Minetest worlds

by Schmeldric » Post

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: 2146
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Convert Minecraft maps to Minetest worlds

by sofar » Post

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: 2146
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Convert Minecraft maps to Minetest worlds

by sofar » Post

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).

User avatar
GreenXenith
Member
Posts: 1356
Joined: Wed Oct 28, 2015 01:26
GitHub: GreenXenith
Location: UTC-8:00
Contact:

Re: Convert Minecraft maps to Minetest worlds

by GreenXenith » Post

I converted Parkour Paradise 3 (for the cliffs and water, not the parkour) and it worked very well! Just to note, the installer tried and failed to install it's necessary mods. I think it couldn't find them or something. Luckily, I had most of them anyway. I used the terminal on Xubuntu 16.04. Also, the vines on this map weren't all rotated correctly, but I didn't care because I wanted it all vanilla so I used WE and replaced them with bush leaves :D Very good work sir!
YouTube | Mods | Patreon | Minetest Discord @greenxenith

You should not be able to read this message.

nightengale
Member
Posts: 12
Joined: Sun Apr 23, 2017 16:36

Re: Convert Minecraft maps to Minetest worlds

by nightengale » Post

Sorry for this really dumb question, but I should just be able to run:

python mcimport.py [path to the level.dat]

And that will start the conversion process, or no?

-------------EDIT----------------------

Dumb question asked by linux noob, ran the wrapper instead, we'll see how it turns out. = )

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

Re: Convert Minecraft maps to Minetest worlds

by sofar » Post

nightengale wrote:Sorry for this really dumb question, but I should just be able to run:

python mcimport.py [path to the level.dat]

And that will start the conversion process, or no?

-------------EDIT----------------------

Dumb question asked by linux noob, ran the wrapper instead, we'll see how it turns out. = )
The wrapper uses zenity which makes it easier to use, since it makes a simple gui around the python parts, but yes, you can also just run it manually (with the right options).

User avatar
PEAK
Member
Posts: 187
Joined: Mon Jun 08, 2015 20:32
In-game: PEAK
Contact:

Re: Convert Minecraft maps to Minetest worlds

by PEAK » Post

Hello sofar!

Recently I tortured my computer with converting many Minecraft maps.
The results are really amazing. Thank you!


Some suggestions for improvement:


map_content.txt

Code: Select all

22	lapis:lapis
should be

Code: Select all

22	lapis:lapisblock
there's no lapis:lapis

Code: Select all

98 3	moreblocks:circle_stone_bricks
I would prefer:

Code: Select all

98 3	xdecor:stone_rune

addition:

Code: Select all

116	xdecor:enchantment_table

Code: Select all

139 1	default:mossycobble			// FIXME: you may not want this
139	default:cobble				// FIXME: you may not want this
fixed:

Code: Select all

139 1	walls:mossycobble
139	walls:cobble

Code: Select all

168 0	prismarine:prismarine
168 1	prismarine:prismarine_brick
168 2	prismarine:prismarine_dark
169	prismarine:sea_lantern
It's a pity that these blocks get lost.
I made a mod for this, but I'm unsure about the license for the textures, so I don't publish it.
(I took the textures from http://hydra-media.cursecdn.com/minecra ... ockCSS.png at http://minecraft.gamepedia.com/Minecraft_Wiki)


stone and wooden buttons (77 and 143)
Often they are used just for decoration -- so perhaps an extra buttons mod?


other:

  • doors need fix: unknown blocks because Minetest newly handles them differently.
  • inner and outer corners of stairs would be fine.

Some tips for users:

The player is not everytime spawned at the right location! Some maps contain random chunks far away from the main content, so they seem to consist only of that: use a mapper to find the area of the main content.

The lighting seems to get better corrected when flying above the dark regions in the sky while the adjacent parts of the map under them are generated. For the rest use mapfix.

In some cases antifire is useful.
I am okay with using the screenshots in all my posts for the website of Minetest (http://minetest.net).

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

Re: Convert Minecraft maps to Minetest worlds

by sofar » Post

PEAK wrote:Some suggestions for improvement:
thanks, I pulled most of this in.
PEAK wrote:It's a pity that these <prismarine> blocks get lost.
Try and find a texture pack that is Public Domain or CC-BY and has their own versions for these blocks, then you can use that in your mod!

User avatar
PEAK
Member
Posts: 187
Joined: Mon Jun 08, 2015 20:32
In-game: PEAK
Contact:

Re: Convert Minecraft maps to Minetest worlds

by PEAK » Post

sofar wrote:
PEAK wrote:Some suggestions for improvement:
thanks, I pulled most of this in.
"Several fixes for the map content, lose moreblocks."

That's fine!
sofar wrote:
PEAK wrote:It's a pity that these <prismarine> blocks get lost.
Try and find a texture pack that is Public Domain or CC-BY and has their own versions for these blocks, then you can use that in your mod!
I will work on that.
I am okay with using the screenshots in all my posts for the website of Minetest (http://minetest.net).

User avatar
PEAK
Member
Posts: 187
Joined: Mon Jun 08, 2015 20:32
In-game: PEAK
Contact:

Re: Convert Minecraft maps to Minetest worlds

by PEAK » Post

Here is the prismarine mod. I used the textures from Faithful 1.11 as Wuzzy does for his Mineclone2.
(I would rather prefer 16x16 textures, but that is what I found...)

Image

License

Textures: Faithful 1.11 by Vattic, xMrVizzy and many others (MIT License)
Code: by PEAK WTFPL (it's not really worth to have a license)

Usage

This mod is only intended as supplement for sofar's converter script.
So the blocks are just decorative, no crafting recipes, and the "Prismarine" is not animated.

depends: default

Put the "prismarine" folder into the "worldmods" folder of the converted map.

Test it e.g. with Pirimidin ! Apartement For People !.

map_content.txt

Code: Select all

168 0	prismarine:prismarine
168 1	prismarine:prismarine_brick
168 2	prismarine:prismarine_dark
169	prismarine:sea_lantern
*****

Minetest can have nice emeralds too: oresplus by jp.
With that you can do:

map_content.txt

Code: Select all

129	oresplus:stone_with_emerald
and

Code: Select all

133	oresplus:emerald_block
Attachments
prismarine.zip
(109.86 KiB) Downloaded 204 times
prismarine.png
prismarine.png (68.42 KiB) Viewed 2219 times
I am okay with using the screenshots in all my posts for the website of Minetest (http://minetest.net).

Bookkc
Member
Posts: 11
Joined: Fri Jul 28, 2017 09:41

Re: Convert Minecraft maps to Minetest worlds

by Bookkc » Post

Can this work on windows ?? or only for linux???

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

Re: Convert Minecraft maps to Minetest worlds

by sofar » Post

Bookkc wrote:Can this work on windows ?? or only for linux???
It's possible that it works under Windows, but nobody has tried or tested it. The script is fairly complex and you'd have to setup a lot of tools to make it work under windows, so it's not really worth anyone's time TBH.

Bookkc
Member
Posts: 11
Joined: Fri Jul 28, 2017 09:41

Re: Convert Minecraft maps to Minetest worlds

by Bookkc » Post

sofar wrote:
Bookkc wrote:Can this work on windows ?? or only for linux???
It's possible that it works under Windows, but nobody has tried or tested it. The script is fairly complex and you'd have to setup a lot of tools to make it work under windows, so it's not really worth anyone's time TBH.

So i need a linux and python ? what librarys me need ?? And if i need a Xserver???

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

Re: Convert Minecraft maps to Minetest worlds

by sofar » Post

Bookkc wrote:So i need a linux and python ? what librarys me need ?? And if i need a Xserver???
It's documented in the post: python3 and Zenity. You can run the conversion without zenity if you know what you are doing.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests