Page 1 of 3

Convert Minecraft maps to Minetest worlds

PostPosted: Mon Dec 07, 2015 00:31
by sofar
The mcimport project provides a World Converter for whole Minecraft Maps (Minecraft saves) and the output is a new, playable Minetest world.

This project started out as a basic python converted written by Nore and dgm555. I've updated the project and have spent a lot of time making the conversion more and more complete ever since. We've merged the two projects into the minetest-tools organization as well.

The conversion is done as a single-step process that requires Python. Once the conversion is done, your world is ready to play! For large worlds, this process can take hours, even days if your world is huge.

Github:https://github.com/minetest-tools/mcimport
Download: https://github.com/minetest-tools/mcimport/archive/master.zip
Platform: Linux (others may work, but require extra software)
License: X11

Usage:
  1. Download the tarball from here: https://github.com/minetest-tools/mcimport/archive/master.zip
  2. Extract it
  3. Launch the converter

Or, to list the exact terminal commands, cut and paste the below text into a terminal:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
wget https://github.com/sofar/mcimport/archive/master.zip
unzip master.zip
mcimport-master/mcimport.sh


Minecraft Test Patterns:

Image

Converted Result:

Image



I'm doing things a bit differently though - my focus isn't to "copy exact", but to create a playable, approximation of the MC world.

So I expect that things like doors, beds, furnaces just work, and blocks are useful and usable. But blocks that have no purpose or don't exist in minetest are removed or replaced with equivalents that make sense in MT gameplay. Rotation of blocks is carefully done and verified.

- emerald ore is converted to stone
- redstone is as much possible converted to mese, with working pressure plates, wires, noteblocks, buttons, levers and a few more things

When you convert a MC savegame or world, it's expected to be in MC 1.11 format. I'm not supporting old formats. The code also writes a few extra files needed to make it all play nice with mapgen, mainly fixing the waterlevel and allowing you to tweak mapgen to single node easily. Note: The map now correctly leaves North in MC as North in MT (effectively changing coordinates for Every Block).

Mods: lots of mods required - none strange or obtuse, or hard to find mods, these are all very COMMON mods that most servers have, and most of them are contained within biomes_lib, plantlife, mesecons, moretrees, moreblocks, nether, flowerpot and nether mods already (and a few others on top of that). A script exists to help you download all the needed mods.

The converter creates all the required config files in the world folder, and the world should be playable without any extra configuration afterwards. You may however wish to tweak the mapgen parameters before loading the world for the first time in the minetest game. Currently, all mapgen will be disabled to prevent overwriting of the world content by mapgen.

To download all the required mods, a script is written in the world folder called get-mods.sh. Running this script will automatically get the correct mods and their latest versions for your converted world.

Fixerol wrote:Basically they are those mods:
Biomes_lib - viewtopic.php?f=11&t=12999
Plantlife - viewtopic.php?f=11&t=3898
Home Decor - viewtopic.php?f=11&t=2041
Mesecons - viewtopic.php?f=11&t=628
Moreblocks - viewtopic.php?id=509
Nether* - viewtopic.php?f=11&t=5790
Quartz - viewtopic.php?f=11&t=5682


I have a forked Nether mod in my github to add various nether brick blocks, but not very many people seem to be converting nether worlds, so you'll likely be fine without that.

You do not need to modify world.mt since the code writes out a perfectly usable version with the mod list. You just need to download these mods and install them in your mods folder. Please use the provided get-mods.sh script for this purpose - you'll find it in the written world folder.

Conversion can be slow! A 6000x6000 MC world on my system takes ~ 8 hours. Even my test map (500x500 nodes) takes 2 minutes or so without pruning the map.

This program requires Zenity and Python3. These are widely available for Linux in most distributions, but may not be available on other platforms.

Re: Convert whole Minecraft maps

PostPosted: Sun Jan 17, 2016 20:36
by Morn76
Excellent, thanks! This is so much faster than converting maps with WorldEdit like I did before. Yay, Python! :-)

Maybe the script should also add map_meta.txt with "mg_name = singlenode"; otherwise the MT mapgen destroys the converted map immediately.

Re: Convert whole Minecraft maps

PostPosted: Sun Jan 17, 2016 20:55
by sofar
Morn76 wrote:Excellent, thanks! This is so much faster than converting maps with WorldEdit like I did before. Yay, Python! :-)

Maybe the script should also add map_meta.txt with "mg_name = singlenode"; otherwise the MT mapgen destroys the converted map immediately.


It creates a worldmod file that has the option of doing this:

https://github.com/sofar/mcimport/blob/master/mcimport.py#L70

All you have to do is uncomment it. I suppose that should just be the default ...

Re: Convert whole Minecraft maps

PostPosted: Mon Jan 18, 2016 00:39
by Morn76
Yes, I saw your mention of singlenode in the first post after I posted myself. But I agree, singlenode should be the default.

Re: Convert whole Minecraft maps

