Package com.hypixel.hytale.builtin.companionblockspawner


package com.hypixel.hytale.builtin.companionblockspawner
  • Classes
    Class
    Description
    A block-entity marker placed (via the block type's BlockEntity config) on every block that participates in a CompanionBlockSpawnerRecipe - both spawner blocks and requirement blocks.
    Companion block spawners: recipe-driven spawner blocks that keep a companion NPC alive (via a spawn marker) while their required surrounding blocks - matched by exact type or tag, claimed exclusively - are present within a radius.
    A runtime lookup table built from all loaded CompanionBlockSpawnerRecipe assets.
    Indexes all CompanionBlockSpawnerBlock blocks (spawner blocks and requirements) in a KDTree spatial resource by their world position, so the companion block spawner systems can find participating blocks near a placed/broken block.
    Creates and removes the spawn marker that owns a companion NPC for a CompanionBlockSpawnerRecipe.
    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.
    Reacts to participating blocks being placed/broken - the event-driven fast path.
    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.
    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.
    A back-reference placed on the spawn marker created by a CompanionBlockSpawnerBlock, pointing at the world position of the owning spawner block.