The Blocks surface provides operations for placing, reading, and asserting on blocks in the world.Documentation Index
Fetch the complete documentation index at: https://docs.hrtk.frotty27.com/llms.txt
Use this file to discover all available pages before exploring further.
BlockTestAdapter handles block manipulation, while BlockAssert offers targeted checks for material, state, group, and trigger properties.
Blocks are the building material of Hytale worlds. Every surface, structure, and terrain feature is made of block types. If your mod adds custom blocks, modifies block behavior, or builds structures programmatically, you need tests to verify that blocks have the correct material properties, belong to the right groups, and respond to triggers as expected.
Block type IDs use the asset name without a namespace prefix (e.g.,
Soil_Dirt not hytale:dirt). The exact block names available depend on the game version and installed content packs. Use BlockTestAdapter.blockTypeExists(id) to check if a block type is available before testing with it.Block Type Asset System
Blocks in Hytale are defined as assets identified by their asset name (like"Rock_Sandstone" or "Soil_Dirt"). Each block type has properties defined in its asset file:
- Material - The physical material type (stone, wood, dirt, etc.) which affects tool interactions, sounds, and particle effects
- State - Block state variants (default, powered, open, etc.) that change behavior without changing the block type
- Group - Logical groups the block belongs to (ores, transparent, vegetation, etc.) used for batch queries
- Trigger - Whether the block acts as a trigger block for game logic (pressure plates, tripwires, etc.)
BlockAssert lets you verify all of these properties in your tests.
Complete Example Suite
Adapter Methods
| Method | Parameters | Returns | Description |
|---|---|---|---|
setBlock | int x, int y, int z, String typeId | void | Place a block at the given coordinates |
getBlock | int x, int y, int z | String | Get the block type ID at coordinates |
fillRegion | int x1, int y1, int z1, int x2, int y2, int z2, String typeId | void | Fill a cuboid region with the specified block type |
getBlockMaterial | Object blockType | String | Get the material name of a block type |
getBlockState | Object blockType | String | Get the default state key of a block type |
isBlockTrigger | Object blockType | boolean | Check if a block type is a trigger block |
Assertion Methods
| Method | Parameters | Failure Message |
|---|---|---|
assertBlockMaterial | Object blockType, String expected | ”Expected block material [expected] but was [actual]“ |
assertBlockIsTrigger | Object blockType | ”Expected block to be a trigger but isTrigger() returned false” |
assertBlockState | Object blockType, String expected | ”Expected block default state [expected] but was [actual]“ |
assertBlockGroup | Object blockType, String groupName | ”Expected block group [groupName] but was [actual]“ |
BlockAssert vs WorldAssert
UseWorldAssert.assertBlockAt() for simple type-ID checks (is this block stone?). Use BlockAssert when you need material-level, state-level, or group-level detail.
Next Steps
- World Testing - entity spawning and positioning
- Items - test item stacks and durability
- Physics - test entity movement on blocks