Interface TeleportHelperFilter
- All Superinterfaces:
DefaultedRegistryValue
@CatalogedBy(TeleportHelperFilters.class)
public interface TeleportHelperFilter
extends DefaultedRegistryValue
A
TeleportHelperFilter
contains routines to determine whether a
location is a suitable candidate for teleporting to safely.-
Method Summary
Modifier and TypeMethodDescriptionboolean
isSafeBodyMaterial
(BlockState blockState) Tests whether aBlockState
should be considered a safe block for the body to be inside of.boolean
isSafeFloorMaterial
(BlockState blockState) Tests whether aBlockState
should be considered a safe block to land on.default Tristate
isValidLocation
(ServerWorld world, Vector3i position) Tests whether the location in question is valid, regardless of whether the block is safe or not.Methods inherited from interface org.spongepowered.api.registry.DefaultedRegistryValue
asDefaultedReference, findKey, key
-
Method Details
-
isValidLocation
Tests whether the location in question is valid, regardless of whether the block is safe or not. This is only intended to be used by kernels that blacklist/whitelist certain locations, and any block checks should be performed byisSafeFloorMaterial(BlockState)
andisSafeBodyMaterial(BlockState)
instead, to obtain the full benefits of theTeleportHelper
.- Returning
Tristate.UNDEFINED
denotes that the filter does not regard the location as valid or otherwise, and that the helper should determine if the location is suitable using theisSafeBodyMaterial(BlockState)
andisSafeFloorMaterial(BlockState)
methods. Implementations should generally return this result. - Returning
Tristate.TRUE
marks the location as valid and will causes the parentTeleportHelper
to return this location. No checks usingisSafeBodyMaterial(BlockState)
andisSafeFloorMaterial(BlockState)
will be performed. - Returning
Tristate.FALSE
marks the location as invalid and causes the parentTeleportHelper
to move onto the next block to check, regardless of whether it would have otherwise been marked as safe.
This method has a default implementation of always returning
Tristate.UNDEFINED
, that is, such a filter is not location specific.This will be called before any other check on the target location is performed, this is the first check performed when investigating a location.
- Returning
-
isSafeFloorMaterial
Tests whether aBlockState
should be considered a safe block to land on.- Parameters:
blockState
- TheBlockState
to check- Returns:
true
if the material should be safe to land on
-
isSafeBodyMaterial
Tests whether aBlockState
should be considered a safe block for the body to be inside of.Generally, you want this to be a passable block!
- Parameters:
blockState
- TheBlockState
to check- Returns:
true
if the material should be safe for the body to be inside of
-