Interface TestClientWorldContext


@NonExtendable public interface TestClientWorldContext
Context for a client gametest containing various helpful functions while a client world is open.

Functions in this class can only be called on the client gametest thread.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The default timeout in ticks to wait for chunks to load/render (1 minute).
  • Method Summary

    Modifier and Type
    Method
    Description
    default int
    Waits for all chunks that will be downloaded from the server to be downloaded.
    int
    waitForChunksDownload(int timeout)
    Waits for all chunks that will be downloaded from the server to be downloaded.
    default int
    Waits for all chunks to be downloaded and rendered.
    default int
    waitForChunksRender(boolean waitForDownload)
    Waits for all chunks to be rendered, optionally waiting for chunks to be downloaded first.
    int
    waitForChunksRender(boolean waitForDownload, int timeout)
    Waits for all chunks to be rendered, optionally waiting for chunks to be downloaded first.
    default int
    waitForChunksRender(int timeout)
    Waits for all chunks to be downloaded and rendered.
  • Field Details

    • DEFAULT_CHUNK_LOAD_TIMEOUT

      static final int DEFAULT_CHUNK_LOAD_TIMEOUT
      The default timeout in ticks to wait for chunks to load/render (1 minute).
      See Also:
  • Method Details

    • waitForChunksDownload

      default int waitForChunksDownload()
      Waits for all chunks that will be downloaded from the server to be downloaded. Fails if the chunks haven't been downloaded after DEFAULT_CHUNK_LOAD_TIMEOUT ticks. See waitForChunksDownload(int) for details.
      Returns:
      The number of ticks waited
    • waitForChunksDownload

      int waitForChunksDownload(int timeout)
      Waits for all chunks that will be downloaded from the server to be downloaded. After this, methods such as World.getChunk(int, int) and World.getBlockState(BlockPos) will return the expected value. However, the chunks may not yet be rendered and may not appear in screenshots, if you need this, use waitForChunksRender(int) instead. Fails if the chunks haven't been downloaded after timeout ticks.
      Parameters:
      timeout - The number of ticks before timing out
      Returns:
      The number of ticks waited
    • waitForChunksRender

      default int waitForChunksRender()
      Waits for all chunks to be downloaded and rendered. After this, all chunks that will ever be visible are visible in screenshots. Fails if the chunks haven't been downloaded and rendered after DEFAULT_CHUNK_LOAD_TIMEOUT ticks.
      Returns:
      The number of ticks waited
    • waitForChunksRender

      default int waitForChunksRender(int timeout)
      Waits for all chunks to be downloaded and rendered. After this, all chunks that will ever be visible are visible in screenshots. Fails if the chunks haven't been downloaded and rendered after timeout ticks.
      Parameters:
      timeout - The number of ticks before timing out
      Returns:
      The number of ticks waited
    • waitForChunksRender

      default int waitForChunksRender(boolean waitForDownload)
      Waits for all chunks to be rendered, optionally waiting for chunks to be downloaded first. After this, all chunks that are present in the client world will be visible in screenshots. Fails if the chunks haven't been rendered (and optionally downloaded) after DEFAULT_CHUNK_LOAD_TIMEOUT ticks.
      Parameters:
      waitForDownload - Whether to wait for chunks to be downloaded
      Returns:
      The number of ticks waited
    • waitForChunksRender

      int waitForChunksRender(boolean waitForDownload, int timeout)
      Waits for all chunks to be rendered, optionally waiting for chunks to be downloaded first. After this, all chunks that are present in the client world will be visible in screenshots. Fails if the chunks haven't been rendered (and optionally downloaded) after timeout ticks.
      Parameters:
      waitForDownload - Whether to wait for chunks to be downloaded
      timeout - The number of ticks before timing out
      Returns:
      The number of ticks waited