93 lines
2.8 KiB
Markdown
93 lines
2.8 KiB
Markdown
---
|
|
title: Effects
|
|
type: docs
|
|
weight: 10
|
|
---
|
|
|
|
Visual effects in Hytale include particles, dynamic lights, and entity status effects.
|
|
|
|
{{< cards >}}
|
|
{{< card link="particles" title="Particles" subtitle="Spawn and configure particle systems" >}}
|
|
{{< card link="dynamic-lights" title="Dynamic Lights" subtitle="Glow effects on entities" >}}
|
|
{{< card link="entity-effects" title="Entity Effects" subtitle="Status effects with visuals" >}}
|
|
{{< /cards >}}
|
|
|
|
## Overview
|
|
|
|
Hytale provides three complementary visual effect systems:
|
|
|
|
| System | Purpose | Use Cases |
|
|
|--------|---------|-----------|
|
|
| **Particles** | Visual atmosphere and feedback | Explosions, trails, ambient effects |
|
|
| **Dynamic Lights** | Glow effects on entities | Glowing items, magic auras |
|
|
| **Entity Effects** | Status effects with visuals | Buffs, debuffs, status indicators |
|
|
|
|
## Quick Start
|
|
|
|
### Spawning Particles
|
|
|
|
```java
|
|
import com.hypixel.hytale.server.core.universe.world.ParticleUtil;
|
|
|
|
// Spawn particles at a position
|
|
ParticleUtil.spawnParticleEffect(
|
|
"explosion_small", // Particle system ID
|
|
position, // Vector3d position
|
|
componentAccessor
|
|
);
|
|
```
|
|
|
|
### Adding Dynamic Light
|
|
|
|
```java
|
|
import com.hypixel.hytale.protocol.ColorLight;
|
|
import com.hypixel.hytale.server.core.modules.entity.component.DynamicLight;
|
|
|
|
// Create a colored light (radius, R, G, B)
|
|
ColorLight light = new ColorLight(
|
|
(byte) 15, // Radius
|
|
(byte) 255, // Red
|
|
(byte) 100, // Green
|
|
(byte) 50 // Blue
|
|
);
|
|
|
|
// Add to entity
|
|
DynamicLight dynamicLight = new DynamicLight(light);
|
|
componentAccessor.putComponent(entityRef, DynamicLight.getComponentType(), dynamicLight);
|
|
```
|
|
|
|
### Applying Entity Effects
|
|
|
|
```java
|
|
import com.hypixel.hytale.server.core.entity.effect.EffectControllerComponent;
|
|
|
|
// Get effect controller
|
|
EffectControllerComponent controller = store.getComponent(
|
|
entityRef,
|
|
EffectControllerComponent.getComponentType()
|
|
);
|
|
|
|
// Apply effect
|
|
EntityEffect effect = EntityEffect.getAssetMap().getAsset("fire_resistance");
|
|
controller.addEffect(entityRef, effect, componentAccessor);
|
|
```
|
|
|
|
## Key Classes
|
|
|
|
| Class | Package | Purpose |
|
|
|-------|---------|---------|
|
|
| `ParticleUtil` | server.core.universe.world | Spawn particles |
|
|
| `ParticleSystem` | asset.type.particle.config | System configuration |
|
|
| `DynamicLight` | modules.entity.component | Entity glow effects |
|
|
| `ColorLight` | protocol | Light color/radius data |
|
|
| `EntityEffect` | asset.type.entityeffect.config | Status effect definition |
|
|
|
|
## Network Considerations
|
|
|
|
{{< callout type="info" >}}
|
|
**Network Details:**
|
|
- Particles are sent within 75 blocks by default (`DEFAULT_PARTICLE_DISTANCE`)
|
|
- DynamicLight changes sync automatically when marked as outdated
|
|
- Entity effects sync via `EffectControllerComponent`
|
|
{{< /callout >}}
|