Git Product home page Git Product logo

mcimport's Introduction

mcimport

Convert Minecraft maps to Minetest worlds

The process is offline. Minecraft should not be running on the world that is to be converted. The output should be an empty folder, and no map.sqlite should be present in the empty folder.

The output is a world folder that is playable, permitted that the required minetest mods are installed. If mods are missing, you will encounter "Unknown" blocks in the minetest world.

This mcimport fork was created to improve on the existing mcimport project, with one significant change: This form aims to create playable minetest worlds where stuff works:

  • chests can be used to put stuff in
  • doors open and close
  • simple mesecons circuits may work
  • furnaces work

Also, the assumption is that converted maps are for multiplayer use, and that the most important motivation for using this converter is to preserve previously custom built objects and buildings, but not meant to preserve the gameplay style and feel of minecraft. As such, there are numerous blocks that are not converted 1:1 from MC to MT. A good example is Lapis Lazuli. LL ore will be converted to plain stone, and LL blocks into blue wool, simply because there is no reasonable equivalent in MT that is an actually useful block and not something created purely to copy MC. This project also aims to never convert blocks to "Unknown" nodes and strives to leave a playable are that is friendly for users performing a one-time conversion.

  • some flowers are approximations
  • double plants may end up being single node blocks
  • wood types are similarly not an exact copy
  • until fixed, beds, doors, fences, walls are likely broken
  • signs convert, but MT can't rotate them in 30 degree angles

There are a large number of things that are just never going to be convertable, and so the following will likely never work and are therefore converted to air blocks. Entities are readily spawned by several mob mods in minetest, so conversion is likely not critical to users, and left out.

  • crafting table
  • hoppers, dispensers, droppers
  • entities

Usage:

You'll need to use a Linux system and have python installed. The easiest way to invoke the converter is to run the mcimport.sh script without any parameters. This takes you through a bunch of screens that you can use to select a world and configure a few settings.

win10

  • python Installation, Add Python to PATH
  • Copy the map to the mcimport-master folder
  • Command Prompttomcimport-master location, Key in python mcimport.py Enter out Enter Replace with your map name,out is your name after Convert.
  • you need Download Map Or go to the map after you Convert . Open the get-mods.sh with Notepad to download the mods link. Copy mod to minetest\mods,Copy map to minetest\worlds
  • Currently; you need to find the minecraft coordinates, and convert them before teleporting to the minetest ones.
Coordinate Conversion from Minecraft to Minetest:

X = Approximately +16 nodes
Y = Approximately -64 nodes
Z = The number is approximately inverted. -16 nodes

A general Example of converted coordinates:

 Minecraft: 100, 1, -100 
 Minetest: 116, -63, 84

I took a quick look at that map's coordinates in minecraft. You'll need to teleport/fly to the following coordinates in your converted world.

/grantme all
/teleport 116,-63,-100

License:

Copyright (C) 2016 - Nore, dgm555, sofar and others

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of the authors shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the authors.

mcimport's People

Contributors

dgm3333 avatar ekdohibs avatar ensonic avatar mystictempest avatar pantyhose-x avatar schmeldric avatar sofar avatar zaoqi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mcimport's Issues

Exception on import from 1.15.2

When starting the import, an exception occurs and creates an empty world:

python3 mcimport.py ... ...
Traceback (most recent call last)::00:14 h:m:s
  File "mcimport.py", line 107, in <module>
    mtmap.save()
  File "/home/dummy/mcimport/block.py", line 455, in save
    for block in self.blocks:
  File "/home/dummy/mcimport/block.py", line 439, in fromMCMapBlocksIterator
    for mcblock in mcmap.getBlocksIterator():
  File "/home/dummy/mcimport/block.py", line 62, in getBlocksIterator
    blocks = self.getChunk(chkx, chkz).blocks
  File "/home/ndurchx/mcimport/block.py", line 45, in getChunk
    return MCChunk(chkx, chkz, self.world_path, self.ext)
  File "/home/dummy/mcimport/block.py", line 91, in __init__
    self.blocks.append(MCBlock(raw_data, (chkx, chkz), section["Y"], True))
  File "/home/dummy/mcimport/block.py", line 108, in __init__
    self.from_section(section)
  File "/home/dummy/mcimport/block.py", line 174, in from_section
    self.blocks = self.reverse_X_axis(section["Blocks"])
KeyError: 'Blocks'

Versions:
Minecraft: 1.15.2 (no mods)
Python: 3.6.9

On some worlds, the exception happens at the first line of the output. On other worlds, after a few correct output lines.
Here is a vanilla map, on which I have the exception at the first line (removed player data):
MTTest.zip

Segmentation fault in minetest after converting with mcimport

If I try to convert a particular Minecraft world with mcimport, I get a Segmentation Fault when I try to load it in minetest. Here's the error from minetest:

