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§
- Entity
HitResult - A projectile-versus-entity raycast hit (vanilla
EntityHitResult). - Projectile
Base - Runtime fields shared by vanilla projectiles (vanilla
Projectilefields). - Projectile
State 🔒
Enums§
- Projectile
Deflection - Vanilla projectile deflection behaviors (
ProjectileDeflection). - Projectile
Hit - Result of a projectile move-vector raycast (vanilla
HitResult). - View
Vector HitResult - Outcome of casting a projectile-style ray along an entity’s view vector.
Constants§
- MAX_
ENTITY_ 🔒HIT_ MARGIN - SHOOT_
INACCURACY_ 🔒SCALE - Vanilla
Projectile.shootper-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
ThrowableItemProjectilespawn offset below the shooter’s eye.
Traits§
- Abstract
Thrown Potion - Shared behavior for splash and lingering potion projectiles
- Projectile
- Vanilla-shaped behavior shared by entities that extend
Projectile. - Projectile
Event Source - Object-safe access to a projectile trait object from default
Projectilemethods. - Throwable
Item Projectile - Vanilla-shaped behavior shared by entities that extend
ThrowableItemProjectile. - Throwable
Projectile - Vanilla-shaped behavior shared by entities that extend
ThrowableProjectile.
Functions§
- axis_
component 🔒 - clip_
segment 🔒 - Clips the segment
from -> toagainstaabb, 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 segmentfrom -> toenters. - get_
hit_ result_ on_ view_ vector - Casts from the source eye along the look vector for
distanceblocks 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.