Posted January 6, 20223 yr I'm able to successfully find the first block along a ray by using this line: HitResult hitResult = MC.level.clip(new ClipContext(vectorNear, vectorFar, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, null)); However, while there is an option to include ClipContext.Fluid.NONE to ignore fluid blocks like water and lava, there isn't a similar one to ignore non-solid blocks such as grass, flowers, etc. Is there a way to achieve the same outcome but ignore these blocks? I am able to tell if a particular block is solid or not using this line: Minecraft.level.getBlockState(blockPos).getMaterial().isSolidBlocking() EDIT: to clarify, I want to get the next solid block BEHIND the non-solid one, using Fluid.NONE instead causes it to return nothing Edited January 6, 20223 yr by SoLegendary clarify goal
January 6, 20223 yr 1 hour ago, SoLegendary said: ClipContext.Block.OUTLINE change the ClipContext.Block, since OUTLINE use the default VoxelShape, if you want to ignore non-solid Blocks you can use COLLIDER it use the collision VoxelShape
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.