ProjectileTestAdapter provides direct classpath checks, while ProjectileAssert wraps them as failing assertions.
Projectile testing is important when your mod creates custom projectiles (arrows, spells, thrown items) or modifies projectile behavior. The first step is always verifying that the projectile module itself is available, since it may not be present in all server configurations.
Complete Example Suite
Adapter Methods
| Method | Returns | Description |
|---|---|---|
projectileModuleExists() | boolean | Check if the ProjectileModule class is on the classpath |
getProjectileModule() | Object | Get the ProjectileModule singleton instance (returns null if unavailable) |
Assertion Methods
| Method | Failure Message |
|---|---|
assertProjectileModuleAvailable() | ”Expected ProjectileModule to be available on the classpath but it was not found” |
When to Test Projectiles
Projectile surface tests are primarily classpath availability checks. Use them as:- Precondition guards - Run these before any test that creates or inspects projectiles
- Smoke tests - Verify that the server build includes the projectile module
- Build validation - Catch missing dependencies in your mod’s build pipeline
Hytale Projectile System API
The Hytale server exposes a rich projectile system beyond what HRTK currently wraps:ProjectileModule- The core plugin. Hasget()singleton andspawnProjectile(UUID owner, Vector3d position, Vector3d velocity)for creating projectiles programmatically.ProjectileConfig(asset) - Defines projectile properties. HasgetPhysicsConfig(),getLaunchForce(),getMuzzleVelocity(),getGravity(),getModel().StandardPhysicsConfig- Physics settings for projectiles. HasgetGravity(),getBounciness(),getBounceCount(),getBounceLimit(),isSticksVertically().ImpactConsumer(interface) - Callback when a projectile hits something:onImpact(projectileRef, position, hitEntityRef, hitType, commandBuffer).BounceConsumer(interface) - Callback when a projectile bounces:onBounce(projectileRef, position, commandBuffer).
Next Steps
- Physics - test projectile velocity and trajectory
- Stats & Combat - test projectile damage
- ECS Testing - inspect projectile entity components