Skip to content

Block API

Blocks are accessed through World, WorldChunk, or the BlockAccessor interface. See Chunks for chunk access and indexing.

// get block ID at position
int blockId = world.getBlock(x, y, z);
// get BlockType (asset)
BlockType blockType = world.getBlockType(x, y, z);
// get block from chunk (local coordinates)
WorldChunk chunk = world.getChunk(chunkIndex);
int blockId = chunk.getBlock(x, y, z);
// simple block placement (via World)
world.setBlock(x, y, z, "hytale:stone");
// with settings flags
world.setBlock(x, y, z, "hytale:stone", settings);
// via chunk with BlockType (full control: id, rotation, filler, settings)
WorldChunk chunk = world.getChunk(ChunkUtil.indexChunkFromBlock(x, z));
chunk.setBlock(x, y, z, blockId, blockType, rotationIndex, filler, settings);

Combine flags with bitwise OR (|):

FlagValueEffect
NO_NOTIFY1Skip neighbor notifications
NO_UPDATE_STATE2Don’t update block state
NO_SEND_PARTICLES4Skip particle effects
NO_SET_FILLER8Skip filler block logic
NO_BREAK_FILLER16Don’t break filler blocks
PHYSICS32Enable physics
FORCE_CHANGED64Force change notification
NO_UPDATE_NEIGHBOR_CONNECTIONS128Skip neighbor connection updates
PERFORM_BLOCK_UPDATE256Trigger block update event
NO_UPDATE_HEIGHTMAP512Skip heightmap recalculation
NO_SEND_AUDIO1024Skip block sounds
NO_DROP_ITEMS2048Don’t drop items when breaking

For bulk operations, combine flags to minimize updates:

int bulkFlags = SetBlockSettings.NO_NOTIFY
| SetBlockSettings.NO_SEND_PARTICLES
| SetBlockSettings.NO_SEND_AUDIO;

See Bulk Operations for large-scale editing patterns.

// break block at position (settings = 0 for defaults)
world.breakBlock(x, y, z, 0);
// with custom settings
world.breakBlock(x, y, z, settings);

When a player breaks a block, BreakBlockEvent fires as an ECS event. In adventure mode, DamageBlockEvent fires on each hit first — BreakBlockEvent only fires when the block’s health reaches zero. In creative mode, BreakBlockEvent fires immediately with no damage phase.

// test if block can be placed
boolean canPlace = chunk.testPlaceBlock(x, y, z, blockType, rotationIndex);
// place with validation
boolean placed = chunk.placeBlock(x, y, z, "hytale:chair",
Rotation.DEG_0, Rotation.DEG_0, Rotation.DEG_0, settings);

When a player places a block, PlaceBlockEvent fires as a cancellable ECS event. When a player uses a block (e.g. opening a door), UseBlockEvent fires with Pre and Post phases.


Package: com.hypixel.hytale.server.core.asset.type.blocktype.config

Block type definitions loaded from JSON assets.

// get asset map
BlockTypeAssetMap<String, BlockType> assetMap = BlockType.getAssetMap();
// get by string ID
BlockType stone = assetMap.getAsset("hytale:stone");
// get by numeric index
BlockType blockType = assetMap.getAsset(blockId);
// get numeric index from string ID
int index = assetMap.getIndex("hytale:stone");
MethodReturn TypeDescription
getId()StringAsset ID (e.g., "hytale:stone")
getGroup()StringBlock group for categorization
getMaterial()BlockMaterialPhysical material type
getOpacity()OpacityLight blocking behavior
getDrawType()DrawTypeRendering style (Empty, Cube, Model, CubeWithModel, GizmoCube)
getParticleColor()ColorBlock color used for map rendering and particles
getLight()ColorLightLight emission for emissive blocks
getTextures()BlockTypeTextures[]Per-face texture paths
getCustomModel()StringCustom model path for Model/CubeWithModel draw types
getHitboxTypeIndex()intIndex into hitbox asset map
hasSupport()booleanWhether block uses physics support
isUnknown()booleanTrue for missing/invalid blocks
// empty block (air)
BlockType.EMPTY
// check if empty
if (blockType == BlockType.EMPTY || blockType.getMaterial() == BlockMaterial.Empty) {
// air or passable
}