{"id":18991326,"url":"https://github.com/mt-mods/wield_events","last_synced_at":"2026-04-14T10:30:17.098Z","repository":{"id":177640403,"uuid":"656761829","full_name":"mt-mods/wield_events","owner":"mt-mods","description":"Events for wield item switching","archived":false,"fork":false,"pushed_at":"2023-10-28T09:33:04.000Z","size":119,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-01T14:45:11.471Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mt-mods.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-21T15:26:57.000Z","updated_at":"2024-02-08T04:01:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"b97df15a-64f8-4318-9504-289e9379540d","html_url":"https://github.com/mt-mods/wield_events","commit_stats":null,"previous_names":["mt-mods/wield_events"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mt-mods%2Fwield_events","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mt-mods%2Fwield_events/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mt-mods%2Fwield_events/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mt-mods%2Fwield_events/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mt-mods","download_url":"https://codeload.github.com/mt-mods/wield_events/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240002364,"owners_count":19732186,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T17:13:32.510Z","updated_at":"2026-04-14T10:30:17.064Z","avatar_url":"https://github.com/mt-mods.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"Events for wield item switching\n\nProvides callbacks for `on_select`, `on_step` and `on_deselect` on wielded items\n\n![luacheck](https://github.com/mt-mods/technic/workflows/luacheck/badge.svg)\n[![License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)\n[![ContentDB](https://content.minetest.net/packages/mt-mods/wield_events/shields/downloads/)](https://content.minetest.net/packages/mt-mods/wield_events/)\n\n# Api\n\n## Item parameter\n```lua\nminetest.register_tool(\"my_mod:my_tool\", {\n    description = \"My tool\",\n    inventory_image = \"my_mod.png\",\n    stack_max = 1,\n    range = 0,\n    on_select = function(itemstack, player)\n        -- called when the player switches to the item\n    end,\n    on_step = function(itemstack, player)\n        -- called on every globalstep while the item is selected\n    end,\n    on_deselect = function(itemstack, player)\n        -- called when the player switches away from the item\n    end\n})\n```\n\n## Global callback\n```lua\nwield_events.register_on_select(function(itemstack, player)\n    -- called when the player switches any item\nend)\n\nwield_events.register_on_step(function(itemstack, player)\n    -- called on every globalstep while any item is selected\nend)\n\nwield_events.register_on_deselect(function(itemstack, player)\n    -- called when the player switches away from any item\nend)\n```\n\n# Demo\n\n* `pick_and_place` https://github.com/BuckarooBanzay/pick_and_place/blob/master/place_tool.lua\n\n# License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmt-mods%2Fwield_events","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmt-mods%2Fwield_events","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmt-mods%2Fwield_events/lists"}