Description
EntityTracker maintains a blacklist (entityBlacklist) for entities/items that are unreachable or despawned. This blacklist has NO cleanup mechanism — entries are added but never removed when entities despawn or the player moves to a different area.
Root Cause
In EntityTracker:
// entityBlacklist.unreachable(entity) is used to skip entities
// but entries are never cleaned up after entity despawns
This leads to:
- Memory leak: Over long play sessions, the blacklist accumulates thousands of stale entries
- False negatives: Items that become reachable again (e.g. after moving closer) remain blacklisted
- Performance degradation: Every entity lookup iterates through the growing blacklist
Expected Behavior
Blacklist entries should be periodically cleaned up, and entries should expire on:
- Entity despawn
- Player moving to a different dimension
- Distance exceeding a threshold
- Time-based expiration (e.g. 60 seconds)
Suggested Fix
- Add a timestamp to each blacklist entry
- Clean up entries older than e.g. 60 seconds
- Clean up entries for entities that no longer exist in the world
- Cap the maximum blacklist size
Related
src/main/java/adris/altoclef/trackers/EntityTracker.java
entityBlacklist field
Description
EntityTrackermaintains a blacklist (entityBlacklist) for entities/items that are unreachable or despawned. This blacklist has NO cleanup mechanism — entries are added but never removed when entities despawn or the player moves to a different area.Root Cause
In
EntityTracker:This leads to:
Expected Behavior
Blacklist entries should be periodically cleaned up, and entries should expire on:
Suggested Fix
Related
src/main/java/adris/altoclef/trackers/EntityTracker.javaentityBlacklistfield