Difference between the different raycast functions in World #4426
Unanswered
Stay1444
asked this question in
Mod Dev Support
Replies: 1 comment
-
Yeah doesn't sound weird at all. Fabric has a real problem with its
documentation. Sadly I can only provide an example in kotlin right now, but
here you go
```
fun getHighestBlockAt(chunk: Chunk, position: Vec3d, fluidHandling:
FluidHandling?): BlockHitResult {
val top = Vec3d(position.x, chunk.topY.toDouble(), position.z)
val bottom = Vec3d(position.x, chunk.bottomY.toDouble(), position.z)
return chunk.raycast(
RaycastContext(
top,
bottom,
RaycastContext.ShapeType.COLLIDER,
fluidHandling,
ShapeContext.absent()
)
)
}
```
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello! I was trying to Raycast from a position to another one, and i found that there are three methods to do so.
raycast(RaycastContext)
inBlockView
raycast(BlockStateRaycastContext)
inBlockView
raycastBlock(Vec3d, Vec3d, BlockPos, VoxelShape, BlockState)
inBlockView
So far, I've only managed to get
raycast(RaycastContext)
to correctly give me the first block it encounters, like thisraycast
withBlockStateRaycastContext
returns the end position always, andraycastBlock
returns null always.What is the difference between these methods?
Beta Was this translation helpful? Give feedback.
All reactions