Claude/farm zone management system m t hw3#26
Merged
Conversation
Leaves and cobwebs have no collision box (isPassable() = true) but are visually opaque. Mobs spawned at those Y positions appeared stuck inside blocks. isPassable() now explicitly rejects them so findSafeLocation() only picks positions with truly clear air for feet and head. https://claude.ai/code/session_01QRahgKn43HbgkmDkQZCq9Z
Persistence: entity.setPersistent(true) is called immediately after each MythicMobs spawn, preventing Minecraft from auto-despawning zone mobs regardless of player proximity or chunk load state. Containment: every scheduler tick, all loaded tracked mobs are checked against their region via region.contains(). Any mob that has wandered outside is teleported to a random safe position inside the region. Unloaded mobs are skipped (they cannot have moved while unloaded). zoneRegions (Map<String, ProtectedRegion>) is kept in sync with the cache each tick so containment lookups need no cache re-query. https://claude.ai/code/session_01QRahgKn43HbgkmDkQZCq9Z
1. findSafeLocation: use world.getHighestBlockYAt(MOTION_BLOCKING_NO_LEAVES) to start the Y-scan at the actual terrain surface instead of max.y()-1, eliminating scans through hundreds of empty air blocks in tall regions. 2. checkContainment: run every 4 scheduler fires (~4 s) instead of every tick, reducing getEntity() UUID lookups by 4x at no meaningful cost to containment responsiveness (mobs move ~8 blocks max between checks). 3. Escape teleport caching: containment teleports reuse the zone's last known safe spawn location instead of calling findSafeLocation() again for every escaping mob in the same cycle. Refreshed on each spawn. 4. zoneRegions lazy registration: replace put() every tick with computeIfAbsent() — only writes when the key is first seen, eliminating redundant HashMap puts on every scheduler fire. 5. Remove countMobsInRegion() dead code: the method was never called since UUID tracking replaced spatial entity queries. Removed from MythicAdapter interface, MythicV5Adapter, and MythicNoopAdapter along with all now-unused imports (BlockVector3, World, Entity, Collection, Set). 6. Minor: remove unused `spawned` counter variable from spawnBatch(). https://claude.ai/code/session_01QRahgKn43HbgkmDkQZCq9Z
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.