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.
Minecraft how to detect when a player accesses an anvil
minecraft-commandsminecraft-java-edition
Related Topic
- Minecraft – Replace the item crafted with a tag
- Minecraft – How to determine which hopper the user clicked in Minecraft with command blocks
- Minecraft 1.12 reliably detect player-player interaction
- Minecraft – Making crafted items usable in adventure mode
- Minecraft – way to change what occurs when a specific block is broken
Best Answer
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:
Delete the crafting table:
Then wait a tick for the interface to close, and replace the 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.