Skip to content
This repository was archived by the owner on Apr 12, 2026. It is now read-only.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

28 Commits

Repository files navigation

ClickLib


Caution

This repository has been permanently archived. Development on this project has been discontinued. No future versions, updates, or successors are planned. The codebase is preserved as-is for reference purposes only.


🗄️ Archive Notice

This repository was permanently archived on April 12, 2026.

This project is no longer maintained and will not receive any future updates. No new issues, pull requests, forks intended for continuation, or contributions will be reviewed or accepted.

The repository remains public solely as a historical reference. Use at your own risk — compatibility with current or future Minecraft versions is not guaranteed.

Vanilla click detection library for Minecraft Java Edition 1.21.6 (pack_format 88).

API

Functions

FunctionDescription
clicklib:enableActivates click detection for @s. Called automatically by tick.
clicklib:disableDeactivates click detection for @s. Called automatically by tick.
clicklib:query/is_activeReturns 1 if @s is active, 0 otherwise. Use with execute if function.

Tags — click events

TagFires when
#clicklib:left_clickActive player left-clicks anything
#clicklib:left_click_entityActive player left-clicks an entity
#clicklib:right_clickActive player right-clicks anything
#clicklib:right_click_blockActive player right-clicks a block
#clicklib:right_click_entityActive player right-clicks an entity

Tags — lifecycle & tick

TagFires whenContext
#clicklib:on_enablePlayer activates a click item@s = the player
#clicklib:on_disablePlayer deactivates (item removed)@s = the player
#clicklib:tick_activeEvery tick, per active player@s = the player

How it works

  • Players holding an item with custom_data~{clicklib:{click_item:true}} get the clicklib.active tag automatically.
  • Left-click detection uses a minecraft:interaction probe entity positioned in front of the player each tick.
  • Right-click detection uses advancement triggers, gated by clicklib.active tag condition.
  • On /reload, orphaned probes are killed and advancement states are reset.

Item tag

[custom_data={clicklib:{click_item:true}}]

Multiple items can use the same tag — partial match (~) means any item carrying this key is detected.

Registering hooks

// data/mynamespace/tags/function/right_click.json
{ "values": ["mynamespace:on_right_click"] }
// data/mynamespace/tags/function/on_enable.json
{ "values": ["mynamespace:on_activate"] }
// data/mynamespace/tags/function/tick_active.json
{ "values": ["mynamespace:active_tick"] }

All hooks run as the relevant player (@s).

Query example

executeiffunctionclicklib:query/is_activerunsay I have a click item equipped

Example pack

Run /function example:give_click_wand to get a test item.
Run /function example:check_active to test the query function.

About

ClickLib — Vanilla click detection library for Minecraft 1.21.x

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages