Back to 9Minecraft
Wiki 9Minecraft Wiki 9Minecraft
Legendreliclib Wiki › Guides › Use Delay Controllers for Timed Events in Custom Actions

Use Delay Controllers for Timed Events in Custom Actions

What Delay Controllers Do

When you need an action to happen after a specific number of ticks—like a projectile spawning mid-swing or a visual effect triggering at the peak of an animation—delay controllers manage that timing reliably.

Setting Up a Delayed Action

1. Identify your trigger point (e.g., when a player attacks with a custom weapon)

2. Create a delay controller using LegendRelicLib's delay system and specify the tick count before execution

3. Attach your action to the controller—this could be spawning particles, dealing damage, or playing a sound

4. Register the controller with your weapon or ability so it activates during gameplay

Why This Matters

Manual tick counting is error-prone and causes desync in multiplayer. The library's delay system ensures all players see the same timing, preventing situations where one player sees an effect at tick 10 while another sees it at tick 15. This is especially critical for competitive or cooperative gameplay where precision matters.