Skip to main content

Embedding MakeCode

Comments

5 comments

  • Debbie Alexander
    Moderator Beacon of Knowledge Super Star

    Nathan Richards - the only way I have been able to think of (with my limited knowledge) to share code with my students in worlds has been as a separate share. I can add it as a link (via the new GOAT feature) and they can run the code, or I can send the text (via email or somesuch), and again, they run the code. But always the player has to initiate the code themselves.

    Anything else I have come across that endures into the start of the world is something that executes through the chat commands and is run through the load files. 

    I know the folks who build worlds make things with code in the "behind the scenes magic," but I don't know how it gets controlled. 

    0
  • Jasper Rutten

    Nathan Richards - You can "embed" or bind a tutorial in to a M:EE world using a education.json file.
    This requires some computer knowledge, mainly editing json and changing some files.

    First you will have to make a tutorial, this is a way to add information and hints to the codebuilder while also limiting the code blocks students can use to the ones they need. You can make a tutorial at https://makecode.com/tutorial-tool and find documentation at https://makecode.com/writing-docs/tutorials .

    Once you completed your tutorial, share it and copy the link. To make a M:EE world use the tutorial you will need to edit the world file (.mcworld) once you have exported it. I recommend using a program like 7zip for this. 

    Open the file, either thru 7zip or unzipping it and opening it (change the .mcworld to .zip), and you will see the file structure of the minecraft world. here you will need to add a new file at the top level of the world file. call it education.json and open it.
    paste this in to it, filling in the link of the tutorial you copied:

    {
      "codebuilder":{
          "defaulturi":"linkToTutorialHere",
          "disableLegacyTitleBar": true,
          "capabilities": {
              "agent":{
                  "permissions":{
                      "canModifyBlocks": true
                  }
              }
          }
      }
    }

    Save the file and close it.
    If you used 7zip, you can close the archive and open the world, it should now work.
    If you unzipped the file, go back to the directory where you extracted the file then copy it back to a zip. change the file type from .zip back to .mcworld and it should now also work.
    You can then import the world again or double click it.

    Hope this helped you.

    4
  • Moderator Beacon of Knowledge Super Star

    Jasper Rutten - Thank you so much for sharing this! 

    0
  • Frank Claikens

    Nathan Richards it is not possible to embed code you made with the codebuilder into a world but there are other ways to embed code in a minecraft world. For example with 'mcfunctions' or like Jasper Rutten explained earlier. However these ways require quite some coding background.


    If you want to get started with embedding code in a world you schould start with using command blocks. In these blocks you can embed a line of code and place them into your world, you can chain command blocks in order to make a program. 

    These command blocks can be activated in different ways: with redstone signal, by a player comming near the block or even 'always active'. In that way command blocks are a very powerfull tool to make your world interactive, responsive or animated.

    Best way to start learning about command blocks is to just dive in: make sure you're in creative mode and then type this command in the chatbox: /give @s command_block
    Now you have command blocks ready in your inventory, place a command block and right-click it to enter it's menu and start experimenting. 

    You can find an extensive list of possible commands here: https://minecraft.fandom.com/wiki/Commands
    It's important to become familiar with the syntax of these commands because also all the other ways of  embedding code into a world rely on these commands as a programming (scripting) language.

    Once your familiar with these commands (children call them 'cheats') you could get deeper into things like mcfunctions (functions embedded in a world), but that is rarely necessary because you can do almost everything by just using (a lot of) command blocks.

    2
  • Jeremy Hook

    Thank you so much Jasper Rutten! This finally let's me make my own Coding Tutorials in game!!

    0

Please sign in to leave a comment.