.....
2020-06-16 19:09:23: INFO[Main]: Client::scanModSubfolder(): Loading "/usr/share/minetest/builtin/common/chatcommands.lua" as "*builtin*:common/chatcommands.lua".
2020-06-16 19:09:23: INFO[Main]:   size: 3138 bytes
2020-06-16 19:09:23: INFO[Main]: Client::scanModSubfolder(): Loading "/usr/share/minetest/builtin/common/information_formspecs.lua" as "*builtin*:common/information_formspecs.lua".
2020-06-16 19:09:23: INFO[Main]:   size: 4038 bytes
2020-06-16 19:09:23: VERBOSE[Main]: Loading and running script @*builtin*:init.lua
2020-06-16 19:09:23: ERROR[Main]: The following mods could not be found: "colour_chat" "csm_who_plus"
2020-06-16 19:09:23: INFO[Main]: Client loading mods: 
2020-06-16 19:09:23: INFO[Main]: Client got TOCLIENT_MOVE_PLAYER pos=(-10,0,0) pitch=0 yaw=0
2020-06-16 19:09:23: INFO[Main]: Client: Privileges updated: ban basic_privs debug interact kick password privs server shout 
2020-06-16 19:09:23: INFO[Main]: Client: Detached inventory update: "creative_Snowflake", mode=update
2020-06-16 19:09:23: INFO[Main]: Client: Detached inventory update: "creative_Snowflake", mode=update
Segmentation fault (core dumped)

Said world can be found here, with the input and output of mcinput: https://send.firefox.com/download/1260c04323ecf744/#xyqM2fr2P49OY0bSx4KYLw

