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).
ViewVectorHitResult
Result of vanilla ProjectileUtil.getHitResultOnViewVector.

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).
THROWN_ITEM_SPAWN_EYE_OFFSET πŸ”’
Vanilla ThrowableItemProjectile spawn offset below the shooter’s eye.

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.
get_hit_result_on_view_vector
Vanilla ProjectileUtil.getHitResultOnViewVector.
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
Mirrors vanilla RandomSource.triangle(mode, deviation).