
AgeingCheckCache
This addon for the Ageing Spawner mod significantly speeds up its operation through intelligent caching of checks.
Optimization Principle
The main problem this mod solves is related to the List#contains method used to check for elements in lists. Many mod developers provide customizable blacklists and whitelists in configuration files, but with a large number of elements, constant checks through iterating the entire list can seriously slow down the game.
// Original approach with List#contains
if (blacklist.contains(entityType)) {
// performing the check
}
// Optimized approach with caching
if (((ExtendedEntityType)entityType).isInConfig()) {
// instant check
}
The solution is to perform the check only once when the game loads, save the result, and subsequently use the ready boolean value instead of repeatedly iterating through arrays. This is especially effective for EntityType, where you can create a special interface and mark all entity types at game startup.
Compatibility with Other Mods
The mod automatically excludes spawners from other modifications from Ageing Spawner processing. For example, spawners from BrassAmber BattleTowers will no longer disappear, ensuring better compatibility and not blocking tower progression.
If you need a specific modified spawner to still be processed by Ageing Spawner, you can add its registry name to the configuration file config/ageingcheckcache-common.toml.
Video Review
For a better understanding of how the mod works, we recommend watching a YouTube video demonstrating the performance difference before and after installing AgeingCheckCache.