Package-level declarations

Types

Link copied to clipboard

Tracks locations of specific states in the world.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
data class ShortestPath<T>(val nodes: List<T>, val totalCost: Double) : Record
Link copied to clipboard
enum SwingMode : Tagged, Consumer<InteractionHand> , Enum<SwingMode>
Link copied to clipboard
data class WeightedEdge<T>(val node: T, val cost: Double) : Record

Properties

Link copied to clipboard
val AABB.collidingRegion: BoundingBox
Link copied to clipboard
val BlockPos.collisionShape: VoxelShape
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val BlockPos.immutable: BlockPos

Converts this BlockPos to an immutable one if needed.

Link copied to clipboard
val TypedInstance<Block>.isAnyChest: Boolean
Link copied to clipboard
val BlockState.isBed: Boolean
Link copied to clipboard
val BlockState?.isInteractable: Boolean
Link copied to clipboard
val BlockPos.outlineBox: AABB

Returns the block box outline of the block at the position. If the block is air, it will return an empty box. Outline Box should be used for rendering purposes only.

Link copied to clipboard
val BlockPos.outlineShape: VoxelShape
Link copied to clipboard
val BlockPos.state: BlockState?
Link copied to clipboard
val BlockPos.stateOrEmpty: BlockState
Link copied to clipboard
val BlockHitResult.targetBlockPos: BlockPos

Functions

Link copied to clipboard
fun BlockState?.anotherBedPartDirection(): Direction?
Link copied to clipboard
fun BlockState?.anotherChestPartDirection(): Direction?
Link copied to clipboard
fun <T> aStarShortestPath(start: T, isGoal: Predicate<T>, neighbors: Function<T, Iterable<WeightedEdge<T>>>, heuristic: ToDoubleFunction<T>, maxIterations: Int = Int.MAX_VALUE, maxCost: Double = Double.POSITIVE_INFINITY): ShortestPath<T>?

Finds the shortest path using A* search.

Link copied to clipboard
fun BlockPos.canStandOn(): Boolean
Link copied to clipboard
inline fun AABB.collideBlockIntersects(checkCollisionShape: Boolean = true, isCorrectBlock: (Block) -> Boolean): Boolean

Check if box intersects with bounding box of specified blocks

Link copied to clipboard
fun <T> dijkstraShortestPath(start: T, isGoal: Predicate<T>, neighbors: Function<T, Iterable<WeightedEdge<T>>>, maxIterations: Int = Int.MAX_VALUE, maxCost: Double = Double.POSITIVE_INFINITY): ShortestPath<T>?

Returns the shortest path from start to the first node where isGoal returns true.

Link copied to clipboard
fun doBreak(pos: BlockPos, immediate: Boolean = false, swingMode: SwingMode = SwingMode.DO_NOT_HIDE): Boolean

Starts breaking pos, rotating silently towards it. immediate sends start and stop at once, which only works in creative or on blocks that break instantly.

fun doBreak(rayTraceResult: BlockHitResult, immediate: Boolean = false, swingMode: SwingMode = SwingMode.DO_NOT_HIDE)

Breaks the block

Link copied to clipboard
fun doPlacement(pos: BlockPos, hand: InteractionHand = InteractionHand.MAIN_HAND, swingMode: SwingMode = SwingMode.DO_NOT_HIDE): Boolean

Places the item in hand at pos against a neighbouring block, rotating silently towards it.

fun doPlacement(hitResult: BlockHitResult, rotation: Rotation, hand: InteractionHand = InteractionHand.MAIN_HAND, onPlacementSuccess: () -> Boolean = { true }, onItemUseSuccess: () -> Boolean = { true }, swingMode: SwingMode = SwingMode.DO_NOT_HIDE)

Simulated net.minecraft.world.phys.HitResult.Type.BLOCK branch in vanilla

Link copied to clipboard
fun BlockPos?.fallDamageMultiplier(entity: Entity): Float
fun Block?.fallDamageMultiplier(entity: Entity): Float
Link copied to clipboard
fun BlockPos.getBlock(): Block?
Link copied to clipboard
fun BlockPos.getBlockingEntities(except: Entity? = null, box: AABB = FULL_BOX, predicate: Predicate<Entity> = Predicates.alwaysTrue()): List<Entity>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun AbstractBedBlock.getPotentialSecondBedBlock(state: BlockState, pos: BlockPos): BlockPos

Returns the second bed block position that might not exist (normally beds are two blocks long tho).

Link copied to clipboard
fun BlockPos.getSortedSphere(radius: Float): Array<BlockPos>
Link copied to clipboard
Link copied to clipboard
fun BlockPos.isBlastResistant(): Boolean
Link copied to clipboard
inline fun AABB.isBlockAtPosition(isCorrectBlock: (Block?) -> Boolean): Boolean

Check if box is reaching of specified blocks

Link copied to clipboard
fun BlockPos.isBlockedByEntitiesReturnCrystal(except: Entity? = null, box: AABB = FULL_BOX, excludeIds: IntCollection? = null, buildingOnly: Boolean = true): BooleanObjectPair<EndCrystal?>

Checks whether the position is blocked for placing a block and returns a blocking end crystal if present.

Link copied to clipboard
fun BlockState.isBreakable(pos: BlockPos): Boolean
Link copied to clipboard
fun RespawnAnchorBlock.isCharged(state: BlockState): Boolean
Link copied to clipboard
fun Block?.isInteractable(blockState: BlockState?): Boolean

Checks if the block can be interacted with, null will be returned as not interactable. The blockState is optional but can make the result more accurate, if not provided it will just assume the block is interactable.

Link copied to clipboard
fun BlockState.isNotBreakable(pos: BlockPos): Boolean
Link copied to clipboard
fun BlockPos.isUnobstructed(except: Entity? = null, box: AABB = FULL_BOX, predicate: Predicate<Entity> = Predicates.alwaysTrue()): Boolean

Checks whether the position is unobstructed for placing a block.

Link copied to clipboard
fun BlockState.outlineBox(blockPos: BlockPos): AABB
Link copied to clipboard
fun BlockPos.outlineShape(collisionContext: CollisionContext): VoxelShape
Link copied to clipboard
fun BlockGetter.raycast(context: ClipContext, exclude: Collection<BlockPos>?, include: BlockPos?, maxBlastResistance: Float?): BlockHitResult

Basically BlockGetter.raycast but this method allows us to exclude blocks using exclude.

Link copied to clipboard
fun BlockPos.searchBedLayer(state: BlockState, layers: Int): Sequence<IntLongPair>

Scan blocks outwards from a bed

Link copied to clipboard
fun Vec3.searchBlocksInCuboid(radius: Float, filter: BiPredicate<BlockPos, BlockState>): List<Pair<BlockPos, BlockState>>

Scan blocks around the position in a cuboid with filtering.

Link copied to clipboard
fun Vec3.searchBlocksInRangeSorted(range: Float, shapeGetter: ClipContext.ShapeGetter = ClipContext.Block.OUTLINE, collisionContext: CollisionContext = CollisionContext.of(player), filter: BiPredicate<BlockPos, BlockState>): List<Pair<BlockPos, BlockState>>

Scan blocks around the position in a cuboid, filtered and sorted by shape distance from this Vec3. Distance calculation is based on outline shape: shapeGetter.get(state, level, pos, collisionContext).move(pos).distanceToSqr(eyesPos).

Link copied to clipboard
fun BlockPos.searchLayer(layers: Int, vararg directions: Direction): Sequence<IntLongPair>

Scan blocks outwards from center along given directions, up to layers

Link copied to clipboard
fun Vec3i.toBlockPos(): BlockPos