Interface LandPathTypeRegistry.DynamicPathTypeProvider
- All Superinterfaces:
LandPathTypeRegistry.PathTypeProvider
- Enclosing class:
LandPathTypeRegistry
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
public static non-sealed interface LandPathTypeRegistry.DynamicPathTypeProvider
extends LandPathTypeRegistry.PathTypeProvider
A functional interface that provides the
PathType, given the block state level and position.-
Method Summary
Modifier and TypeMethodDescription@Nullable net.minecraft.world.level.pathfinder.PathTypegetPathType(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos, boolean neighbor) Gets thePathTypefor the specified block state at the specified position.
-
Method Details
-
getPathType
@Nullable net.minecraft.world.level.pathfinder.PathType getPathType(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos, boolean neighbor) Gets thePathTypefor the specified block state at the specified position.You can specify what to return if the block state is a direct target of an entity path, or a neighbor block of the entity path.
For example, for a cactus-like block you should specify
PathType.DAMAGINGif the block is a direct target (neighbor == false) to specify that an entity should not pass through or above the block because it will cause damage, andPathType.DAMAGING_IN_NEIGHBORif the cactus will be found as a neighbor block in the entity path (neighbor == true) to specify that the entity should not get close to the block because is dangerous.- Parameters:
state- Current block state.level- Current level.pos- Current position.neighbor- Specifies that the block is in a direct neighbor position to an entity path (directly next to a block that the entity will pass through or above).- Returns:
- the custom
PathTyperegistered for the specified block state at the specified position.
-