Block System Overview
Block System Overview
Section titled “Block System Overview”The Block System manages all block types, block states, and block-related operations in Hytale. Blocks are the fundamental building units of the world.
Package Locations
Section titled “Package Locations”| Component | Package |
|---|---|
| BlockType | com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType |
| BlockState | com.hypixel.hytale.server.core.universe.world.meta.BlockState |
| BlockStateRegistry | com.hypixel.hytale.server.core.universe.world.meta.BlockStateRegistry |
| TickProcedure | com.hypixel.hytale.server.core.asset.type.blocktick.config.TickProcedure |
Core Components
Section titled “Core Components”| Component | Description |
|---|---|
BlockType | Asset definition for block behavior and appearance |
BlockState | Per-block instance data for stateful blocks (deprecated) |
BlockStateRegistry | Registration of custom block state types |
TickProcedure | Block tick behavior (growth, decay, etc.) |
Sub-Pages
Section titled “Sub-Pages” Block Types BlockType assets, properties, enums, and how to access/set blocks
Block States Per-block instance data and custom state registration (deprecated API)
Block Events React to block breaks, placements, mining, and interactions
Block Physics Support system, requirements, and physical behavior
Block Ticking Time-based behavior like growth and decay
Quick Reference
Section titled “Quick Reference”Getting Blocks
Section titled “Getting Blocks”// Get by IDBlockType stone = BlockType.getAssetMap().get("Rock_Stone");
// Get from world positionWorld world = Universe.get().getDefaultWorld();BlockType type = world.getBlockType(x, y, z);
// Get block ID (numeric)int blockId = world.getBlock(x, y, z);
// Special block referencesBlockType.EMPTY // Air blockBlockType.UNKNOWN // Unknown block placeholderSetting Blocks
Section titled “Setting Blocks”// Simple setworld.setBlock(x, y, z, blockType);
// With settingsSetBlockSettings settings = new SetBlockSettings();settings.setNotifyNeighbors(true);settings.setUpdateLighting(true);settings.setTriggerBlockUpdate(true);world.setBlock(x, y, z, blockType, settings);Handling Events
Section titled “Handling Events”getEventRegistry().register(BreakBlockEvent.class, event -> { BlockType blockType = event.getBlockType(); Vector3i position = event.getPosition();
// Cancel to prevent breaking event.setCancelled(true);});
getEventRegistry().register(PlaceBlockEvent.class, event -> { BlockType blockType = event.getBlockType(); // Handle placement});Best Practices
Section titled “Best Practices”- Use groups: Organize related blocks with the
Groupproperty - Minimize states: Only use block states when truly needed
- Optimize hitboxes: Use appropriate hitbox complexity
- Consider support: Define support requirements for physics
- Batch updates: Group block changes when possible
- Check loaded: Verify chunks are loaded before block access
Related
Section titled “Related”- Asset System - Asset loading
- Block Types (Assets) - Block asset creation
- World System - World and chunks
- Events - Event handling basics