Goety Client Fix Fixes client-side memory leaks caused by Goety mods for Minecraft 1.20.1 (Forge).
Problem When a player dies/respawns or changes dimension, the old LocalPlayer and ClientLevel instances are not garbage collected. Memory grows with each death, eventually causing lag and crashes.
How it works Tracks Minecraft.player reference each tick. When the instance changes (respawn, dimension change), the mod:
Invalidates old player and level capabilities to break reference chains Clears Mob.target and LivingEntity.lastHurtByMob references to the old player Clears static Entity/Player/Level fields in Goety/GoetyAwaken client event handlers via reflection Runs periodic cleanup every 30 seconds as a safety net Requirements Forge 47+ (Minecraft 1.20.1) Client-side only
All Versions
+ Add Version## 1.11.0
- Changed periodic Summoned cleanup to write the
priorityTargetfield directly instead of callingsetPriorityTarget(), avoiding the Goety setter chain that perturbed AI target state every cleanup cycle. - Replaced
entrySet().removeIf(...)with snapshot-based removal in static map cleanup to eliminate ConcurrentModificationException risk. - Made reflection initialization flags volatile.
- Added
require = 0to theProjectile.onHitinjection so a conflicting mod can no longer break mod loading. - Added debug logging when a TrackingFireball is discarded during entity tick.
- Kept the getter/setter fallback for older Goety builds where the field cannot be located.
v1.7.0
Fixed MixinTrackingFireball not actually injecting — used SRG method name m_5790_ with remap=false to match GoetyAwaken's bytecode directly
v1.6.0
Added MixinTrackingFireball to prevent GoetyAwaken TrackingFireball.onHitEntity ClassCastException crash when a fireball hits a non-LivingEntity (e.g. another projectile)
v1.5.0
Replaced all direct Summoned class references with reflection — now compatible with Goety 2.5.3x through 2.5.5x
getPriorityTarget/setPriorityTarget methods are silently skipped on older Goety versions that lack them
v1.4.0
Wrapped all code paths in try-catch to prevent crashes from unexpected state
Added package name filter to clearCasterField (only processes goety_cataclysm entities)
Cached Field lookups per class in ConcurrentHashMap to avoid repeated reflection
Removed unused imports, downgraded optional-mod warnings to INFO level
v1.3.0
Initial release with ApostleTeleportMixin (prevents cross-dimension teleport crash) and PlayerLeakFixer (fixes ServerPlayer memory leaks from Summoned entities)