AMS Transpiler in Python - Readable MCFunction Files

  • check_circle Functions
                  avatar PixelRayn
                  Level 25 : Expert Engineer

                  Advanced Minecraft Scripting

                  This project aims at producing a more human readable version of Minecraft's mcfunction format. This documentation will explain the new syntax, the components of the compiler and contains a user guide to use this program to compile your project into a Minecraft datapack.

                  Please read the docs on GitHub.

                  The Language

                  The AMS transpiler does not actually introduce a new language, but offers a way of organizing existing minecraft code into a more readable format using indentation.


                  will compile to
                  parent line1
                  parent line2

                  This can be useful when you need to write a number of similar lines. For example:

                  execute store result score @s
                  x1 run data get entity @s Pos[0] 1
                  y1 run data get entity @s Pos[1] 1
                  z1 run data get entity @s Pos[2] 1

                  Parsed through the compiler this is assembled into this valid mcfunction code.

                  execute store result score @s x1 run data get entity @s Pos[0] 1
                  execute store result score @s y1 run data get entity @s Pos[1] 1
                  execute store result score @s z1 run data get entity @s Pos[2] 1

                  If statements can also be dramatically simplified:

                  execute if
                  condition1 run
                  say Detected Condition 1
                  function namespace:condition1

                  condition2 run
                  say Detected Condition 2
                  function namespace:condition2


                  Python scripts don't necessarily need to be installed. This section will however explain how to set it up.

                  Setting up the Scripts

                  After installing python, download this repository either through the github website or using git through the console:
                  git clone

                  or if you don't have git:
                  wget -outfile

                  Once you downloaded (and unpacked) the tool into a folder you would like to store it in you need to resolve the dependencies. This project is only dependent on kivy to generate the user interface. Type
                  pip install kivy

                  Install the script as an alias in the console

                  If you are on windows it's also recommended to run the install.ps1 or on linux, so you can use the ams-transpiler in the console.

                  Windows Powershell
                  PS> .\install.ps1

                  Searching for profile...
                  Updating start-up script...
                  Saving to Disk...

                  || DONE! ||
                  PS >

                  Linux Bash
                  user: $ ./

                  Finding Executable Directory...
                  Adding alias to startup file...
                  Update Current Session
                  || DONE! ||

                  Please note that the Windows script will check whether the script is already installed, the Linux script will not. The scripts set the python script as an alias. The install will break if you move the repository after running the script.

                  After you are done check the install in the console (PowerShell on Windows and the Terminal on Linux) by typing
                  > ams -h

                  ams transpiler is designed for mincraft mcfunctions to [...]

                  See the docs for usage reference.
                  CompatibilityMinecraft 1.13
                  toMinecraft 1.17 Snapshot

                  09/29/2020 6:33 am
                  Level 19 : Journeyman Engineer
                  Well done

                  I did not got the time to download it and test myself, but from what you show it seem well designed

                  May I suggest you to add support for function recursivity and loops ?

                  I have myself writed in the past a tool to create mcfunctions files

                  You can find it here

                  in my case, the format was an actual python code with added fonctions

                  I don't remember if the github repository was up to date, and I definitely should improve the doc if I were to resume the project

                  Tell me if you want to discuss this on discord or elsewere, and keep up the good work :)
                  10/04/2020 2:42 pm
                  Level 25 : Expert Engineer
                  While it sounds like a great idea, I think this is beyond the scope of this project. The ams transpiler does not currently add any features. It more or less just bunches strings together in a way that reduces the amount of work to be done.

                  I would suggest you write a ticket on github and maybe someone will branch it :)
                  09/23/2020 4:40 pm
                  Level 1 : New Miner
                  09/23/2020 4:06 pm
                  Level 49 : Master Answer
                  w o w
                  Planet Minecraft Logo


                  © 2010 - 2020