{"id":122607,"date":"2026-06-07T08:00:39","date_gmt":"2026-06-07T05:00:39","guid":{"rendered":"https:\/\/vpesports.com\/minecraft\/mods\/player_input\/"},"modified":"2026-06-07T08:00:39","modified_gmt":"2026-06-07T05:00:39","slug":"player_input","status":"publish","type":"mod","link":"https:\/\/vpesports.com\/minecraft\/mods\/player_input\/","title":{"rendered":"Player Input"},"content":{"rendered":"<p># Player Input<br \/>\nPlayer Input is a library specifically designed for handling polling based input detection, made possible by the type specific `input` field on players that gives us 20hz access to the keybinds `forward`, `backward`, `left`, `right`, `jump`, `sneak`, `sprint` at all times, in all game modes, regardless of context, except within GUIs.<\/p>\n<p>The goal of this library is two fold:<\/p>\n<p>1. Optimize actionable retrieval of this data; many packs need this data but its worse for performance for all of them to be polling at the same time.<br \/>\n2. Create easy &#038; useful DX for tracking and acting on changes in this data.<\/p>\n<p>### Usage<\/p>\n<p>Packs that need access to this input data for few out of many players in specific scenarios should use the `capture\/player` path to begin tracking of the data.<\/p>\n<p>Packs that need access to input data for most\/all of players should use the `capture\/players` path to begin tracking of the data, and call the `release\/players` when the data is no longer needed (use `#minecraft:unload` if the data is needed all of the time)<\/p>\n<p>When data is being received, the exclusive `player_input.*` `\/tag` labels are always made available.<\/p>\n<p>Packs that need to do their own custom tracking every tick regardless of if the binds change can use the `raw` entrypoint. If only some players need to be checked use the `#player_input:player\/raw` function tag (called as\/at each player) and use your own `\/tag` label to filter players your pack is operating with as the function tag will be called for all usage of the library.<\/p>\n<p>Events: <\/p>\n<p>These entrypoints are called as\/at players that match the required state along with context data made available to functions in each tag, enabling event-based handling, instead of checking for state every tick.<\/p>\n<p>To subscribe to any of these, call the appropriate capture function, then to clean up after usage, call the release function.<\/p>\n<p>As with `raw`, make sure to `\/tag` players that your pack is specifically handling, as the function tag will be called for all usage of the library.<\/p>\n<p>&#8211; `key_update` &#8211; Called as\/at players whose input stack has changed from the previous tick.<br \/>\n    &#8211; Tracked via the exclusive `player_input.previous.*` `\/tag` labels and the `player_input.current_tick`\/`player_input.previous_tick` composite Scores on the player.<br \/>\n    &#8211; This context is also available for the following events.<br \/>\n&#8211; `key_down` &#8211; Called as\/at players that **were not** holding down any given key(s) in the previous tick and started to.<br \/>\n    &#8211; Tracked via the exclusive `player_input.down.*` `\/tag` labels and the `keys_down player_input.current_tick` composite Score during execution.<br \/>\n&#8211; `key_up` &#8211; Called as\/at players that **were** holding down any given key(s) in the previous tick and released them.<br \/>\n    &#8211; Tracked via the exclusive `player_input.up.*` `\/tag` labels and the `keys_up player_input.current_tick` composite Score during execution.<\/p>\n<p>### Example<\/p>\n<p>`jetpack:jetpack\/equip`<br \/>\n&#8220;`mcfunction<br \/>\ntag @s add jetpack.equipped<\/p>\n<p>function player_input:capture\/player\/key_update<\/p>\n<p># Jetpack Things&#8230;<br \/>\n&#8220;`<\/p>\n<p>`jetpack:input_received`<br \/>\n&#8220;`mcfunction<br \/>\nexecute if entity @s[tag=jetpack.equipped] run function jetpack:jetpack\/control<br \/>\n&#8220;`<\/p>\n<p>`jetpack:jetpack\/control`<br \/>\n&#8220;`mcfunction<br \/>\n# Handle changes to player input<br \/>\n&#8220;`<\/p>\n<p>`jetpack:jetpack\/unequipped`<br \/>\n&#8220;`mcfunction<br \/>\ntag @s remove jetpack.equipped<\/p>\n<p>function player_input:release\/player\/key_update<\/p>\n<p># Jetpack Things&#8230;<br \/>\n&#8220;`<\/p>\n<p>`#player_input:player\/key_update`<br \/>\n&#8220;`json<br \/>\n{<br \/>\n    &#8220;values&#8221;: [<br \/>\n        &#8220;jetpack:input_received&#8221;<br \/>\n    ],<br \/>\n    &#8220;replace&#8221;: false<br \/>\n}<br \/>\n&#8220;`<\/p>\n<p>### Plans<br \/>\n&#8211; Create a couple full proof-of-concept survival packs using this library and Player Motion.<br \/>\n&#8211; Reimplement in the Sandstone official `player` library<br \/>\n&#8211; Create a vanilla usage harness and deploy it to this repo<br \/>\n&#8211; Archive the current manually written vanilla code, automatically publish generated code to this repository.<br \/>\n&#8211; Port proof-of-concept packs to Sandstone.<br \/>\n&#8211; Maintain for changes in minecraft updates.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Handles polling based input detection, made possible by the type-specific input field on players, provides easy &#038; useful DX for tracking and acting on changes in this data.<\/p>\n","protected":false},"featured_media":122608,"template":"","meta":{"_minecraft_slug":"player_input","_minecraft_project_id":"m4ZxIWME","_minecraft_author":"MulverineX","_minecraft_license":"MIT","_minecraft_downloads":93,"_minecraft_follows":0,"_minecraft_client_side":"optional","_minecraft_server_side":"required","_minecraft_storage_type":"zip","_minecraft_archive_name":"player_input.zip","_minecraft_size_bytes":17230,"_minecraft_version_count":1,"_minecraft_updated_at":"2026-05-15T22:25:35.321028Z","_minecraft_date_created":"2024-09-26T05:25:53.684818Z","_minecraft_date_modified":"2025-11-18T19:31:49.587227Z","_minecraft_project_url":"https:\/\/modrinth.com\/mod\/player_input","_minecraft_icon_attachment_id":122608,"_minecraft_imported_at":"2026-06-07T05:00:40+00:00","_minecraft_import_hash":"d52c5f7bd131a554e468343d50f879d1","_minecraft_versions":"","_minecraft_links":"","_minecraft_gallery":"","_minecraft_api_metadata":""},"mod_category":[84,89,873,90],"mod_loader":[86],"minecraft_version":[40,73,74,38,78,79,80,81,82],"class_list":["post-122607","mod","type-mod","status-publish","has-post-thumbnail","hentry","mod_category-datapack","mod_category-game-mechanics","mod_category-library","mod_category-optimization","mod_loader-datapack","minecraft_version-1-21-10","minecraft_version-1-21-2","minecraft_version-1-21-3","minecraft_version-1-21-4","minecraft_version-1-21-5","minecraft_version-1-21-6","minecraft_version-1-21-7","minecraft_version-1-21-8","minecraft_version-1-21-9"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Player Input - Minecraft<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/vpesports.com\/minecraft\/mods\/player_input\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Player Input - Minecraft\" \/>\n<meta property=\"og:description\" content=\"Handles polling based input detection, made possible by the type-specific input field on players, provides easy &amp; useful DX for tracking and acting on changes in this data.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/vpesports.com\/minecraft\/mods\/player_input\/\" \/>\n<meta property=\"og:site_name\" content=\"Minecraft\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/player_input\\\/\",\"url\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/player_input\\\/\",\"name\":\"Player Input - Minecraft\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/player_input\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/player_input\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/wp-content\\\/uploads\\\/2026\\\/06\\\/player_input-icon-75220000495ecf312c4de69cd5567ba78b1ceffe_96.webp\",\"datePublished\":\"2026-06-07T05:00:39+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/player_input\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/player_input\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/player_input\\\/#primaryimage\",\"url\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/wp-content\\\/uploads\\\/2026\\\/06\\\/player_input-icon-75220000495ecf312c4de69cd5567ba78b1ceffe_96.webp\",\"contentUrl\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/wp-content\\\/uploads\\\/2026\\\/06\\\/player_input-icon-75220000495ecf312c4de69cd5567ba78b1ceffe_96.webp\",\"width\":96,\"height\":96},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/player_input\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Mods\",\"item\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Player Input\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/#website\",\"url\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/\",\"name\":\"Minecraft\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Player Input - Minecraft","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/vpesports.com\/minecraft\/mods\/player_input\/","og_locale":"en_US","og_type":"article","og_title":"Player Input - Minecraft","og_description":"Handles polling based input detection, made possible by the type-specific input field on players, provides easy & useful DX for tracking and acting on changes in this data.","og_url":"https:\/\/vpesports.com\/minecraft\/mods\/player_input\/","og_site_name":"Minecraft","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/vpesports.com\/minecraft\/mods\/player_input\/","url":"https:\/\/vpesports.com\/minecraft\/mods\/player_input\/","name":"Player Input - Minecraft","isPartOf":{"@id":"https:\/\/vpesports.com\/minecraft\/#website"},"primaryImageOfPage":{"@id":"https:\/\/vpesports.com\/minecraft\/mods\/player_input\/#primaryimage"},"image":{"@id":"https:\/\/vpesports.com\/minecraft\/mods\/player_input\/#primaryimage"},"thumbnailUrl":"https:\/\/vpesports.com\/minecraft\/wp-content\/uploads\/2026\/06\/player_input-icon-75220000495ecf312c4de69cd5567ba78b1ceffe_96.webp","datePublished":"2026-06-07T05:00:39+00:00","breadcrumb":{"@id":"https:\/\/vpesports.com\/minecraft\/mods\/player_input\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/vpesports.com\/minecraft\/mods\/player_input\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/vpesports.com\/minecraft\/mods\/player_input\/#primaryimage","url":"https:\/\/vpesports.com\/minecraft\/wp-content\/uploads\/2026\/06\/player_input-icon-75220000495ecf312c4de69cd5567ba78b1ceffe_96.webp","contentUrl":"https:\/\/vpesports.com\/minecraft\/wp-content\/uploads\/2026\/06\/player_input-icon-75220000495ecf312c4de69cd5567ba78b1ceffe_96.webp","width":96,"height":96},{"@type":"BreadcrumbList","@id":"https:\/\/vpesports.com\/minecraft\/mods\/player_input\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/vpesports.com\/minecraft\/"},{"@type":"ListItem","position":2,"name":"Mods","item":"https:\/\/vpesports.com\/minecraft\/mods\/"},{"@type":"ListItem","position":3,"name":"Player Input"}]},{"@type":"WebSite","@id":"https:\/\/vpesports.com\/minecraft\/#website","url":"https:\/\/vpesports.com\/minecraft\/","name":"Minecraft","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/vpesports.com\/minecraft\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/mod\/122607","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/mod"}],"about":[{"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/types\/mod"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/media\/122608"}],"wp:attachment":[{"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/media?parent=122607"}],"wp:term":[{"taxonomy":"mod_category","embeddable":true,"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/mod_category?post=122607"},{"taxonomy":"mod_loader","embeddable":true,"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/mod_loader?post=122607"},{"taxonomy":"minecraft_version","embeddable":true,"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/minecraft_version?post=122607"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}