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 TypeMethodDescriptionbooleanisSafeBodyMaterial(BlockState blockState) Tests whether aBlockStateshould be considered a safe block for the body to be inside of.booleanisSafeFloorMaterial(BlockState blockState) Tests whether aBlockStateshould be considered a safe block to land on.default TristateisValidLocation(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.UNDEFINEDdenotes 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.TRUEmarks the location as valid and will causes the parentTeleportHelperto return this location. No checks usingisSafeBodyMaterial(BlockState)andisSafeFloorMaterial(BlockState)will be performed. - Returning
Tristate.FALSEmarks the location as invalid and causes the parentTeleportHelperto 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 aBlockStateshould be considered a safe block to land on.- Parameters:
blockState- TheBlockStateto check- Returns:
trueif the material should be safe to land on
-
isSafeBodyMaterial
Tests whether aBlockStateshould be considered a safe block for the body to be inside of.Generally, you want this to be a passable block!
- Parameters:
blockState- TheBlockStateto check- Returns:
trueif the material should be safe for the body to be inside of
-