Block System Overview
Block System Overview
Section titled “Block System Overview”The Block System manages all block types, block components, 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 |
| BlockModule | com.hypixel.hytale.server.core.modules.block.BlockModule |
| BlockEntity | com.hypixel.hytale.server.core.modules.block.BlockEntity |
| BlockReplaceEvent | com.hypixel.hytale.server.core.modules.block.BlockReplaceEvent |
| 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 |
Component<ChunkStore> | Per-block instance data for stateful blocks |
BlockEntity | Utility for setting block entities on chunks |
BlockReplaceEvent | ECS event for block entity replacement |
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 Components Per-block instance data using Component
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”getEntityStoreRegistry().registerSystem( new MyBreakBlockSystem());See Block Events for full examples using EntityEventSystem.
Best Practices
Section titled “Best Practices”- Use groups: Organize related blocks with the
Groupproperty - Use block components sparingly: Only use
Component<ChunkStore>when truly needed for persistent data - 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