📖 Mod Description
Ice and Fire attaches a "status data packet" to every single living entity in the game (including animals, monsters, and villagers) to track effects like frozen, chain, siren charm, and more. The problem is — the vast majority of these entities never use these features, yet they still carry around the full data packet, and the game has to look it up every single tick.
The result: high memory overhead and unnecessary performance cost.
This mod does exactly this: eliminates unnecessary memory usage and shortens the query path.
TL;DR: ~20% less memory, ~7% more performance.
⚙️ How It Works
1. Cache Query Results — No More Detours
The first time an entity needs its status data, it queries normally. After that, the result is stored directly on the entity itself. Next time, it's a direct hit — no more wandering through global registries.
2. Create Only When Needed — No Upfront Allocation
Originally, every entity immediately allocates 4 objects (chain, charm, rotten egg, misc) regardless of whether they'll ever use them. After optimization, objects are only created when actually needed. Ordinary animals/monsters/villagers will never allocate these unnecessary objects.
3. Reads Stay Reads, Writes Stay Writes
Read-only paths use a shared empty object and never generate new data. Only paths that actually modify state will create dedicated data.
4. Release on Empty State, Save Only What Matters
When states return to empty, their corresponding objects are released immediately. NBT only saves meaningful data. Fully compatible with old saves — upgrade with peace of mind.
📊 Optimization Results
Test method: Spark heapsummary, same mod pack, same seed, exploring for 5 minutes.
| Metric | Unoptimized | Optimized | Improvement |
|---|---|---|---|
| Ice and Fire related memory | 382 KB | 272 KB | -28.7% |
| Status data packet internal memory | 169 KB | 72 KB | -57.0% |
| Status data cost per entity | ~220 B | ~96 B | -56.1% |
| Total 4 lazy sub-objects | 3,080 | 17 | -99.45% |
| JVM used heap | 4.13 GiB | 3.57 GiB | ~ -478 MiB |
🕹️ 6-Hour Gameplay Comparison
Same mod pack, render distance, and entity distance. TPS stable at 20. Alternating between exploration and base activities.
| Metric | Unoptimized | Optimized | Difference |
|---|---|---|---|
| Per-tick queries | Hundreds of millions of global lookups | Direct local cache reads | Most queries eliminated |
| JVM used heap | ~6.2 GiB | ~4.9 GiB | ~ -1.3 GiB |


