Skip to main content
The Blocks surface provides operations for placing, reading, and asserting on blocks in the world. 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

MethodParametersReturnsDescription
setBlockint x, int y, int z, String typeIdvoidPlace a block at the given coordinates
getBlockint x, int y, int zStringGet the block type ID at coordinates
fillRegionint x1, int y1, int z1, int x2, int y2, int z2, String typeIdvoidFill a cuboid region with the specified block type
getBlockMaterialObject blockTypeStringGet the material name of a block type
getBlockStateObject blockTypeStringGet the default state key of a block type
isBlockTriggerObject blockTypebooleanCheck if a block type is a trigger block

Assertion Methods

MethodParametersFailure Message
assertBlockMaterialObject blockType, String expected”Expected block material [expected] but was [actual]“
assertBlockIsTriggerObject blockType”Expected block to be a trigger but isTrigger() returned false”
assertBlockStateObject blockType, String expected”Expected block default state [expected] but was [actual]“
assertBlockGroupObject blockType, String groupName”Expected block group [groupName] but was [actual]“

BlockAssert vs WorldAssert

Use WorldAssert.assertBlockAt() for simple type-ID checks (is this block stone?). Use BlockAssert when you need material-level, state-level, or group-level detail.
Pair block tests with IsolationStrategy.DEDICATED_WORLD so block changes do not affect the live server. The dedicated world starts as a void world, giving you a clean slate for every suite.

Next Steps

  • World Testing - entity spawning and positioning
  • Items - test item stacks and durability
  • Physics - test entity movement on blocks