Contents
- Description
- Constructor Summary
- Method Summary
- Constructor Details
- Method Details
- reset()
- add(double, double, double, Ref)
- add(double, double, double, Ref, Rotation3fc)
- hasPosition()
- providePosition(Vector3d)
- getX()
- getY()
- getZ()
- getTarget()
- provideOrientation(Rotation3f)
- clear()
- getPositionProvider()
- size()
- getTarget(int)
- getPosition(int, Vector3d)
- getOrientation(int, Rotation3f)
- applyTransform(IPositionProvider, PositionSetTransform, PositionSetProvider, boolean, Vector3d, Vector3d, Rotation3f, Store)
Class PositionSetProvider
java.lang.Object
com.hypixel.hytale.server.npc.sensorinfo.InfoProviderBase
com.hypixel.hytale.server.npc.sensorinfo.PositionSetProvider
- All Implemented Interfaces:
InfoProvider, IPositionProvider, IPositionSet
public class PositionSetProvider
extends InfoProviderBase
implements IPositionProvider, IPositionSet
An
InfoProvider holding a computed set of positions (each with an optional associated entity),
produced by a PositionSetTransform. Implements IPositionProvider as the slot-0 view and
IPositionSet for multi-aware consumers like ForEach.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(double x, double y, double z, Ref<EntityStore> target) Appends a computed position with an optional source entity.voidadd(double x, double y, double z, Ref<EntityStore> target, Rotation3fc orientation) Appends a computed position carrying an orientation.static voidapplyTransform(IPositionProvider in, PositionSetTransform transform, PositionSetProvider out, boolean carryTarget, org.joml.Vector3d tmpIn, org.joml.Vector3d tmpOut, Rotation3f tmpRot, Store<EntityStore> store) Mapstransformover every element ofin(a single position or anIPositionSet) intoout, dropping elements the transform rejects.voidclear()Reset position provider so that hasPosition() will return false.booleangetOrientation(int index, Rotation3f out) Writes the orientation of elementindexintoout, when that element carries one.booleangetPosition(int index, org.joml.Vector3d out) Writes the position of elementindexintoout.We provide direct access to the position provider as it's the most frequently used provider and is used in a very large number of actions and motions.Return target entity if sensor provides it currently.getTarget(int index) doublegetX()Return x coordinate of available position.doublegetY()Return y coordinate of available position.doublegetZ()Return z coordinate of available position.booleanTest if PositionProvider does return a position currently.booleanWrites the orientation of the current (primary) position intoout, when one is available.booleanprovidePosition(org.joml.Vector3d result) Test and return sensor positional result if available.voidreset()Logically empties the set while keeping the backing buffers for reuse.intsize()Methods inherited from class InfoProviderBase
getExtraInfo, getParameterProvider, getPassedExtraInfo, passExtraInfo
-
Constructor Details
-
PositionSetProvider
public PositionSetProvider() -
PositionSetProvider
-
-
Method Details
-
reset
public void reset()Logically empties the set while keeping the backing buffers for reuse. -
add
Appends a computed position with an optional source entity. Reuses theVector3dalready at this slot when the buffer has grown large enough on a previous tick. -
add
public void add(double x, double y, double z, @Nullable Ref<EntityStore> target, @Nonnull Rotation3fc orientation) Appends a computed position carrying an orientation. -
hasPosition
public boolean hasPosition()Description copied from interface:IPositionProviderTest if PositionProvider does return a position currently.- Specified by:
hasPositionin interfaceInfoProvider- Specified by:
hasPositionin interfaceIPositionProvider- Returns:
- if true providePosition and getX/Y/Z will return positional result of sensor
-
providePosition
public boolean providePosition(@Nonnull org.joml.Vector3d result) Description copied from interface:IPositionProviderTest and return sensor positional result if available.- Specified by:
providePositionin interfaceIPositionProvider- Parameters:
result- Vector3d receiving position information if available- Returns:
- True if position is available and result was updated, false if no position available
-
getX
public double getX()Description copied from interface:IPositionProviderReturn x coordinate of available position.- Specified by:
getXin interfaceIPositionProvider- Returns:
- Coordinate if position available else result is undefined.
-
getY
public double getY()Description copied from interface:IPositionProviderReturn y coordinate of available position.- Specified by:
getYin interfaceIPositionProvider- Returns:
- Coordinate if position available else result is undefined.
-
getZ
public double getZ()Description copied from interface:IPositionProviderReturn z coordinate of available position.- Specified by:
getZin interfaceIPositionProvider- Returns:
- Coordinate if position available else result is undefined.
-
getTarget
Description copied from interface:IPositionProviderReturn target entity if sensor provides it currently.A sensor might return a valid position but return a null value here if this position does not correlate to an entity.
- Specified by:
getTargetin interfaceIPositionProvider- Returns:
- entity ref if sensor is matching and result refers to an entity, else null.
-
provideOrientation
Description copied from interface:IPositionProviderWrites the orientation of the current (primary) position intoout, when one is available.- Specified by:
provideOrientationin interfaceIPositionProvider- Returns:
- true if an orientation was written, false otherwise (in which case
outis left untouched).
-
clear
public void clear()Description copied from interface:IPositionProviderReset position provider so that hasPosition() will return false.- Specified by:
clearin interfaceIPositionProvider
-
getPositionProvider
Description copied from interface:InfoProviderWe provide direct access to the position provider as it's the most frequently used provider and is used in a very large number of actions and motions.- Specified by:
getPositionProviderin interfaceInfoProvider- Returns:
- the position provider.
-
size
public int size()- Specified by:
sizein interfaceIPositionSet- Returns:
- the number of elements in the set (0 when empty).
-
getTarget
- Specified by:
getTargetin interfaceIPositionSet- Returns:
- the entity associated with element
index, or null when the element is a bare position with no entity (e.g. a computed point), whenindexis out of range, or when the entity is no longer valid.
-
getPosition
public boolean getPosition(int index, @Nonnull org.joml.Vector3d out) Description copied from interface:IPositionSetWrites the position of elementindexintoout.- Specified by:
getPositionin interfaceIPositionSet- Returns:
- true if a position was written. false if
indexis out of range.
-
getOrientation
Description copied from interface:IPositionSetWrites the orientation of elementindexintoout, when that element carries one.- Specified by:
getOrientationin interfaceIPositionSet- Returns:
- true if an orientation was written, false otherwise (in which case
outis left untouched).
-
applyTransform
public static void applyTransform(@Nonnull IPositionProvider in, @Nonnull PositionSetTransform transform, @Nonnull PositionSetProvider out, boolean carryTarget, @Nonnull org.joml.Vector3d tmpIn, @Nonnull org.joml.Vector3d tmpOut, @Nonnull Rotation3f tmpRot, @Nonnull Store<EntityStore> store) Mapstransformover every element ofin(a single position or anIPositionSet) intoout, dropping elements the transform rejects. A transform changes position only, so each element's orientation (when present) is carried through unchanged, independent ofcarryTarget.
-