Contents
- Description
- Field Summary
- Constructor Summary
- Method Summary
- Field Details
- Constructor Details
- Method Details
- get()
- getConfig()
- getTangibleEntitySpatialResourceType()
- findCollisions(Box, Vector3d, Vector3d, CollisionResult, ComponentAccessor)
- findCollisions(Box, Vector3d, Vector3d, boolean, CollisionResult, ComponentAccessor)
- findBlockCollisionsIterative(World, Box, Vector3d, Vector3d, boolean, CollisionResult)
- findCharacterCollisions(Box, Vector3d, Vector3d, CollisionResult, ComponentAccessor)
- findBlockCollisionsShortDistance(World, Box, Vector3d, Vector3d, CollisionResult)
- findIntersections(World, Box, Vector3d, CollisionResult, boolean, boolean)
- validatePosition(World, Box, Vector3dc, CollisionResult)
- validatePosition(World, Box, Vector3dc, int, T, CollisionFilter, CollisionResult)
- isBelowMovementThreshold(Vector3d)
Class CollisionModule
java.lang.Object
com.hypixel.hytale.server.core.plugin.PluginBase
com.hypixel.hytale.server.core.plugin.JavaPlugin
com.hypixel.hytale.server.core.modules.collision.CollisionModule
- All Implemented Interfaces:
CommandOwner
The Collision Module, which provides collision detection and response functionality for entities and blocks
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PluginManifestThe manifest for theCollisionModuleplugin.static final intstatic final intstatic final intstatic final intFields inherited from class PluginBase
METRICS_REGISTRY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidfindBlockCollisionsIterative(World world, Box collider, org.joml.Vector3d pos, org.joml.Vector3d v, boolean stopOnCollisionFound, CollisionResult result) Called to find block collisions for a moving box collider in the world using an iterative approach.static voidfindBlockCollisionsShortDistance(World world, Box collider, org.joml.Vector3d pos, org.joml.Vector3d v, CollisionResult result) Called to find block collisions for a moving box collider in the world using a short distance approach.static voidfindCharacterCollisions(Box collider, org.joml.Vector3d pos, org.joml.Vector3d v, CollisionResult result, ComponentAccessor<EntityStore> componentAccessor) Called to find character collisions for a moving box collider in the world.static booleanfindCollisions(Box collider, org.joml.Vector3d pos, org.joml.Vector3d v, boolean stopOnCollisionFound, CollisionResult result, ComponentAccessor<EntityStore> componentAccessor) Called to find collisions for a moving box collider in the world.static booleanfindCollisions(Box collider, org.joml.Vector3d pos, org.joml.Vector3d v, CollisionResult result, ComponentAccessor<EntityStore> componentAccessor) Called to find collisions for a moving box collider in the world.voidfindIntersections(World world, Box collider, org.joml.Vector3d pos, CollisionResult result, boolean triggerBlocks, boolean intersections) Called to find intersections for a box collider in the world.static CollisionModuleget()static booleanisBelowMovementThreshold(org.joml.Vector3d v) Check if a movement vector is below the movement threshold.<T> intvalidatePosition(World world, Box collider, org.joml.Vector3dc pos, int invalidBlockMaterials, T t, CollisionFilter<BoxBlockIntersectionEvaluator, T> predicate, CollisionResult result) Called to validate a position for a box collider in the world.intvalidatePosition(World world, Box collider, org.joml.Vector3dc pos, CollisionResult result) Called to validate a position for a box collider in the world.Methods inherited from class JavaPlugin
getClassLoader, getFile, getTypeMethods inherited from class PluginBase
getAssetRegistry, getBasePermission, getChunkStoreRegistry, getClientFeatureRegistry, getCodecRegistry, getCodecRegistry, getCodecRegistry, getCommandRegistry, getDataDirectory, getEntityRegistry, getEntityStoreRegistry, getEventRegistry, getIdentifier, getLogger, getManifest, getName, getState, getTaskRegistry, isDisabled, isEnabled, preLoad
-
Field Details
-
MANIFEST
The manifest for theCollisionModuleplugin. -
VALIDATE_INVALID
public static final int VALIDATE_INVALID- See Also:
-
VALIDATE_OK
public static final int VALIDATE_OK- See Also:
-
VALIDATE_ON_GROUND
public static final int VALIDATE_ON_GROUND- See Also:
-
VALIDATE_TOUCH_CEIL
public static final int VALIDATE_TOUCH_CEIL- See Also:
-
-
Constructor Details
-
CollisionModule
Default Constructor for aCollisionModuleinstance.- Parameters:
init- The plugin initialization step for this plugin
-
-
Method Details
-
get
- Returns:
- the singleton instance of the
CollisionModuleplugin.
-
getConfig
- Returns:
- the configuration for the
CollisionModuleplugin.
-
getTangibleEntitySpatialResourceType
public ResourceType<EntityStore, SpatialResource<Ref<EntityStore>, EntityStore>> getTangibleEntitySpatialResourceType()- Returns:
- the resource type for the
SpatialResourcethat contains all tangible entities for collision detection.
-
findCollisions
public static boolean findCollisions(@Nonnull Box collider, @Nonnull org.joml.Vector3d pos, @Nonnull org.joml.Vector3d v, @Nonnull CollisionResult result, @Nonnull ComponentAccessor<EntityStore> componentAccessor) Called to find collisions for a moving box collider in the world.- Parameters:
collider- The box collider.pos- The position of the collider.v- The movement vector of the collider.result- The collision result to store the results in.componentAccessor- TheComponentAccessor<EntityStore>for component access.- Returns:
trueif the movement distance is considered far,falseif it is considered short.
-
findCollisions
public static boolean findCollisions(@Nonnull Box collider, @Nonnull org.joml.Vector3d pos, @Nonnull org.joml.Vector3d v, boolean stopOnCollisionFound, @Nonnull CollisionResult result, @Nonnull ComponentAccessor<EntityStore> componentAccessor) Called to find collisions for a moving box collider in the world.- Parameters:
collider- The box collider.pos- The position of the collider.v- The movement vector of the collider.stopOnCollisionFound- Whether to stop searching for collisions after the first one is found.result- The collision result to store the results in.componentAccessor- TheComponentAccessor<EntityStore>for component access.- Returns:
trueif the movement distance is considered far,falseif it is considered short.
-
findBlockCollisionsIterative
public static void findBlockCollisionsIterative(@Nonnull World world, @Nonnull Box collider, @Nonnull org.joml.Vector3d pos, @Nonnull org.joml.Vector3d v, boolean stopOnCollisionFound, @Nonnull CollisionResult result) Called to find block collisions for a moving box collider in the world using an iterative approach.- Parameters:
world- The world to check for collisions in.collider- The box collider.pos- The position of the collider.v- The movement vector of the collider.stopOnCollisionFound- Whether to stop searching for collisions after the first one is found.result- The collision result to store the results in.
-
findCharacterCollisions
public static void findCharacterCollisions(@Nonnull Box collider, @Nonnull org.joml.Vector3d pos, @Nonnull org.joml.Vector3d v, @Nonnull CollisionResult result, @Nonnull ComponentAccessor<EntityStore> componentAccessor) Called to find character collisions for a moving box collider in the world.- Parameters:
collider- The moving collider box.pos- The position of the collider.v- The movement vector of the collider.result- The collision result to store the results in.componentAccessor- TheComponentAccessor<EntityStore>for component access.
-
findBlockCollisionsShortDistance
public static void findBlockCollisionsShortDistance(@Nonnull World world, @Nonnull Box collider, @Nonnull org.joml.Vector3d pos, @Nonnull org.joml.Vector3d v, @Nonnull CollisionResult result) Called to find block collisions for a moving box collider in the world using a short distance approach.- Parameters:
world- The world to check for collisions in.collider- The box collider.pos- The position of the collider.v- The movement vector of the collider.result- The collision result to store the results in.
-
findIntersections
public void findIntersections(@Nonnull World world, @Nonnull Box collider, @Nonnull org.joml.Vector3d pos, @Nonnull CollisionResult result, boolean triggerBlocks, boolean intersections) Called to find intersections for a box collider in the world.- Parameters:
world- The associated world.collider- The box collider.pos- The position of the collider.result- The collision result to store the results in.triggerBlocks- Whether to report trigger block intersections.intersections- Whether to report normal block intersections.
-
validatePosition
public int validatePosition(@Nonnull World world, @Nonnull Box collider, @Nonnull org.joml.Vector3dc pos, @Nonnull CollisionResult result) Called to validate a position for a box collider in the world.- Parameters:
world- The associated world.collider- The box collider.pos- The position of the collider.result- The collision result to store the results in.- Returns:
- the validation code.
-
validatePosition
public <T> int validatePosition(@Nonnull World world, @Nonnull Box collider, @Nonnull org.joml.Vector3dc pos, int invalidBlockMaterials, @Nullable T t, @Nonnull CollisionFilter<BoxBlockIntersectionEvaluator, T> predicate, @Nonnull CollisionResult result) Called to validate a position for a box collider in the world.- Type Parameters:
T- The type of the extra data passed to the predicate.- Parameters:
world- The associated world.collider- The box collider.pos- The position of the collider.invalidBlockMaterials- The invalid block materials bitmask.t- The extra data passed to the predicate.predicate- The collision filter predicate.result- The collision result to store the results in.- Returns:
- the validation code.
-
isBelowMovementThreshold
public static boolean isBelowMovementThreshold(@Nonnull org.joml.Vector3d v) Check if a movement vector is below the movement threshold.- Parameters:
v- The movement vector.- Returns:
trueif the movement vector is below the threshold,falseotherwise.
-