(it's a big file, so unfortunately I had to use Firefox Send. Download expires after 100 downloads or 7 days)

Unfortunately, Minetest isn't giving me much to work with to debug the problem.

I have discovered some other example Minecraft worlds that cause the same problem too if they are required.

more details for "Unknown Minecraft Block:52:0"

What does the ":52:0" stand for? Any guidance what to do to improve coverage?

The README only mentions 'missing mode' which is a bit vague. How do I find out what mod I would need to install?

Fail. in block.py

with this:
./mcimport.sh
./mcimport.sh: line 15: cd: /home/myuser/.minecraft/saves: No such file or directory

(zenity:207977): Gtk-WARNING **: 18:36:54.356: Theme parsing error: gtk.css:6703:68: Invalid name of pseudo-class

(zenity:208059): Gtk-WARNING **: 18:37:02.201: Theme parsing error: gtk.css:6703:68: Invalid name of pseudo-class

(zenity:208159): Gtk-WARNING **: 18:37:13.627: Theme parsing error: gtk.css:6703:68: Invalid name of pseudo-class
Traceback (most recent call last):0:00:28 h:m:s
File "/.../mcimport.py", line 107, in
mtmap.save()
File "/.../block.py", line 455, in save
for block in self.blocks:
File "/.../block.py", line 439, in fromMCMapBlocksIterator
for mcblock in mcmap.getBlocksIterator():
File "/r.../block.py", line 62, in getBlocksIterator
blocks = self.getChunk(chkx, chkz).blocks
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.../block.py", line 45, in getChunk
return MCChunk(chkx, chkz, self.world_path, self.ext)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.../block.py", line 91, in init
self.blocks.append(MCBlock(raw_data, (chkx, chkz), section["Y"], True))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.../block.py", line 108, in init
self.from_section(section)
File "/.../block.py", line 174, in from_section
self.blocks = self.reverse_X_axis(section["Blocks"])
~~~~~~~^^^^^^^^^^
KeyError: 'Blocks'

(zenity:208172): Gtk-WARNING **: 18:37:13.984: Theme parsing error: gtk.css:6703:68: Invalid name of pseudo-class

Minecraft PE support

Hello, every developer:

Can you develop a branch to convert maps of MCPE 1.2 or higher to Minetest maps?

If you can, I can't thank you enough.

Minetester · BingFengFSX(IFRFSX).

KeyError: 'Level'

As an enthusiastic newcomer to Minetest, I would love to bring some of my old worlds over from Minecraft. This script looks like what I'm after, but running it yields only the following error message and an exit status 1.

$ python3 mcimport.py "$HOME/Desktop/tree-world" "$HOME/.minetest/worlds/tree-world"
$HOME/mcimport/tile_entities.py:117: SyntaxWarning: invalid escape sequence '\/'
  m = re.search('\/time set (\d+)', c)
Traceback (most recent call last)::??:?? h:m:s
  File "$HOME/mcimport/mcimport.py", line 107, in <module>
    mtmap.save()
  File "$HOME/mcimport/block.py", line 455, in save
    for block in self.blocks:
  File "$HOME/mcimport/block.py", line 439, in fromMCMapBlocksIterator
    for mcblock in mcmap.getBlocksIterator():
  File "$HOME/mcimport/block.py", line 62, in getBlocksIterator
    blocks = self.getChunk(chkx, chkz).blocks
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "$HOME/mcimport/block.py", line 45, in getChunk
    return MCChunk(chkx, chkz, self.world_path, self.ext)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "$HOME/mcimport/block.py", line 86, in __init__
    raw_data = nbt.read(udata)['']['Level']
               ~~~~~~~~~~~~~~~~~~~^^^^^^^^^
KeyError: 'Level'

Home directory redacted; substituted with $HOME.

I tried it with the shell script first, but found that iterating while debugging was faster if I just ran the python script directly, and I was getting the same result either way.

I have tried it on four different worlds and get exactly the same result. One of the worlds is from MC 1.20.6 and another is from 1.12.2, so save version doesn't seem to be related. I've linked the example (from 1.19) below. (It's too large to attach apparently.)
https://www.icloud.com/iclouddrive/044AlMrcWsxo3Bi50eVQuzzHA#source-tree-world

The output folder does seem to contain some basic files, which I've attached in case it's useful.
tree-world.tar.gz

Information

  • OS: Arch Linux (fully updated)
  • Python: 3.12.3
  • Other info available on request.

Thank you for your time! I really appreciate it!

Migrate mcimport.sh to Python

The mcimport.sh script is pretty simple and could be re-implemented in Python with perhaps Tkinter used for popup messages. OS specific operations such as checking if a directory exists can be done by using the Python os.path module.

This should make the code more portable and eliminate the need for users to have extra programs such as zenity and bash installed on their systems.

Possibility of including conversion option for MineClone2 in addition to Minetest Game?

Hi,

I received some feedback recently regarding the possibility of this feature to simplify things for end users. That way users only need this one, the original mcimport script, but could choose between conversions.

As opposed to having one version of mcimport for MTG, and my slightly modified fork for use with MCL2: mcimport_for_MineClone2

But, before looking into how to modify the code for this, or attempting any PRs. I figured I'd ask; would y'all be open to having this feature?

IndexError: list index out of range

mtserver@ns533923:~/mcimport$ python3 mcimport.py
Traceback (most recent call last):
File "/home/mtserver/mcimport/mcimport.py", line 16, in
if not os.path.exists(sys.argv[1]):
~~~~~~~~^^^

KeyError: 'Blocks' when converting Minecraft "Witchcraft & Wizardry"

Hi, I am trying to convert the "Witchcraft & Wizardry" Minecraft project (Light version first) from the following website.

https://gumroad.com/l/floomap
http://www.mediafire.com/file/xke143473zi4ytp/Witchcraft_and_Wizardry_-_Light.zip/file

Problem is I do get the following error during conversion:

$ python3 mcimport.py ../Witchcraft\ and\ Wizardry\ -\ Light/ ../witchcraft_and_wizardry/
Processed 0 / 182570 chunks, ETA ??:??:?? h:m:s
Processed 10 / 182570 chunks, ETA 0:00:32 h:m:s
...
Processed 1250 / 182570 chunks, ETA 0:01:05 h:m:s
chunkpos -353 yslice -1, chunkpos 127
Traceback (most recent call last):
  File "mcimport.py", line 107, in <module>
    mtmap.save()
  File "/home/sthieme/Downloads/mcimport/block.py", line 457, in save
    for block in self.blocks:
  File "/home/sthieme/Downloads/mcimport/block.py", line 441, in fromMCMapBlocksIterator
    for mcblock in mcmap.getBlocksIterator():
  File "/home/sthieme/Downloads/mcimport/block.py", line 63, in getBlocksIterator
    blocks = self.getChunk(chkx, chkz).blocks
  File "/home/sthieme/Downloads/mcimport/block.py", line 45, in getChunk
    return MCChunk(chkx, chkz, self.world_path, self.ext)
  File "/home/sthieme/Downloads/mcimport/block.py", line 92, in __init__
    self.blocks.append(MCBlock(raw_data, (chkx, chkz), section["Y"], True))
  File "/home/sthieme/Downloads/mcimport/block.py", line 110, in __init__
    self.from_section(section)
  File "/home/sthieme/Downloads/mcimport/block.py", line 176, in from_section
    self.blocks = self.reverse_X_axis(section["Blocks"])
KeyError: 'Blocks'

I changed the logging a bit and added the output of the chunkpos, yslice, chunkpos in block.py line 92 to give some more context. Dunno if this is helpful ?

BTW: I have had to change the shebang to #!/bin/bash in your mcimport.py otherwise the resulting get_mods.sh would not run under Linux Mint / Debian.

better progress reporting

The conversion can take quite a bit of time. Right now the status is reported as

Saved xxxxx blocks

If the tool knows the size of the world, would it be possible to report it as

Saved xxxxx/yyyyy blocks

Ideally with some ETA. Unfortunately in blocks.py self.blocks in a generator, and hence it is a bit more involved to get the len(). Anyway, I'll give it a try.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.