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
FieldsModifier and TypeFieldDescriptionstatic final intThe default timeout in ticks to wait for chunks to load/render (1 minute). -
Method Summary
Modifier and TypeMethodDescriptiondefault intWaits for all chunks that will be downloaded from the server to be downloaded.intwaitForChunksDownload(int timeout) Waits for all chunks that will be downloaded from the server to be downloaded.default intWaits for all chunks to be downloaded and rendered.default intwaitForChunksRender(boolean waitForDownload) Waits for all chunks to be rendered, optionally waiting for chunks to be downloaded first.intwaitForChunksRender(boolean waitForDownload, int timeout) Waits for all chunks to be rendered, optionally waiting for chunks to be downloaded first.default intwaitForChunksRender(int timeout) Waits for all chunks to be downloaded and rendered.
-
Field Details
-
DEFAULT_CHUNK_LOAD_TIMEOUT
static final int DEFAULT_CHUNK_LOAD_TIMEOUTThe 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 afterDEFAULT_CHUNK_LOAD_TIMEOUTticks. SeewaitForChunksDownload(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 asWorld.getChunk(int, int)andWorld.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, usewaitForChunksRender(int)instead. Fails if the chunks haven't been downloaded aftertimeoutticks.- 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 afterDEFAULT_CHUNK_LOAD_TIMEOUTticks.- 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 aftertimeoutticks.- 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) afterDEFAULT_CHUNK_LOAD_TIMEOUTticks.- 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) aftertimeoutticks.- Parameters:
waitForDownload- Whether to wait for chunks to be downloadedtimeout- The number of ticks before timing out- Returns:
- The number of ticks waited
-