Class CompanionBlockSpawnerBlock

java.lang.Object
com.hypixel.hytale.builtin.companionblockspawner.CompanionBlockSpawnerBlock
All Implemented Interfaces:
Component<ChunkStore>, Cloneable

public class CompanionBlockSpawnerBlock extends Object implements Component<ChunkStore>
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. Indexed in a KDTree spatial resource so the companion block spawner systems can find participating blocks near a placed/broken block.

Two role-specific pieces of state live here (each only meaningful for one role):

  • markerRef (spawner blocks) - the spawn marker the spawner currently owns while active. The marker handles the companion NPC (spawn, respawn on death, despawn, reload re-linking); removing it despawns the companion.
  • claimedByBlock (requirement blocks) - the world position of the spawner block that has exclusively claimed this requirement. A requirement may be claimed by at most one spawner, so spawners can't share it.
  • Field Details

  • Constructor Details

    • CompanionBlockSpawnerBlock

      public CompanionBlockSpawnerBlock()
  • Method Details

    • getComponentType

      public static ComponentType<ChunkStore, CompanionBlockSpawnerBlock> getComponentType()
    • getMarkerRef

      @Nullable public PersistentRef getMarkerRef()
    • setMarkerRef

      public void setMarkerRef(@Nullable PersistentRef markerRef)
    • hasMarker

      public boolean hasMarker()
    • getClaimedByBlock

      @Nullable public org.joml.Vector3i getClaimedByBlock()
    • setClaimedByBlock

      public void setClaimedByBlock(@Nullable org.joml.Vector3i claimedByBlock)
    • tickReconcileCountdown

      public boolean tickReconcileCountdown(float dt)
      Ticks the reconcile countdown; returns true when a reconcile pass is due. The caller is expected to resetReconcileCountdown() afterwards.
    • resetReconcileCountdown

      public void resetReconcileCountdown()
      Resets the countdown to the reconcile interval with jitter, spreading reconciles across blocks so they don't all run on the same tick.
    • clone

      @Nullable public Component<ChunkStore> clone()
      Specified by:
      clone in interface Component<ChunkStore>
      Returns:
      a clone instance of the original component instance.