{"id":116374,"date":"2026-06-06T23:23:13","date_gmt":"2026-06-06T20:23:13","guid":{"rendered":"https:\/\/vpesports.com\/minecraft\/mods\/open-and-close-non-player-inventories\/"},"modified":"2026-06-06T23:23:13","modified_gmt":"2026-06-06T20:23:13","slug":"open-and-close-non-player-inventories","status":"publish","type":"mod","link":"https:\/\/vpesports.com\/minecraft\/mods\/open-and-close-non-player-inventories\/","title":{"rendered":"Open And Close Non Player Inventories"},"content":{"rendered":"<p>Inventory Detection: The &#8220;Impossible&#8221; Datapack For years, the Minecraft technical community has searched for a reliable way to detect when a player opens or closes their inventory. Many said it was impossible.<\/p>\n<p>This datapack introduces a revolutionary logic system that detects inventory states in real-time, allowing you to trigger commands the exact moment a player interacts with a chest, lectern, or even a beacon!<\/p>\n<p>How It Works (The &#8220;Bug&#8221; Feature)This pack utilizes a unique behavior within Minecraft&#8217;s advancement system. The &#8220;inventory_changed&#8221; advancement trigger is highly reliable\u2014except for one specific quirk: it stops triggering while a player is inside a non-player inventory.<\/p>\n<p>The Logic:Every single game tick (1\/20th of a second), the pack briefly swaps the player\u2019s head slot with a custom item and back again.This forced change attempts to fire an advancement, scoreboard tracks these fires. <\/p>\n<p>If the advancement stops firing for even one tick, the system knows the player is currently viewing an inventory. The moment the advancement fires again, the system knows the inventory has been closed.<\/p>\n<p>High Performance: Optimized to run every tick with minimal impact on MSPT (usually 0.1-0.2).<\/p>\n<p>Multiplayer Compatible: Tested and verified to work with multiple players on a server simultaneously.<\/p>\n<p>Developer Friendly: All functions and variables are prefixed with Cailem to prevent conflicts with your existing projects.<\/p>\n<p>In Creative mode, the inventory triggers the advancement twice due to unique engine behavior. The pack can actually be used to detect if a player is specifically in the Creative menu!<\/p>\n<p>Examples that are now possible:<br \/>\nLoot Chests: Spawns a chest while mining that automatically cleans itself up the moment you close it.<br \/>\nLectern Traps: Triggers world events (like spawning a Warden) the second a player stops reading.<br \/>\nSurvival Flight: A flight mode that protects the player but force-closes the inventory to prevent &#8220;cheating&#8221; items.<\/p>\n<p>BROKEN:<br \/>\nWhile the audio is suppressed, Minecraft\u2019s subtitles may still show Gear equips.<br \/>\nNote that the rapid item swapping can trigger Skulk Sensors\/Wardens. (This can be disabled via version-specific tags if needed).<\/p>\n<p>Note: This is a technical resource intended for datapack creators and map makers. Knowledge of how to install and reference functions is recommended.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>you can now detect opening and closing inventories with this datapack!<\/p>\n","protected":false},"featured_media":116375,"template":"","meta":{"_minecraft_slug":"open-and-close-non-player-inventories","_minecraft_project_id":"wYbqSee7","_minecraft_author":"cailem02","_minecraft_license":"CC-BY-4.0","_minecraft_downloads":14,"_minecraft_follows":1,"_minecraft_client_side":"optional","_minecraft_server_side":"required","_minecraft_storage_type":"zip","_minecraft_archive_name":"open-and-close-non-player-inventories.zip","_minecraft_size_bytes":14106,"_minecraft_version_count":5,"_minecraft_updated_at":"2026-05-16T00:18:21.077252Z","_minecraft_date_created":"2026-05-08T04:36:41.597830Z","_minecraft_date_modified":"2026-05-07T23:34:22.396080Z","_minecraft_project_url":"https:\/\/modrinth.com\/mod\/open-and-close-non-player-inventories","_minecraft_icon_attachment_id":116375,"_minecraft_imported_at":"2026-06-06T20:23:14+00:00","_minecraft_import_hash":"de95851897ddc1a6465a4ef737c6770f","_minecraft_versions":"","_minecraft_links":"","_minecraft_gallery":"","_minecraft_api_metadata":""},"mod_category":[87,84,89,873,866,92],"mod_loader":[86],"minecraft_version":[114,117,48,50,53,58,102,41,163],"class_list":["post-116374","mod","type-mod","status-publish","has-post-thumbnail","hentry","mod_category-adventure","mod_category-datapack","mod_category-game-mechanics","mod_category-library","mod_category-minigame","mod_category-utility","mod_loader-datapack","minecraft_version-1-14-4","minecraft_version-1-15-2","minecraft_version-1-16-5","minecraft_version-1-17-1","minecraft_version-1-18-2","minecraft_version-1-19-4","minecraft_version-1-20-6","minecraft_version-1-21-11","minecraft_version-26-1-2"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Open And Close Non Player Inventories - 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\/open-and-close-non-player-inventories\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Open And Close Non Player Inventories - Minecraft\" \/>\n<meta property=\"og:description\" content=\"you can now detect opening and closing inventories with this datapack!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/vpesports.com\/minecraft\/mods\/open-and-close-non-player-inventories\/\" \/>\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=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/open-and-close-non-player-inventories\\\/\",\"url\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/open-and-close-non-player-inventories\\\/\",\"name\":\"Open And Close Non Player Inventories - Minecraft\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/open-and-close-non-player-inventories\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/open-and-close-non-player-inventories\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/wp-content\\\/uploads\\\/2026\\\/06\\\/open-and-close-non-player-inventories-icon-2bb7708c1a77f2a5583cdd759b2a907eb73ca326.gif\",\"datePublished\":\"2026-06-06T20:23:13+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/open-and-close-non-player-inventories\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/open-and-close-non-player-inventories\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/open-and-close-non-player-inventories\\\/#primaryimage\",\"url\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/wp-content\\\/uploads\\\/2026\\\/06\\\/open-and-close-non-player-inventories-icon-2bb7708c1a77f2a5583cdd759b2a907eb73ca326.gif\",\"contentUrl\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/wp-content\\\/uploads\\\/2026\\\/06\\\/open-and-close-non-player-inventories-icon-2bb7708c1a77f2a5583cdd759b2a907eb73ca326.gif\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/open-and-close-non-player-inventories\\\/#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\":\"Open And Close Non Player Inventories\"}]},{\"@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":"Open And Close Non Player Inventories - 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\/open-and-close-non-player-inventories\/","og_locale":"en_US","og_type":"article","og_title":"Open And Close Non Player Inventories - Minecraft","og_description":"you can now detect opening and closing inventories with this datapack!","og_url":"https:\/\/vpesports.com\/minecraft\/mods\/open-and-close-non-player-inventories\/","og_site_name":"Minecraft","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/vpesports.com\/minecraft\/mods\/open-and-close-non-player-inventories\/","url":"https:\/\/vpesports.com\/minecraft\/mods\/open-and-close-non-player-inventories\/","name":"Open And Close Non Player Inventories - Minecraft","isPartOf":{"@id":"https:\/\/vpesports.com\/minecraft\/#website"},"primaryImageOfPage":{"@id":"https:\/\/vpesports.com\/minecraft\/mods\/open-and-close-non-player-inventories\/#primaryimage"},"image":{"@id":"https:\/\/vpesports.com\/minecraft\/mods\/open-and-close-non-player-inventories\/#primaryimage"},"thumbnailUrl":"https:\/\/vpesports.com\/minecraft\/wp-content\/uploads\/2026\/06\/open-and-close-non-player-inventories-icon-2bb7708c1a77f2a5583cdd759b2a907eb73ca326.gif","datePublished":"2026-06-06T20:23:13+00:00","breadcrumb":{"@id":"https:\/\/vpesports.com\/minecraft\/mods\/open-and-close-non-player-inventories\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/vpesports.com\/minecraft\/mods\/open-and-close-non-player-inventories\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/vpesports.com\/minecraft\/mods\/open-and-close-non-player-inventories\/#primaryimage","url":"https:\/\/vpesports.com\/minecraft\/wp-content\/uploads\/2026\/06\/open-and-close-non-player-inventories-icon-2bb7708c1a77f2a5583cdd759b2a907eb73ca326.gif","contentUrl":"https:\/\/vpesports.com\/minecraft\/wp-content\/uploads\/2026\/06\/open-and-close-non-player-inventories-icon-2bb7708c1a77f2a5583cdd759b2a907eb73ca326.gif","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/vpesports.com\/minecraft\/mods\/open-and-close-non-player-inventories\/#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":"Open And Close Non Player Inventories"}]},{"@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\/116374","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\/116375"}],"wp:attachment":[{"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/media?parent=116374"}],"wp:term":[{"taxonomy":"mod_category","embeddable":true,"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/mod_category?post=116374"},{"taxonomy":"mod_loader","embeddable":true,"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/mod_loader?post=116374"},{"taxonomy":"minecraft_version","embeddable":true,"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/minecraft_version?post=116374"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}