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.
thrown_potion 🔒
Shared impact and water interaction logic for thrown potions

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).
ViewVectorHitResult
Outcome of casting a projectile-style ray along an entity’s view vector.

Constants§

MAX_ENTITY_HIT_MARGIN 🔒
SHOOT_INACCURACY_SCALE 🔒
Vanilla Projectile.shoot per-axis spread scale (0.0172275 * uncertainty).
SPLASH_HORIZONTAL_REACH
How far the splash search box extends past the potion’s box on the X and Z axes.
SPLASH_RANGE_SQ
Squared distance within which a splash reaches an entity.
SPLASH_VERTICAL_REACH
How far the splash search box extends past the potion’s box on the Y axis.
THROWN_ITEM_SPAWN_EYE_OFFSET 🔒
Vanilla ThrowableItemProjectile spawn offset below the shooter’s eye.

Traits§

AbstractThrownPotion
Shared behavior for splash and lingering potion projectiles
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.
get_hit_result_on_view_vector
Casts from the source eye along the look vector for distance blocks using collider shapes, then prefers a matching entity hit over the block hit.
lerp_rotation 🔒
Vanilla Mth.lerp(0.2, rotO, rot) after wrapping the old angle into range.
spawn_throwable_item_projectile
Spawns a throwable-item projectile from the source’s eye along its look direction and registers it in the world.
triangle_random
Returns a triangle-distributed random value.