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Β§
- 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 - Result of vanilla
ProjectileUtil.getHitResultOnViewVector.
ConstantsΒ§
- MAX_
ENTITY_ πHIT_ MARGIN - Vanilla
ProjectileUtil.DEFAULT_ENTITY_HIT_RESULT_MARGIN. - SHOOT_
INACCURACY_ πSCALE - Vanilla
Projectile.shootper-axis spread scale (0.0172275 * uncertainty). - THROWN_
ITEM_ πSPAWN_ EYE_ OFFSET - Vanilla
ThrowableItemProjectilespawn offset below the shooterβs eye.
TraitsΒ§
- 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 - 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).