[{"data":1,"prerenderedAt":384},["ShallowReactive",2],{"docs-nav":3,"auth-session":16,"docs-page:\u002Fdocs\u002Fdivinemc\u002Ffeatures\u002Fparallel-sensor-phase":197,"docs-surr:\u002Fdocs\u002Fdivinemc\u002Ffeatures\u002Fparallel-sensor-phase":381},[4],{"title":5,"path":6,"stem":7,"children":8,"page":32},"Docs","\u002Fdocs","docs",[9,104,147],{"title":10,"path":11,"stem":12,"children":13,"icon":15,"badge":16},"About DivineMC","\u002Fdocs\u002Fdivinemc","docs\u002Fdivinemc\u002Findex",[14,17,33,64,74,89],{"title":10,"path":11,"stem":12,"icon":15,"badge":16},"MessageCircleQuestion",null,{"title":18,"path":19,"stem":20,"children":21,"page":32},"Getting Started","\u002Fdocs\u002Fdivinemc\u002Fgetting-started","docs\u002Fdivinemc\u002F01.getting-started",[22,27],{"title":23,"path":24,"stem":25,"icon":26,"badge":16},"Installation","\u002Fdocs\u002Fdivinemc\u002Fgetting-started\u002Finstallation","docs\u002Fdivinemc\u002F01.getting-started\u002Finstallation","Download",{"title":28,"path":29,"stem":30,"icon":31,"badge":16},"Adding Plugins","\u002Fdocs\u002Fdivinemc\u002Fgetting-started\u002Fplugins","docs\u002Fdivinemc\u002F01.getting-started\u002Fplugins","Blocks",false,{"title":34,"path":35,"stem":36,"children":37,"page":32},"Features","\u002Fdocs\u002Fdivinemc\u002Ffeatures","docs\u002Fdivinemc\u002F02.features",[38,43,49,54,59],{"title":39,"path":40,"stem":41,"icon":42,"badge":16},"Lag Compensation","\u002Fdocs\u002Fdivinemc\u002Ffeatures\u002Flag-compensation","docs\u002Fdivinemc\u002F02.features\u002Flag-compensation","Timer",{"title":44,"path":45,"stem":46,"icon":47,"badge":48},"Parallel Sensor Phase","\u002Fdocs\u002Fdivinemc\u002Ffeatures\u002Fparallel-sensor-phase","docs\u002Fdivinemc\u002F02.features\u002Fparallel-sensor-phase","Radar","Experimental",{"title":50,"path":51,"stem":52,"icon":53,"badge":16},"Parallel World Ticking","\u002Fdocs\u002Fdivinemc\u002Ffeatures\u002Fparallel-world-ticking","docs\u002Fdivinemc\u002F02.features\u002Fparallel-world-ticking","Repeat",{"title":55,"path":56,"stem":57,"icon":58,"badge":16},"Portal Search Prefetch","\u002Fdocs\u002Fdivinemc\u002Ffeatures\u002Fportal-search-prefetch","docs\u002Fdivinemc\u002F02.features\u002Fportal-search-prefetch","Torus",{"title":60,"path":61,"stem":62,"icon":63,"badge":16},"Regionized Chunk Ticking","\u002Fdocs\u002Fdivinemc\u002Ffeatures\u002Fregionized-chunk-ticking","docs\u002Fdivinemc\u002F02.features\u002Fregionized-chunk-ticking","Table",{"title":65,"path":66,"stem":67,"children":68,"page":32},"Guides","\u002Fdocs\u002Fdivinemc\u002Fguides","docs\u002Fdivinemc\u002F03.guides",[69],{"title":70,"path":71,"stem":72,"icon":73,"badge":16},"Setting up Sentry","\u002Fdocs\u002Fdivinemc\u002Fguides\u002Fsetting-up-sentry","docs\u002Fdivinemc\u002F03.guides\u002Fsetting-up-sentry","MonitorCog",{"title":75,"path":76,"stem":77,"children":78,"page":32},"Reference","\u002Fdocs\u002Fdivinemc\u002Freference","docs\u002Fdivinemc\u002F04.reference",[79,84],{"title":80,"path":81,"stem":82,"icon":83,"badge":16},"Configuration","\u002Fdocs\u002Fdivinemc\u002Freference\u002Fconfiguration","docs\u002Fdivinemc\u002F04.reference\u002Fconfiguration","Keyboard",{"title":85,"path":86,"stem":87,"icon":88,"badge":16},"System Properties","\u002Fdocs\u002Fdivinemc\u002Freference\u002Fsystem-properties","docs\u002Fdivinemc\u002F04.reference\u002Fsystem-properties","FolderDot",{"title":90,"path":91,"stem":92,"children":93,"page":32},"Development","\u002Fdocs\u002Fdivinemc\u002Fdevelopment","docs\u002Fdivinemc\u002F05.development",[94,99],{"title":95,"path":96,"stem":97,"icon":98,"badge":16},"Contributing to DivineMC","\u002Fdocs\u002Fdivinemc\u002Fdevelopment\u002Fcontributing","docs\u002Fdivinemc\u002F05.development\u002Fcontributing","GitPullRequest",{"title":100,"path":101,"stem":102,"icon":103,"badge":16},"Using DivineMC API","\u002Fdocs\u002Fdivinemc\u002Fdevelopment\u002Fusing-api","docs\u002Fdivinemc\u002F05.development\u002Fusing-api","Wrench",{"title":105,"path":106,"stem":107,"children":108,"icon":15,"badge":16},"About NDailyRewards","\u002Fdocs\u002Fndailyrewards","docs\u002Fndailyrewards\u002Findex",[109,110,123,133],{"title":105,"path":106,"stem":107,"icon":15,"badge":16},{"title":80,"path":111,"stem":112,"children":113,"page":32},"\u002Fdocs\u002Fndailyrewards\u002Fconfiguration","docs\u002Fndailyrewards\u002F01.configuration",[114,118],{"title":80,"path":115,"stem":116,"icon":117,"badge":16},"\u002Fdocs\u002Fndailyrewards\u002Fconfiguration\u002Fconfig","docs\u002Fndailyrewards\u002F01.configuration\u002Fconfig","Files",{"title":119,"path":120,"stem":121,"icon":122,"badge":16},"Placeholders","\u002Fdocs\u002Fndailyrewards\u002Fconfiguration\u002Fplaceholders","docs\u002Fndailyrewards\u002F01.configuration\u002Fplaceholders","Replace",{"title":124,"path":125,"stem":126,"children":127,"page":32},"Usage","\u002Fdocs\u002Fndailyrewards\u002Fusage","docs\u002Fndailyrewards\u002F02.usage",[128],{"title":129,"path":130,"stem":131,"icon":132,"badge":16},"Commands","\u002Fdocs\u002Fndailyrewards\u002Fusage\u002Fcommands","docs\u002Fndailyrewards\u002F02.usage\u002Fcommands","SquareTerminal",{"title":90,"path":134,"stem":135,"children":136,"page":32},"\u002Fdocs\u002Fndailyrewards\u002Fdevelopment","docs\u002Fndailyrewards\u002F03.development",[137,142],{"title":138,"path":139,"stem":140,"icon":141,"badge":16},"Dependencies","\u002Fdocs\u002Fndailyrewards\u002Fdevelopment\u002Fdependencies","docs\u002Fndailyrewards\u002F03.development\u002Fdependencies","Hammer",{"title":143,"path":144,"stem":145,"icon":146,"badge":16},"Events","\u002Fdocs\u002Fndailyrewards\u002Fdevelopment\u002Fevents","docs\u002Fndailyrewards\u002F03.development\u002Fevents","CalendarClock",{"title":148,"path":149,"stem":150,"children":151,"icon":153,"badge":16},"What is Quark?","\u002Fdocs\u002Fquark","docs\u002Fquark\u002Findex",[152,154,172],{"title":148,"path":149,"stem":150,"icon":153,"badge":16},"Presentation",{"title":18,"path":155,"stem":156,"children":157,"page":32},"\u002Fdocs\u002Fquark\u002Fgetting-started","docs\u002Fquark\u002F01.getting-started",[158,163,167],{"title":159,"path":160,"stem":161,"icon":162,"badge":16},"Supported Platforms","\u002Fdocs\u002Fquark\u002Fgetting-started\u002Fsupported-platforms","docs\u002Fquark\u002F01.getting-started\u002F01.supported-platforms","Computer",{"title":164,"path":165,"stem":166,"icon":83,"badge":16},"Installing Quark","\u002Fdocs\u002Fquark\u002Fgetting-started\u002Finstallation","docs\u002Fquark\u002F01.getting-started\u002F02.installation",{"title":168,"path":169,"stem":170,"icon":171,"badge":16},"Examples","\u002Fdocs\u002Fquark\u002Fgetting-started\u002Fexamples","docs\u002Fquark\u002F01.getting-started\u002F03.examples","Clipboard",{"title":173,"path":174,"stem":175,"children":176,"page":32},"Advanced Usage","\u002Fdocs\u002Fquark\u002Fadvanced-usage","docs\u002Fquark\u002F02.advanced-usage",[177,182,187,192],{"title":178,"path":179,"stem":180,"icon":181,"badge":16},"Dependency Management","\u002Fdocs\u002Fquark\u002Fadvanced-usage\u002Fdependency-management","docs\u002Fquark\u002F02.advanced-usage\u002Fdependency-management","Package",{"title":183,"path":184,"stem":185,"icon":186,"badge":16},"Isolated Class Loaders","\u002Fdocs\u002Fquark\u002Fadvanced-usage\u002Fisolated-classloaders","docs\u002Fquark\u002F02.advanced-usage\u002Fisolated-classloaders","Shield",{"title":188,"path":189,"stem":190,"icon":191,"badge":16},"Package Relocation","\u002Fdocs\u002Fquark\u002Fadvanced-usage\u002Fpackage-relocation","docs\u002Fquark\u002F02.advanced-usage\u002Fpackage-relocation","GitBranch",{"title":193,"path":194,"stem":195,"icon":196,"badge":16},"Repository Configuration","\u002Fdocs\u002Fquark\u002Fadvanced-usage\u002Frepository-configuration","docs\u002Fquark\u002F02.advanced-usage\u002Frepository-configuration","Database",{"id":198,"title":44,"badge":48,"body":199,"description":375,"extension":376,"icon":47,"meta":377,"navigation":378,"path":45,"seo":379,"stem":46,"__hash__":380},"docs\u002Fdocs\u002Fdivinemc\u002F02.features\u002Fparallel-sensor-phase.md",{"type":200,"value":201,"toc":370},"minimark",[202,210,215,218,244,247,254,269,272,275,337,341,366],[203,204,206],"callout",{"type":205},"warning",[207,208,209],"p",{},"This feature is experimental and disabled by default. Test it on a staging server before enabling it in production.",[211,212,214],"h2",{"id":213},"about-the-parallel-sensor-phase","About the Parallel Sensor Phase",[207,216,217],{},"Mobs that use the brain AI system (villagers, piglins, hoglins, axolotls, wardens, and others) split their AI into two parts:",[219,220,221,234],"ul",{},[222,223,224,228,229,233],"li",{},[225,226,227],"strong",{},"Sensors"," — periodically ",[230,231,232],"em",{},"scan"," the world: find the nearest living entities, check line of sight with raycasts, look for hostiles, detect held items. They only read world state and write the results into their own mob's brain memories.",[222,235,236,239,240,243],{},[225,237,238],{},"Behaviors"," — ",[230,241,242],{},"act"," on those memories: pathfind, trade, flee, attack.",[207,245,246],{},"On servers with many villagers or piglins, sensors are a stable top entry in profiler output — nearest-entity scans and line-of-sight raycasts are expensive, and every brain mob runs them on a fixed cadence (typically every 20 game ticks, with a random per-mob offset).",[207,248,249,250,253],{},"That cadence is what makes them parallelizable: the set of sensors due to fire on a given tick is known ",[230,251,252],{},"before"," entities start ticking. DivineMC uses this to run a dedicated sensing phase right before the entity ticking phase:",[255,256,257,260,263,266],"ol",{},[222,258,259],{},"All active brain mobs with due sensors are collected.",[222,261,262],{},"Their sensors are executed on a worker thread pool — one task per mob, so a single brain is only ever touched by one thread.",[222,264,265],{},"The world tick thread waits for all sensor tasks to finish before entity ticking begins, so sensors always see a world that is not mutating.",[222,267,268],{},"When each mob later ticks its brain, the pre-computed sensors are simply skipped — their timers were reset exactly as a regular sensor tick would.",[207,270,271],{},"Behaviors still run on the main thread, on the same tick, with the same data they would have seen in vanilla.",[211,273,80],{"id":274},"configuration",[276,277,282],"pre",{"className":278,"code":279,"language":280,"meta":281,"style":281},"language-yaml shiki shiki-themes github-dark","async:\n  parallel-sensors:\n    enable: false      # experimental, opt-in\n    max-threads: 0     # \u003C= 0 means 1\u002F4 of available cores (at least 1)\n","yaml","",[283,284,285,298,306,323],"code",{"__ignoreMap":281},[286,287,290,294],"span",{"class":288,"line":289},"line",1,[286,291,293],{"class":292},"s4JwU","async",[286,295,297],{"class":296},"s95oV",":\n",[286,299,301,304],{"class":288,"line":300},2,[286,302,303],{"class":292},"  parallel-sensors",[286,305,297],{"class":296},[286,307,309,312,315,319],{"class":288,"line":308},3,[286,310,311],{"class":292},"    enable",[286,313,314],{"class":296},": ",[286,316,318],{"class":317},"sDLfK","false",[286,320,322],{"class":321},"sAwPA","      # experimental, opt-in\n",[286,324,326,329,331,334],{"class":288,"line":325},4,[286,327,328],{"class":292},"    max-threads",[286,330,314],{"class":296},[286,332,333],{"class":317},"0",[286,335,336],{"class":321},"     # \u003C= 0 means 1\u002F4 of available cores (at least 1)\n",[211,338,340],{"id":339},"compatibility-notes","Compatibility Notes",[219,342,343,346,349,356],{},[222,344,345],{},"Sensors that may touch disk (the villager bed sensor performs POI lookups) are excluded from the parallel phase and keep running on the tick thread.",[222,347,348],{},"Mobs throttled by EAR (entity activation range) or DAB (dynamic activation of brain) are skipped, matching vanilla behavior of not sensing for inactive mobs.",[222,350,351,352,355],{},"The feature composes with ",[353,354,50],"a",{"href":51},": each world runs its own sensing phase on a shared worker pool.",[222,357,358,359,362,363,365],{},"Plugins registering custom NMS sensors: sensors run off the main thread during this phase. If a custom sensor mutates world state, it must override ",[283,360,361],{},"divinemc$canRunAsync()"," to return ",[283,364,318],{},".",[367,368,369],"style",{},"html pre.shiki code .s4JwU, html code.shiki .s4JwU{--shiki-default:#85E89D}html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}html pre.shiki code .sAwPA, html code.shiki .sAwPA{--shiki-default:#6A737D}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":281,"searchDepth":300,"depth":300,"links":371},[372,373,374],{"id":213,"depth":300,"text":214},{"id":274,"depth":300,"text":80},{"id":339,"depth":300,"text":340},"Running the read-only part of brain AI on a worker thread pool.","md",{},true,{"title":44,"description":375},"6fctrlGzlyx1CcA7qkqhZhrZpp1zJeqWnqSeN0lrtic",[382,383],{"title":39,"path":40,"stem":41,"children":-1},{"title":50,"path":51,"stem":52,"children":-1},1783566611783]