I would like to create a mechanism (1.12 compatible and preferably forward compatible to 1.13) to trigger a function when an item is used or block is placed. For example, I would like to give items like the following 'magic beans':

/give @p minecraft:flower_pot 1 0 {display:{Name:"Magic Beans",Lore:["Creates Beanstalk"]}}

And then when the flower pot is placed by the player I would like a gamerule or advancement (not sure which to choose) to trigger a function at the spot where the block was placed or based on the location of the player that placed the block.

The function would do something like set blocks, fill spaces, grant status effects etc. The idea is that I want to learn how to marry up actions a player can do with custom created blocks or items to kick off functions - and my understanding is that using the scoreboard or advancements might be a good way to do this as an alternative to using command blocks.

I would appreciate a solution that shows what the separate text/json files would contain as well as the relative paths that they would be placed in. For the sake of examples I would plan on having /nsfunc/ and /nsadv/ namespaces in the save folder under functions and advancements respectively.

After some suggested that this is like other existing questions let me elaborate a little. What I am after is a very low maintenance solution, ideally without command blocks. I am trying to determine a simple way for a player to execute functions using specially created inventory so that the player can move around and trigger a function without much setup. For example, throwing a snowball or potion in combat that can trigger complex functions (such as fill the target area with ice blocks). Another example would be placing a block/hitting a block with a custom tool/ standing on a block wearing special armor in order to trigger a function. I don't mind game rules because they can be created and interacted with by the player. I would like to avoid command blocks because they generally require a little more setup by the player. I would like to make a system that can be used by a 6 year old and be easy to setup via a single function call. If a command block or two are truly necessary, I can live with that, but another thing I am aware of is potential performance problems - I would like to be able to extend this two dozens and dozens of function triggering tools, weapons, blocks, entities etc. and I don't want to bog down the PC with dozens of independently running rules. Ideally I would like a single test clock that can maintain a large list of potential item tags that are used to test if conditions are met to make these function calls.

For extra credit I would like to also see how to do something like this by throwing a custom (named) potion or snowball to trigger a function (via advancement or gamerule).

I am currently tinkering with creating a custom sign with an attached function. This satisfies the goal of having a portable way for users to trigger functions. The downsides of signs are 1) they require a second click after placement and, 2) what I would really like is to be able to make dynamic sorts of tools and weapons for combat. I am kind of trying to build a 'magic' arsenal, such as can transform blocks or mobs when used (creeper to bat via kill creeper then summon bat at location, or morph stone block to diamond block with swing of special pickaxe or thrown snowball).

Again simplicity is key. If command blocks, gamerules or achievements are used, I would like to 'compartmentalize them in a way that. I can call a single function once and have that function create all the command blocks, rules or achievements at once in order to get the system up and running for good in a lag conscious setup. My understanding is that in 1.13 I can make use of ticks to run the repeating elements and that there is more flexibility with selectors. For this problem I wouldn't mind replacing or destroying the pot after placement so that there is only ever one custom pot in the world.

Assistance is greatly appreciated.

  • 1
    Why not just use a spawn egg with custom data and detect that/execute from it? Much easier. Also you can't really make a command system "forwards compatible with 1.13", you can just make one 1.12 version and one 1.13 version, because commands have changed so much. Jun 13, 2018 at 20:39
  • thanks fabian. By forward compatible I mean 'likely compatible with 1.13 insofar as the snapshots indicate' I have seen some extensions to commands such as with the new caret notation '^' for player facing relative coordinates; but, I haven't come across anything saying specific commands written with 1.12 would not work with 1.13. As for the spawn egg, my understanding is that detecting/executing is usually accomplished by pre-existing command blocks. See my explanation above about why I would like to find a way to execute a function without, or with very limited cmd block usage. Jun 14, 2018 at 21:07

1 Answer 1


This is actually quite interesting but, it's most definitely possible.

All these commands are off the top of my head and I haven’t tested them.

First change your give command to: give @p minecraft:flower_pot 1 0 {tag:{Tags:[pot]},display:{Name:"Magic Beans",Lore:["Creates Beanstalk"]}}, although it will take a lot of command blocks or a few functions. The first function would detect if the player is holding your “pot”.

scoreboard players set @a 0
scoreboard objectives add potHold dummy
scoreboard players add @a 1 {SelectedItem:{tag:{Tags:[pot]}}}

Now this is kind of finicky, so you would need to tell tell the players using it to only have 1 of the item in their inventory.

The 2nd would have to be a non-function but a string of command blocks in the world. Execute on all players with a pot in their hand to see if there are any pots in the nearby area of the player. If so (conditional command block) then check if the player’s hand is empty (which means he just placed it) and if so summon an invisible armor stand at the location he placed it. Then you can execute any commands you want at that location.

  • Are you assuming all Minecraft players are male? Jun 15, 2018 at 12:00
  • got a problem with that m8?
    – Devan S.
    Jun 15, 2018 at 12:19
  • Thank you for the response. This seems slightly too complex and potentially buggy. I say buggy because I could see some potential to glitch with the empty hand criteria. That seems to be an around-about way to test this. With command blocks, couldn't I just as easily do away with the game rules and run a single command block to continuously kill all items with the pot tag after running the target command at their location? I think that I found something like the functionality I need with signs which can store commands and be 'clicked' to run a function targeted at the sign based on name. Jun 18, 2018 at 19:07

Not the answer you're looking for? Browse other questions tagged .