Class EnvironmentRunCursor

java.lang.Object
com.hypixel.hytale.server.spawning.util.EnvironmentRunCursor

public final class EnvironmentRunCursor extends Object
Walks the environment runs of one block column in the legacy section band (section y 0 to ChunkUtil.HEIGHT_SECTIONS - 1), bottom to top, in world y coordinates.

resolve(ChunkStore, int, int) captures the sections that are loaded at that moment. It never loads a section. The walk skips sections that were not loaded, and a run continues across them when the loaded sections on both sides hold the same environment. A run can therefore cover blocks of an unloaded section, so callers must still check that a section is ticking before they spawn into it.

Resolve again on each tick, because sections can load or unload between ticks. A repeated resolve of the same column only looks up the sections that were absent or have unloaded. clear() drops every captured section.

  • Constructor Details

    • EnvironmentRunCursor

      public EnvironmentRunCursor()
  • Method Details

    • resolve

      public void resolve(@Nonnull ChunkStore chunkStore, int chunkX, int chunkZ)
      Captures the loaded environment sections of the chunk column at the given chunk coordinates.
    • clear

      public void clear()
    • bind

      public void bind(int x, int z)
      Starts the walk of the block column at the given chunk-local coordinates. Call next() until it returns false.
    • next

      public boolean next()
      Advances to the next run.
      Returns:
      false once the column is exhausted
    • getMinY

      public int getMinY()
      Returns:
      inclusive world y bottom of the current run
    • getMaxY

      public int getMaxY()
      Returns:
      inclusive world y top of the current run
    • getEnvironmentId

      public int getEnvironmentId()
      Returns:
      runtime environment id of the current run