Posted May 25, 20196 yr Hello, I am trying to use the method rayTraceBlocks to see if my block can see the bottom of the world, however after approximately 11 Blocks of height (I say approximately as the distance has changed from time to time) the detected collision shifts 1 Block to the center of the world. If my block were for example at the position x: 4 y: 77 z: 0 the collision would be detected at x: 3 y: 55 z: 0 shifting 1 Block in the direction of the world center. This is the Code of my raycast (-100 is just a test value): Spoiler @Override public void update() { if(!world.isRemote) { RayTraceResult result = world.rayTraceBlocks(new Vec3d(pos.getX()+0.5, pos.getY()-1, pos.getZ()+0.5), new Vec3d(0, -100, 0), true, true, true); if(result!=null) { BlockPos bpos = result.getBlockPos(); System.out.println("Blockpos: "+bpos.getX()+" "+bpos.getY()+" "+bpos.getZ()+" from: "+pos.getX()+" "+pos.getY()+" "+pos.getZ()); } } } Thank you for your help!
May 25, 20196 yr 40 minutes ago, GloriousAlpaca said: I am trying to use the method rayTraceBlocks to see if my block can see the bottom of the world Why not just use a loop going down towards zero or a mutable Block pos? Edited May 25, 20196 yr by Cadiboo About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
May 25, 20196 yr Author I have used that for another block, I just wanted to try using raycasts once, however maybe it isn't the right application. How performance heavy are raycasts compared to just checking the blocks one by one ?
May 25, 20196 yr Extremely, just compare the code in the method that you’re calling to a simple loop About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
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.