Class CompanionBlockSpawnerSystems

java.lang.Object
com.hypixel.hytale.builtin.companionblockspawner.CompanionBlockSpawnerSystems

public final class CompanionBlockSpawnerSystems extends Object
The companion block spawner's detection, claiming, and self-healing logic over CompanionBlockSpawnerBlock blocks (spawner blocks and requirement blocks):
  • CompanionBlockSpawnerSystems.AddOrRemove (event-driven fast path) reacts to participating blocks being placed/broken.
  • CompanionBlockSpawnerSystems.ReconcileTick (slow safety net, every ~30s per block) re-validates an active spawner's marker liveness and conditions, retries activation for dormant-but-satisfiable spawners, and clears stale claims whose owner is gone - healing the states events can't reach (counterpart chunk unloaded at mutation time, same-tick placement, marker self-removal, deferred-creation races).
  • CompanionBlockSpawnerSystems.MarkerHeartbeat (entity-store side) removes a marker (and its companions) whose origin spawner no longer exists or references it - the orphan-marker counterpart of the spawner-side liveness check.
Requirements are claimed exclusively: a spawner only counts requirement blocks that are unclaimed or already claimed by itself, and stamps claimedByBlock on the blocks it uses. Recipes for one spawner key are tried in order; the first satisfiable one activates and the spawner only deactivates when no recipe is satisfiable, so evaluating one recipe can never wipe another's claims.

The NPC itself is owned entirely by a SpawnMarkerEntity (created/removed via CompanionBlockSpawnerSupport); these systems only decide when a marker should exist and which requirement blocks each spawner owns.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Reacts to participating blocks being placed/broken - the event-driven fast path.
    static class 
    Entity-store counterpart of the spawner-side liveness check: a marker created by a companion spawner removes itself (and its companions) when its origin spawner block no longer exists or no longer references it - so a spawner broken while the marker's chunk was unloaded can't leave an orphaned marker respawning NPCs forever.
    static class 
    Slow per-block safety net (~every 30s, jittered) healing the states events can't reach: active spawner whose marker entity no longer resolves (self-removed after failed spawns, lost with a rolled-back chunk, removed while this chunk was unloaded) - clears the stale reference and re-evaluates; active spawner whose conditions silently broke (requirement removed while this chunk was unloaded) - deactivates; dormant spawner whose conditions are actually met (same-tick placement, earlier marker placement failure) - activates; requirement block claimed by a spawner that is gone or out of range - releases the claim. The first pass for a block runs a full interval after it loads, so the spatial index is warm.
  • Method Summary

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait