Asset System Overview
Asset System Overview
Section titled “Asset System Overview”The Asset System manages all game content including blocks, items, entities, sounds, particles, and more. Assets are defined in JSON files and can be bundled with plugins.
Package Location
Section titled “Package Location”com.hypixel.hytale.server.core.asset.type
Asset Pack Structure
Section titled “Asset Pack Structure”Asset packs follow a specific directory structure:
my-plugin.jar/├── plugin.json└── assets/ ├── blocktype/ # Block definitions ├── item/ # Item definitions ├── model/ # 3D models ├── soundevent/ # Sound events ├── soundset/ # Sound collections ├── particle/ # Particle systems ├── weather/ # Weather configurations ├── entity/ # Entity definitions ├── entityeffect/ # Status effects ├── environment/ # Environment settings ├── ambiencefx/ # Ambient effects ├── gameplay/ # Gameplay configurations └── ... other typesCore Asset Types
Section titled “Core Asset Types”Block Types (blocktype/)
Section titled “Block Types (blocktype/)”Define block behavior and properties:
{ "Id": "MyPlugin_CustomBlock", "DisplayName": "Custom Block", "Model": "MyPlugin/custom_block", "Material": "Stone", "Hardness": 2.0, "LightLevel": 0, "IsOpaque": true, "IsSolid": true, "BlockSound": "Hytale/Stone"}Key properties:
| Property | Type | Description |
|---|---|---|
Id | string | Unique block identifier |
DisplayName | string | Localized display name |
Model | string | Model asset reference |
Material | string | Material for tools/damage |
Hardness | float | Mining difficulty |
LightLevel | int | Emitted light (0-15) |
IsOpaque | bool | Blocks light completely |
IsSolid | bool | Has collision |
Items (item/)
Section titled “Items (item/)”Define items and their behavior:
{ "Id": "MyPlugin_CustomSword", "DisplayName": "Custom Sword", "Model": "MyPlugin/sword_model", "MaxStack": 1, "MaxDurability": 500, "AttackDamage": 7.0, "AttackSpeed": 1.6, "Tags": ["weapon", "sword"]}Key properties:
| Property | Type | Description |
|---|---|---|
Id | string | Unique item identifier |
DisplayName | string | Localized display name |
MaxStack | int | Maximum stack size |
MaxDurability | float | Maximum durability (0 = unbreakable) |
AttackDamage | float | Melee damage |
Tags | string[] | Item categorization tags |
Sound Events (soundevent/)
Section titled “Sound Events (soundevent/)”Define sounds that can be played:
{ "Id": "MyPlugin_CustomSound", "Sounds": [ { "Path": "sounds/custom_sound.ogg", "Volume": 1.0, "Pitch": 1.0 } ], "Category": "Master"}Particles (particle/)
Section titled “Particles (particle/)”Define particle systems:
{ "Id": "MyPlugin_CustomParticle", "Emitters": [ { "Type": "Point", "Rate": 10, "Lifetime": 1.0, "Color": "#FF0000", "Size": 0.1 } ]}Entity Effects (entityeffect/)
Section titled “Entity Effects (entityeffect/)”Define status effects for entities:
{ "Id": "MyPlugin_CustomEffect", "DisplayName": "Custom Effect", "Duration": 300, "Icon": "icons/custom_effect.png", "Effects": { "Speed": 1.5, "Health": -1.0 }}Weather (weather/)
Section titled “Weather (weather/)”Define weather configurations:
{ "Id": "MyPlugin_CustomWeather", "DisplayName": "Custom Weather", "Fog": { "Color": "#808080", "Density": 0.5 }, "Clouds": { "Enabled": true, "Density": 0.8 }, "Precipitation": "Rain"}Gameplay (gameplay/)
Section titled “Gameplay (gameplay/)”Configure gameplay mechanics:
{ "Id": "MyPlugin_GameplayConfig", "Combat": { "DamageMultiplier": 1.0, "DisplayHealthBars": true }, "Death": { "DropItems": true, "DropExperience": true }}Accessing Assets in Code
Section titled “Accessing Assets in Code”Get Asset by ID
Section titled “Get Asset by ID”// Block typesBlockType blockType = BlockType.getAssetMap().get("MyPlugin_CustomBlock");
// ItemsItem item = Item.getAssetMap().get("MyPlugin_CustomSword");
// WeatherWeather weather = Weather.getAssetMap().get("MyPlugin_CustomWeather");
// Entity effectsEntityEffect effect = EntityEffect.getAssetMap().get("MyPlugin_CustomEffect");Asset Maps
Section titled “Asset Maps”Each asset type has an AssetMap for lookups:
AssetMap<BlockType> blockTypes = BlockType.getAssetMap();
// Get by keyBlockType block = blockTypes.get("Block_Key");
// Get all keysSet<String> keys = blockTypes.keySet();
// Check existenceboolean exists = blockTypes.containsKey("Some_Block");
// Get index (for network serialization)int index = blockTypes.getIndex("Block_Key");Registering Assets
Section titled “Registering Assets”In Plugin Manifest
Section titled “In Plugin Manifest”Set IncludesAssetPack in plugin.json:
{ "Name": "MyPlugin", "IncludesAssetPack": true}Programmatic Registration
Section titled “Programmatic Registration”@Overrideprotected void setup() { // Register custom asset type handler getAssetRegistry().register(/* asset registration */);}Asset Modifiers
Section titled “Asset Modifiers”Modify existing assets at runtime:
// Get block typeBlockType stone = BlockType.getAssetMap().get("Block_Stone");
// Assets are typically immutable// Use asset overrides in your asset pack insteadAsset Pack Priority
Section titled “Asset Pack Priority”When multiple packs define the same asset, priority determines which is used:
- Core Assets: Base game assets (lowest priority)
- Plugin Assets: In order of plugin loading
- Override Packs: Explicit overrides (highest priority)
Asset Validation
Section titled “Asset Validation”Assets are validated on load:
// Assets use validatorsBuilderCodec<Item> codec = Item.CODEC;
// Validation includes:// - Required fields// - Value ranges// - Reference validity// - Type constraintsAsset Serialization
Section titled “Asset Serialization”Assets use the Codec system for serialization:
// Most assets have a CODECBuilderCodec<BlockType> blockCodec = BlockType.CODEC;BuilderCodec<Item> itemCodec = Item.CODEC;
// Serialize to BSONBsonDocument doc = codec.encode(asset, extraInfo);
// DeserializeAsset loaded = codec.decode(doc, extraInfo);Asset Hot-Reloading
Section titled “Asset Hot-Reloading”The server supports hot-reloading of assets during development:
- Assets in development packs can be reloaded
- Connected clients receive updated asset data
- Not all asset changes take effect immediately
Complete Asset Type List
Section titled “Complete Asset Type List”All 35 asset types organized by category:
Content Assets
Section titled “Content Assets”| Directory | Class | Description |
|---|---|---|
blocktype/ | BlockType | Block definitions |
blockset/ | BlockSet | Block groupings |
item/ | Item | Item definitions |
fluid/ | Fluid | Fluid types |
projectile/ | Projectile | Projectile definitions |
Visual Assets
Section titled “Visual Assets”| Directory | Class | Description |
|---|---|---|
model/ | Model | 3D models |
particle/ | Particle | Particle systems |
trail/ | Trail | Trail effects |
modelvfx/ | ModelVFX | Model visual effects |
fluidfx/ | FluidFX | Fluid visual effects |
blockbreakingdecal/ | BlockBreakingDecal | Break animation overlays |
blockhitbox/ | BlockBoundingBoxes | Block collision shapes |
blockparticle/ | BlockParticleSet | Block particle effects |
Audio Assets
Section titled “Audio Assets”| Directory | Class | Description |
|---|---|---|
soundevent/ | SoundEvent | Individual sounds |
soundset/ | SoundSet | Sound collections |
blocksound/ | BlockSoundSet | Block-specific sounds |
itemsound/ | ItemSoundSet | Item-specific sounds |
audiocategory/ | AudioCategory | Audio categories |
equalizereffect/ | EqualizerEffect | Audio equalizer effects |
reverbeffect/ | ReverbEffect | Audio reverb effects |
World Assets
Section titled “World Assets”| Directory | Class | Description |
|---|---|---|
weather/ | Weather | Weather systems |
environment/ | Environment | Environment settings |
ambiencefx/ | AmbienceFX | Ambient effects |
portalworld/ | PortalWorld | Portal world definitions |
Gameplay Assets
Section titled “Gameplay Assets”| Directory | Class | Description |
|---|---|---|
gameplay/ | GameplayConfig | Gameplay configuration |
gamemode/ | GameMode | Game mode definitions |
entityeffect/ | EntityEffect | Status effects |
attitude/ | Attitude | NPC attitudes |
camera/ | Camera | Camera configurations |
itemanimation/ | ItemAnimation | Item animations |
blocktick/ | TickProcedure | Block tick procedures |
Utility Assets
Section titled “Utility Assets”| Directory | Class | Description |
|---|---|---|
buildertool/ | BuilderTool | Builder tools |
tagpattern/ | TagPattern | Tag matching patterns |
responsecurve/ | ResponseCurve | Mathematical curves |
wordlist/ | WordList | Word lists for generation |
Best Practices
Section titled “Best Practices”- Use unique prefixes: Prefix asset IDs with your plugin name
- Validate references: Ensure referenced assets exist
- Provide defaults: Include sensible default values
- Document assets: Comment complex configurations
- Test combinations: Verify assets work together
- Consider performance: Avoid overly complex particle systems
Related
Section titled “Related”- Block Types - Detailed block documentation
- Items - Detailed item documentation
- Sounds - Audio system
- Particles - Particle system