How would I detect when a player interacts with an anvil? And I don't mean by repairing, I mean opening the anvil interface. How would I also detect when a player interacts with an enchantment table? The only way I can think of is wait till Mojang adds those statistics. Also, is there anyway to stop the interface coming up for crafting tables? the only way I can think to do it is to test for if it has been interacted with, and then immediately replace it with another crafting table. Any help would be appreciated.

  • 2
    I don't think you can do this without mods right now. Mar 20, 2015 at 17:12

1 Answer 1


First two questions aren't possible as far as I know. There's not really a good way to detect if a player right clicks in general; whether it's a specific block would be even harder to detect.

The third question is possible though, as there's a stat.craftingTableInteraction scoreboard objective type.

First, create the objective to track people opening a crafting table:

/scoreboard objectives add openedTable stat.craftingTableInteraction

Delete the crafting table:

/setblock X Y Z air

Then wait a tick for the interface to close, and replace the crafting table:

/setblock X Y Z crafting_table

This should work, but keep in mind that if the player is lagging or has a modded client, they may still be able to craft; don't rely on it completely to stop people from crafting.

  • Would it be possible to just replace the crafting table with another crafting table? Setting air and then a crafting table there would probably be a few seconds where the player could see that interface.
    – thezi3
    Mar 20, 2015 at 21:44
  • @thezi3 Not as far as I can tell. You can remove it in one tick and replace it in the next to have it pretty much instant, but replacing it with another crafting table straight away does nothing (it's still the same block, nothing has changed).
    – SirBenet
    Mar 20, 2015 at 21:45

You must log in to answer this question.

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