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
Modifier and TypeFieldDescriptionstatic final int
The default timeout in ticks to wait for chunks to load/render (1 minute). -
Method Summary
Modifier and TypeMethodDescriptiondefault 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_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_TIMEOUT
ticks. 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 aftertimeout
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 afterDEFAULT_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 aftertimeout
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) afterDEFAULT_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) aftertimeout
ticks.- Parameters:
waitForDownload
- Whether to wait for chunks to be downloadedtimeout
- The number of ticks before timing out- Returns:
- The number of ticks waited
-