Weirdness in the On-Item-Used Event with Touch-Interface MakeCode for Minecraft

Having finished my next major program, Riding the Rails , I was testing it on various platforms to note any incompatibilities. One incompatibility I knew about — that Education Edition only has three of the 24 monsters in Minecraft on Windows 10. This is not a big problem as long as a player knows what to expect.

However, while testing on the iPad, I found a much more serious problem. The on-item-used event, new in the latest release, does not work the same way on the iPad as it does on the Minecraft Education Edition. After experimenting with workarounds and testing, I came to understand that the actual incompatibility was between keyboard-mouse-interface usage and touch-interface usage. To wit, using only the touch interface on Microsoft Surface Studio demonstrated the same anomalous behavior as on the iPad. When using the keyboard-mouse interface on the same Surface, there was no incompatibility.

Results on-item-used Compatibility Tests


The table below show test results for both keyboard-mouse interface and touch interface for each of  three systems: MakeCode for Minecraft on Windows 10, MakeCode for Minecraft Education Edition (Windows 10) and MakeCode for Minecraft Education Edition (iPad). As expected results are shown in blue. Not as expected results are shown in red. Blue good. Red bad.

event behavior

Further information on these test results are demonstrated in the sections below.

Microsoft Surface Studio Keyboard-Mouse Interface Compared to Weird Touch Interface

To demonstrate this discrepancy, I used Minecraft Education Edition on a Surface Studio.  I will first show a short video of keyboard-mouse usage of the on-item-used event then I will show a touch-only usage on the same system.

The keyboard-mouse interface on MakeCode for Minecraft on Windows 10 works as expected — like the keyboard-mouse interface on Education Edition.

iPad (Touch Interface) on-item-used Event Weirdness

Now I’ll run the same program on the iPad.

Test on MakeCode for Minecraft on Windows 10

The test on MakeCode for Minecraft on Windows 10 yielded the same results as the Education Edition: using keyboard-mouse interface the on-item-used event worked as expected; but, using touch interface it did not.

The Code

This code is designed only for exploring the awesome new on-item-used event in MakeCode for Minecraft. The code has two parts. First, the on-start block, which runs every time the program starts, and second, the event code for each type of  item used, which runs for the appropriate on-item-used event.


The on-start block gives the player five items that will be used to generate on-item-used events.

on start

There are five on-item-used event blocks, each with code specific to the item used. Each of these blocks increments a counter for the specific item and says the item name along with the count.

on item used

Get the Code

on-item-used Weirdness  code is shared on Code Connection at this URL

To get and use the code, follow these steps.

Click the Import button import button , which is upper right in the Code Connection window just below the banner. This will open the window shown below.
Import choices

Click the Import URL button Import URL, which is on the right, to open the window shown below.

Import Copy link

Paste the URL supplied for the program you want to use in the space under the text “Copy the URL …”
import url with url

Click the Go ahead! button 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.

One thought on “Weirdness in the On-Item-Used Event with Touch-Interface MakeCode for Minecraft

  1. Pingback: Riding the Rail with MakeCode for Minecraft | We Code MakeCode