PostPosted: Mon Jan 18, 2016 01:29
by sofar
Morn76 wrote:Yes, I saw your mention of singlenode in the first post after I posted myself. But I agree, singlenode should be the default.


yep, I just pushed a change to do just that.

Re: Convert whole Minecraft maps

PostPosted: Mon Jan 18, 2016 10:48
by Morn76
sofar wrote:yep, I just pushed a change to do just that.

Thanks!

Re: Convert whole Minecraft maps

PostPosted: Thu Jan 21, 2016 05:43
by OmniStudent
Neat!

Re: Convert whole Minecraft maps

PostPosted: Thu Jan 21, 2016 06:37
by sofar
Please post some before-and-after conversion screenshots folks!

Re: Convert whole Minecraft maps

PostPosted: Thu Jan 21, 2016 11:19
by Morn76
sofar wrote:Please post some before-and-after conversion screenshots folks!


MC:

Image

MT:

Image

Looks like the MT mods decided to plant some extra trees on the mountain. Oh well… :-)

Map download:
https://forum.minetest.net/viewtopic.php?f=12&t=13910

Re: Convert whole Minecraft maps

PostPosted: Thu Jan 21, 2016 15:19
by sofar
yes, you can get rid of them, though. I'll also have a better birch variant now that Aspen have landed in minetest_game.

Re: Convert whole Minecraft maps

PostPosted: Thu Jan 21, 2016 16:07
by Morn76
sofar wrote:yes, you can get rid of them, though. I'll also have a better birch variant now that Aspen have landed in minetest_game.

Maybe new trees should also be disabled by default in moretrees_settings.txt. Try to keep things as they are in the original MC map as much as possible when converting.

Re: Convert whole Minecraft maps

PostPosted: Thu Jan 21, 2016 16:38
by sofar
Actually moretrees is now optional, so I should remove it from the mod list.

Re: Convert whole Minecraft maps

PostPosted: Mon Jan 25, 2016 06:40
by sofar
Moretrees is now disabled.

I will change the code to use Aspen trees soon. That means that people need to use the latest git version of minetest_game to use this conversion.

Re: Convert whole Minecraft maps

PostPosted: Sun Jan 31, 2016 15:56
by dgm5555
I haven't been playing or coding minetest for some time, but was looking at the converter out of curiosity.
I presume you found the mcblocks mod which means you don't need many of the minetest mods...
However from other posts I think you really want the extra function of minetest blocks, so perhaps this isn't helpful...
https://forum.minetest.net/viewtopic.php?f=9&t=11448
Cheers
David

Re: Convert whole Minecraft maps

PostPosted: Sun Jan 31, 2016 22:16
by sofar
dgm5555 wrote:I haven't been playing or coding minetest for some time, but was looking at the converter out of curiosity.
I presume you found the mcblocks mod which means you don't need many of the minetest mods...
However from other posts I think you really want the extra function of minetest blocks, so perhaps this isn't helpful...
https://forum.minetest.net/viewtopic.php?f=9&t=11448
Cheers
David


Right, I did find mcblocks but I wanted to focus on bringing functional minetest equivalents (convert, not e.g. translate), instead of that. The list is not that long, and there's also a script now which will fetch all the required mods for the converted world all at once.

The code has been working well, though ;^)

Re: Convert whole Minecraft maps

PostPosted: Sat Mar 12, 2016 22:15
by Sokomine
sofar wrote:Right, I did find mcblocks but I wanted to focus on bringing functional minetest equivalents (convert, not e.g. translate), instead of that. The list is not that long, and there's also a script now which will fetch all the required mods for the converted world all at once.

My own mccompat mod works more like mcblocks as well. It would be of intrest how many nodes I forgot :-) Would it be possible to make your test pattern available as a MC .schematic file?

There's also the problem with flowing liquids that's illustrated in Morn76's screenshots. I wonder if there's a way around that.

Re: Convert whole Minecraft maps

