Contents
- Description
- Nested Class Summary
- Field Summary
- Constructor Summary
- Method Summary
- Field Details
- Constructor Details
- Method Details
- getComponentType()
- setZero()
- addVelocity(Vector3d)
- addVelocity(double, double, double)
- set(Vector3d)
- set(double, double, double)
- setClient(Vector3d)
- setClient(double, double, double)
- setX(double)
- setY(double)
- setZ(double)
- getX()
- getY()
- getZ()
- getSpeed()
- addInstruction(Vector3d, VelocityConfig, ChangeVelocityType)
- addInstruction(Vector3d, VelocityConfig, ChangeVelocityType, float)
- getInstructions()
- getVelocity()
- getClientVelocity()
- assignVelocityTo(Vector3d)
- clone()
Class Velocity
java.lang.Object
com.hypixel.hytale.server.core.modules.physics.component.Velocity
- All Implemented Interfaces:
Component<EntityStore>, Cloneable
An entity component that stores the current velocity of the entity
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA single instruction to be applied to the velocity -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BuilderCodec<Velocity> The codec used to parseVelocityinstancesFields inherited from interface Component
EMPTY_ARRAY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInstruction(org.joml.Vector3d velocity, VelocityConfig config, ChangeVelocityType type) Adds a new instruction to be performed on the velocity of the entityvoidaddInstruction(org.joml.Vector3d velocity, VelocityConfig config, ChangeVelocityType type, float preMultiplier) Adds a new instruction to be performed on the velocity of the entityvoidaddVelocity(double x, double y, double z) Adds the given velocity values to the velocityvoidaddVelocity(org.joml.Vector3d velocityDelta) Adds the given velocity value to the velocityorg.joml.Vector3dassignVelocityTo(org.joml.Vector3d vector) Assigns the velocity vector to another vector to prevent unintentional modification of the velocityclone()org.joml.Vector3dstatic ComponentType<EntityStore, Velocity> doublegetSpeed()org.joml.Vector3dReturns the actual velocity vector.doublegetX()doublegetY()doublegetZ()voidset(double x, double y, double z) Sets the velocity to the given velocity valuesvoidset(org.joml.Vector3d newVelocity) Sets the velocity to the given velocity valuevoidsetClient(double x, double y, double z) Sets the client velocity to the given velocity valuesvoidsetClient(org.joml.Vector3d newVelocity) Sets the client velocity to the given velocity valuevoidsetX(double x) Sets the X value of the velocityvoidsetY(double y) Sets the Y value of the velocityvoidsetZ(double z) Sets the Z value of the velocityvoidsetZero()Called to set the value of the velocity to zeroMethods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Component
cloneSerializable
-
Field Details
-
CODEC
The codec used to parseVelocityinstances
-
-
Constructor Details
-
Velocity
public Velocity()Default Constructor for aVelocityinstanceUsed by the entity store to instantiate a velocity component
-
Velocity
-
Velocity
public Velocity(@Nonnull org.joml.Vector3d initialVelocity) Constructor for aVelocityinstance that initializes with a set initial velocity- Parameters:
initialVelocity- The initial velocity to set
-
-
Method Details
-
getComponentType
- Returns:
- the component type for
Velocitycomponents
-
setZero
public void setZero()Called to set the value of the velocity to zero -
addVelocity
public void addVelocity(@Nonnull org.joml.Vector3d velocityDelta) Adds the given velocity value to the velocity- Parameters:
velocityDelta- The velocity value to add
-
addVelocity
public void addVelocity(double x, double y, double z) Adds the given velocity values to the velocity- Parameters:
x- The X velocity valuey- The Y velocity valuez- The Z velocity value
-
set
public void set(@Nonnull org.joml.Vector3d newVelocity) Sets the velocity to the given velocity value- Parameters:
newVelocity- The new velocity value to set
-
set
public void set(double x, double y, double z) Sets the velocity to the given velocity values- Parameters:
x- The X value to sety- The Y value to setz- The Z value to set
-
setClient
public void setClient(@Nonnull org.joml.Vector3d newVelocity) Sets the client velocity to the given velocity value- Parameters:
newVelocity- The velocity value to set
-
setClient
public void setClient(double x, double y, double z) Sets the client velocity to the given velocity values- Parameters:
x- The X value to sety- The Y value to setz- The Z value to set
-
setX
public void setX(double x) Sets the X value of the velocity- Parameters:
x- The X value to be set
-
setY
public void setY(double y) Sets the Y value of the velocity- Parameters:
y- The Y value to be set
-
setZ
public void setZ(double z) Sets the Z value of the velocity- Parameters:
z- The Z value to be set
-
getX
public double getX()- Returns:
- the X value of the velocity
-
getY
public double getY()- Returns:
- the Y value of the velocity
-
getZ
public double getZ()- Returns:
- the Z value of the velocity
-
getSpeed
public double getSpeed()- Returns:
- the overall speed of the velocity
-
addInstruction
public void addInstruction(@Nonnull org.joml.Vector3d velocity, @Nullable VelocityConfig config, @Nonnull ChangeVelocityType type) Adds a new instruction to be performed on the velocity of the entity- Parameters:
velocity- The velocity value to be appliedconfig- The velocity config to be referenced, if anytype- The type of application to perform with the velocity
-
addInstruction
public void addInstruction(@Nonnull org.joml.Vector3d velocity, @Nullable VelocityConfig config, @Nonnull ChangeVelocityType type, float preMultiplier) Adds a new instruction to be performed on the velocity of the entity- Parameters:
velocity- The velocity value to be appliedconfig- The velocity config to be referenced, if anytype- The type of application to perform with the velocitypreMultiplier- Tracked scaling value for knockback horizontal velocity scaling
-
getInstructions
- Returns:
- the list of pending instructions for this velocity component
-
getVelocity
@Nonnull public org.joml.Vector3d getVelocity()Returns the actual velocity vector. It is recommended to useassignVelocityTo(Vector3d)when possible. Otherwise, use with caution, as modifying this vector modifies the velocity of the entity.Note: This is the expected behavior, however currently this does not apply for NPCs and Player entities, and will not until they've been properly ported to the ECS.
- Returns:
- the actual velocity vector, modify with caution
-
getClientVelocity
@Nonnull public org.joml.Vector3d getClientVelocity()- Returns:
- the last known client velocity that we have cached
-
assignVelocityTo
@Nonnull public org.joml.Vector3d assignVelocityTo(@Nonnull org.joml.Vector3d vector) Assigns the velocity vector to another vector to prevent unintentional modification of the velocity- Parameters:
vector- theVector3dto assign the velocity to- Returns:
- the given vector, for chaining
-
clone
- Specified by:
clonein interfaceComponent<EntityStore>- Returns:
- a clone instance of the original component instance.
-