Contents
Class GroundFollowProjectile
java.lang.Object
com.hypixel.hytale.server.core.modules.projectile.component.GroundFollowProjectile
- All Implemented Interfaces:
Component<EntityStore>, Cloneable
Makes a projectile follow the terrain surface instead of colliding with it: each tick
its foot snaps to the ground ahead, climbing steps up to
maxClimb blocks and
dropping ledges up to maxDrop blocks. A taller wall or a deeper cliff ends the
projectile's course (the miss chain runs there). Solidity is tested at block granularity
(a slab or filler counts as a full block), the same approximation the NPC spawn probes
use.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intReturned byfindGroundAhead(World, int, int, int)when no surface within the climb and drop allowances exists at the probed column.Fields inherited from interface Component
EMPTY_ARRAY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()booleanConsumes the one-time spawn snap.intfindGroundAhead(World world, int blockX, int footBlockY, int blockZ) Finds the foot Y the projectile lands on in the given column, scanning down from the highest allowed step to the deepest allowed drop.static intfindGroundBelow(World world, int blockX, int footBlockY, int blockZ, int drop) Finds the ground at or below the given foot, dropping up to the given allowance.voidsetSpawnSnap(int blocks) Arms the one-time spawn snap: on its first move the projectile drops up to this many blocks onto the ground.intsnapToGroundAtSpawn(World world, int blockX, int footBlockY, int blockZ) Finds the foot Y for the one-time spawn snap: the ground at or below the spawn point, dropping up to the armed snap distance.Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Component
cloneSerializable
-
Field Details
-
BLOCKED
public static final int BLOCKEDReturned byfindGroundAhead(World, int, int, int)when no surface within the climb and drop allowances exists at the probed column.- See Also:
-
-
Constructor Details
-
GroundFollowProjectile
public GroundFollowProjectile(int maxClimb, int maxDrop)
-
-
Method Details
-
setSpawnSnap
public void setSpawnSnap(int blocks) Arms the one-time spawn snap: on its first move the projectile drops up to this many blocks onto the ground. The launcher derives the value from the caster's own height above ground, so a cast a grounded gate allowed slightly airborne still produces a projectile that starts on the surface. -
getComponentType
-
findGroundAhead
Finds the foot Y the projectile lands on in the given column, scanning down from the highest allowed step to the deepest allowed drop.- Parameters:
world- The world to probe.blockX- The X block coordinate of the probed column.footBlockY- The current foot Y block coordinate.blockZ- The Z block coordinate of the probed column.- Returns:
- the new foot Y block coordinate, or
BLOCKEDwhen a wall exceeds the climb allowance, the drop exceeds the drop allowance, or the chunk is not loaded.
-
consumeSpawnSnap
public boolean consumeSpawnSnap()Consumes the one-time spawn snap. When it returnstrue, snap the foot to the ground below the spawn point withsnapToGroundAtSpawn(World, int, int, int). -
snapToGroundAtSpawn
Finds the foot Y for the one-time spawn snap: the ground at or below the spawn point, dropping up to the armed snap distance.- Returns:
- the new foot Y block coordinate, or
BLOCKEDwhen no ground is within reach.
-
findGroundBelow
-
clone
- Specified by:
clonein interfaceComponent<EntityStore>- Returns:
- a clone instance of the original component instance.
-