PostPosted: Sat Mar 12, 2016 22:51
by RHR
I tried to convert my MC world to MT, but it seems to fail. =(

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
Traceback (most recent call last):
  File "C:\Users\Username\Downloads\mcimport\mcimport.py", line 113, in <module>
    nimap, ct = content.read_content(["NETHER", "QUARTZ"])
  File "C:\Users\Username\Downloads\mcimport\content.py", line 37, in read_content
    with open("map_content.txt", "r") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'map_content.txt'

Re: Convert whole Minecraft maps

PostPosted: Sat Mar 12, 2016 23:09
by sofar
Make sure you execute it from within the mcimport folder.

Re: Convert whole Minecraft maps

PostPosted: Sat Mar 12, 2016 23:32
by RHR
sofar wrote:Make sure you execute it from within the mcimport folder.

Hmm I'm not sure what I'm doing wrong. =(
I've downloaded and extracted mcimport and all mods and renamed them correctly. The mods are in the worldmods folder in the MT path. "New World" is the MC world. Both world folders MT and MC and all mods are inside mcimport. It still keeps the same error. Could it maybe be the problem that I use the latest MC version 1.9 instead of 1.8?

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
C:\Users\Username>C:\Users\Username\Downloads\mcimport\mcimport.py C:\Users\Username\Downloads\mcimport\NewWorld C:\Users\Username\Downloads\mcimport\MT
Traceback (most recent call last):
  File "C:\Users\Username\Downloads\mcimport\mcimport.py", line 113, in <module>
    nimap, ct = content.read_content(["NETHER", "QUARTZ"])
  File "C:\Users\Username\Downloads\mcimport\content.py", line 37, in read_content
    with open("map_content.txt", "r") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'map_content.txt'

Re: Convert whole Minecraft maps

PostPosted: Sat Mar 12, 2016 23:41
by sofar
RHR wrote:
sofar wrote:Make sure you execute it from within the mcimport folder.

Hmm I'm not sure what I'm doing wrong. =(
I've downloaded and extracted mcimport and all mods and renamed them correctly. The mods are in the worldmods folder in the MT path. "New World" is the MC world. Both world folders MT and MC and all mods are inside mcimport. It still keeps the same error. Could it maybe be the problem that I use the latest MC version 1.9 instead of 1.8?

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
C:\Users\Username>C:\Users\Username\Downloads\mcimport\mcimport.py C:\Users\Username\Downloads\mcimport\NewWorld C:\Users\Username\Downloads\mcimport\MT
Traceback (most recent call last):
  File "C:\Users\Username\Downloads\mcimport\mcimport.py", line 113, in <module>
    nimap, ct = content.read_content(["NETHER", "QUARTZ"])
  File "C:\Users\Username\Downloads\mcimport\content.py", line 37, in read_content
    with open("map_content.txt", "r") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'map_content.txt'



`cd` to the folder with map_content.txt first.

Re: Convert whole Minecraft maps

PostPosted: Sat Mar 12, 2016 23:58
by RHR
omg of course ... |-___-|

Thx, it seems to work, although right now it only prints unknown blocks. I guess I'll see the result tomorrow morning. I'm already curious about it. ;p

Re: Convert whole Minecraft maps

PostPosted: Sun Mar 13, 2016 00:39
by sofar
RHR wrote:omg of course ... |-___-|

Thx, it seems to work, although right now it only prints unknown blocks. I guess I'll see the result tomorrow morning. I'm already curious about it. ;p


Share some screenshots with us. And, of course, let us know the result :)

Re: Convert whole Minecraft maps

PostPosted: Sun Mar 13, 2016 09:43
by RHR
Hey sofar,
I'm very satisfied with the result of mcimport. Most stuff got converted without problems, as you will see in the following pictures. The biggest problem for me are the missing mesa blocks, because I build a lot with them and these buildings are missing or there are just parts of it on the converted map.
I think took around 3 hours to convert the map. The MT map.sqlite has a size of around 70mb.
Image
Image
Image
Image
Image

Re: Convert whole Minecraft maps

PostPosted: Sun Mar 13, 2016 22:35
by sofar
None of the images work - please upload them to imgur and post the links to them instead.

Re: Convert whole Minecraft maps

PostPosted: Sun Mar 13, 2016 22:46
by RHR
Hmm strange...
I uploaded them again. If they still don't work, here is the link to the album on imgur:
album

Re: Convert whole Minecraft maps

PostPosted: Sun Mar 13, 2016 22:55
by sofar
now it works, how strange indeed!.

Great screenshots, thanks for sharing!

Please consider filing an issue for the missing mesa blocks, perhaps we can find a suitable replacement mod for those nodes.

Re: Convert whole Minecraft maps

PostPosted: Mon Mar 14, 2016 02:21
by Nathan.S
Images all seem to be working for me.

Re: Convert whole Minecraft maps

PostPosted: Mon Mar 14, 2016 14:29
by Morn76
Several hardened clay mods already exist for MT, e.g. https://github.com/mdoege/stampy_game/t ... rdenedclay

So you could just rebuild the missing buildings in MT.

Re: Convert whole Minecraft maps

PostPosted: Mon Mar 14, 2016 14:47
by sofar
Morn76 wrote:Several hardened clay mods already exist for MT, e.g. https://github.com/mdoege/stampy_game/t ... rdenedclay

So you could just rebuild the missing buildings in MT.


meh, that one has 32px textures... I strongly prefer keeping it 16px by default.

Re: Convert whole Minecraft maps

PostPosted: Mon Mar 14, 2016 16:18
by Morn76
sofar wrote:
Morn76 wrote:Several hardened clay mods already exist for MT, e.g. https://github.com/mdoege/stampy_game/t ... rdenedclay

So you could just rebuild the missing buildings in MT.


meh, that one has 32px textures... I strongly prefer keeping it 16px by default.

Yes, those are from MC Faithful, so for licensing reasons you would need to use different textures.

I think my main change to the existing mod was to simplify the code and make the colors MC-compatible (i.e. add light blue or whatever MT is always missing compared to MC).