ADDCommand datapack for Minecraft Java 1.21.11
================================================

INSTALL
1. Put AddCommand-1.21.11-Fixed.zip in:
   .minecraft/saves/<world>/datapacks/
2. Enter the world and run /reload
3. Optional: run /function addcommand:help

BIND A COMMAND
1. Hold the target item in your MAIN HAND.
2. Run this as an operator / with cheats enabled:

   /function addcommand:add {command:'say hello'}

   For a one-time-use item, run this instead:

   /function addcommand:add_once {command:'say hello'}

3. Right-click while holding that item. The saved command runs as the player
   who clicked it, even if that player is not an operator.

IMPORTANT INPUT RULE
- Do NOT include the leading slash in the stored command.
  Good: command:'effect give @s speed 5 1'
  Bad:  command:'/effect give @s speed 5 1'
- The easiest quoting style is single quotes around the whole command and
  double quotes inside the command when needed.

EXAMPLES
/function addcommand:add {command:'say I clicked it'}
/function addcommand:add {command:'effect give @s speed 5 1 true'}
/function addcommand:add {command:'tp @s ~ ~10 ~'}
/function addcommand:add {command:'tellraw @s {text:"Hello!",color:"gold"}'}
/function addcommand:add_once {command:'tag @s add vip'}

FIXES / FEATURES IN THIS BUILD
- New one-time command binding: /function addcommand:add_once {command:'say hello'}
  One-time items run the command once and then remove the main-hand item/stack.
- Wind charges now keep their normal use and also run the bound command.
- The same cached-use detection is included for ender pearls, snowballs, eggs,
  experience bottles, splash/lingering potions, eyes of ender, firework rockets,
  and fishing rods.
- Held-use items such as food, bows, shields, and similar items continue to use
  the original minecraft:using_item detector.

VANILLA LIMITATIONS
- Datapacks cannot register a brand-new command such as /addcommand, so this
  uses /function addcommand:add instead.
- The setup /function requires operator permission, but clicking the finished
  item does not.
- Functions normally run at the server's function-permission-level (default 2
  on a dedicated server). Commands needing permission level 3 or 4 will not
  work unless that server setting is raised. Raising it can be dangerous when
  arbitrary commands are stored on items.
- Vanilla has no single event for every possible right-click action. The pack
  uses minecraft:using_item for held uses and explicit minecraft.used counters
  for common instant-use items. A very unusual item interaction may still need
  a dedicated detector added for that item type.
- Binding adds consumable/use_effects components and preserves the item's type,
  count, name, enchantments, lore, durability, and unrelated components.
