I ‐ Scrubber Hatch - Alecsioo/MMCE-Addons GitHub Wiki
Scrubber Hatch Details
Scrubber Hatch Rework (v2.0.0 and above)
For an overview of how scrubber hatches worked previously and recipe setup, please refer to the Legacy section below.
Starting from v2.0.0, scrubber hatches have been reworked to better integrate with the NuclearCraft radiation handling system. Scrubbers now manage radiation more effectively than before. While this improves behavior overall, there are still some edge cases where radiation may leak: for example, between recipe cycles or after a world restart.
Under the hood, scrubbing is now managed through a cache system: a saved mapping of chunks → active scrubber associations. This cache is queried directly by the NC radiation handler.
Since this is an integration between two very different systems, one designed to work on a per-tick basis, and the other running asynchronously without guaranteeing updates every tick, there are certain situations where radiation might still spread unexpectedly:
-
Between recipes: When a scrubber starts working, it adds itself to the cache to signal: “I’m scrubbing this chunk.” When the recipe ends, the scrubber flushes its internal list of scrubbed chunks. This creates a small time window between recipes where the NC radiation handler may see that the scrubber is not handling a given chunk, as the list will only be rebuilt when the next recipe starts.
-
On world restart: At startup, all scrubber hatches must re-add themselves to the cache. During this initialization phase, there may be a brief window where the NC handler spreads radiation while the scrubbers are still registering.
Important: For performance reasons and to minimize the edge cases mentioned above, it is recommended to use longer recipes. This reduces how often the cache needs to be updated and helps keep scrubbing consistent.
A new command (/getScrubbedChunksCacheInfo) has been added to provide a dump of the cache contents, which should allow to quickly check its state for debugging purposes.
Legacy (for V1.0.2 and below)
Overview
Scrubber hatches work similarly to radiation hatches, but with the following key differences:
- The chunk radiation buffer and level are set to
0
. - The recipe will always run regardless of the amount of radiation in the chunk.
JSON Configuration Example
Here is an example of the JSON configuration for a scrubber hatch:
{
"type": "modularmachineryaddons:scrubber",
"io-type": "input",
"chunkRange": 3
}
Explanation:
- type: Defines the type of the hatch as
scrubber
. - io-type: Specifies the input/output type, for this hatch it must be input.
- chunkRange: Defines the range of chunks the scrubber will affect. In this case, it affects chunks in a range of 3.
ZS Integration
Information on how to add requirements through ZenScript can be found here
Limitations
Due to some limitations, it was not possible to fully replicate the behavior of NuclearCraft (NC) scrubbers. For this reason, the scrubber hatch will always clean up radiation, but it may sometimes not be fast enough to prevent lethal radiation levels from affecting the player.
Key Points:
- The hatch works for vanilla NC radiation amounts.
- If the scrubber is dealing with large amounts of radiation (millions per tick), it might not be fast enough to keep the player safe, potentially causing radiation to harm the player for a short time window.