Skip to main content

Module projectile

Module projectile 

Source
Expand description

Vanilla Projectile class hierarchy, mirrored as Rust traits + base structs.

Mirrors net.minecraft.world.entity.projectile: Entity โ†’ Projectile โ†’ ThrowableProjectile โ†’ ThrowableItemProjectile. Concrete projectiles embed ProjectileBase (owner / left-owner / shot state) and implement the trait stack; the per-layer tick logic chains explicitly via Projectile::projectile_base_tick and ThrowableProjectile::throwable_projectile_tick (vanilla super.tick()).

The block + entity move-vector raycast mirrors ProjectileUtil.

Modulesยง

throwable ๐Ÿ”’
Vanilla ThrowableProjectile โ€” the gravity/drag movement loop.
throwable_item ๐Ÿ”’
Vanilla ThrowableItemProjectile โ€” carries a synced rendered item stack.

Structsยง

EntityHitResult
A projectile-versus-entity raycast hit (vanilla EntityHitResult).
ProjectileBase
Runtime fields shared by vanilla projectiles (vanilla Projectile fields).
ProjectileState ๐Ÿ”’

Enumsยง

ProjectileDeflection
Vanilla projectile deflection behaviors (ProjectileDeflection).
ProjectileHit
Result of a projectile move-vector raycast (vanilla HitResult).

Constantsยง

MAX_ENTITY_HIT_MARGIN ๐Ÿ”’
Vanilla ProjectileUtil.DEFAULT_ENTITY_HIT_RESULT_MARGIN.
SHOOT_INACCURACY_SCALE ๐Ÿ”’
Vanilla Projectile.shoot per-axis spread scale (0.0172275 * uncertainty).

Traitsยง

Projectile
Vanilla-shaped behavior shared by entities that extend Projectile.
ProjectileEventSource
Object-safe access to a projectile trait object from default Projectile methods.
ThrowableItemProjectile
Vanilla-shaped behavior shared by entities that extend ThrowableItemProjectile.
ThrowableProjectile
Vanilla-shaped behavior shared by entities that extend ThrowableProjectile.

Functionsยง

axis_component ๐Ÿ”’
clip_segment ๐Ÿ”’
Clips the segment from -> to against aabb, returning the entry point.
compute_margin
Vanilla ProjectileUtil.computeMargin: ramps the entity hit margin from 0 to 0.3 over the first ticks of flight.
get_entity_hit_result ๐Ÿ”’
Vanilla ProjectileUtil.getEntityHitResult (entity-margin overload): returns the nearest entity whose inflated box the segment from -> to enters.
lerp_rotation ๐Ÿ”’
Vanilla Mth.lerp(0.2, rotO, rot) after wrapping the old angle into range.
triangle_random ๐Ÿ”’
Mirrors vanilla RandomSource.triangle(mode, deviation).