Block Usables

Block usables are usables attached to block entities, they are triggered when you right click the block in question. Other interactions such as breaking, damaging or walking over a block (in the case of pressure plates) are not supported.

Creating a usable block

To create a usable block you simply have to add an action or condition to a specified block.

For this example, we’ll add a simple show_text action to a chest that’ll tell a player “Hello, <player name>!”. First we look at a block we wish to add the action to and type in /usableblock . If you’re then standing close enough to the block, you’ll see the block’s coordinates in the auto completions like this:

Then we complete the command like so:

/usableblock -44 47 104 actions add show_text Hello, ${player}!

If done correctly, you should something like this:

To see if it worked, Right-Click the chest!
Oh no! Right-Clicking the chest causes it to open. To prevent vanilla block behavior, we use this command:

/usableblock -44 47 104 cancel-interaction true

If that command was run correctly, you should see this:

Now when we Right-Click the block we should see something like this, with your own name instead of mine.

Last modified: 01.11.2024
commit: Port stuff over from tail-arc theme