I like knowing where I am. Handy Compass is a utility hat I use often in other programs. In a flat world, Handy Compass places a gold block level with the grass under the player. It then prints the sign and coordinate name (e.g., +X, -Z) as well as the direction (e.g., E, N) in each of the four directions. An example of Handy Compass output is shown below.
I use this compass instead of the example compasses shown on the MakeCode for Minecraft website because Handy Compass is designed to be background to another program, not the feature.
How Handy Compass Works
Handy Compass is offered as a Chat Command, not a function, so that it can be run asynchronously with the program it supports (e.g. The Art of Random Walks).
Handy Compass operates with the following steps:
- Says the program is running.
- Tests the position variable origin for whether or not it has been set before the function was called. If so, it is left as was, but if it was null (not set), it is set to the positon of the player’s feet.
- Says the coordinates of the origin.
- Places a gold block at origin, but one block down so that it is level with the ground.
- Calls a function for each of the four directions.
- Says that it is done.
Each of the four directions has an assonated function. Each function calculates X and Z for where to print the direction information. All printing is at vertical positon 20, which was chosen by trial and error. In each print block the direction of print is chosen so that if the player is facing the corresponding direction, the print reads from left to right.
Handy Compass Example Uses
See the Categories index for the blog for example uses of Handy Compass. A particularly nice example is The Art of Random Walks because Handy Compass run asynchronously, that is, the compass is created during the random walk.
Get the Code
Handy Compass code is shared on Code Connection at this URL
To get and use the code, follow these steps.
Click the Import button , which is upper right in the Code Connection window just below the banner. This will open the window shown below.
Click the Import URL button , which is on the right, to open the window shown below.
Paste the URL supplied for the program you want to use in the space under the text “Copy the URL …”
Click the Go ahead! button .
The next window you will see will be the MakeCode window with the code downloaded from the URL. At this point, you can treat it like any other code, e.g., run it, save it locally, modify it, publish your changes or whatever else your heat desires.
We have tested several other methods of downloading the code using the URL, for example, pasting the URL in a browser. No joy. For more detailed instruction see our post How to Use Shared MakeCode on Microsoft Code Connection for Minecraft.