Posted March 30, 201510 yr So, I want to simply get the coords of the block the player is looking at so I can use them to generate a structure properly. Problem is, the two ways I've tried seem to not work. Here they are: Vec3 vec3 = Vec3.createVectorHelper(player.posX, player.posY + player.getEyeHeight(), player.posZ); Vec3 lookVec = player.getLookVec(); MovingObjectPosition mop = world.rayTraceBlocks(lookVec, vec3); int x = mop.blockX; int y = mop.blockY; int z = mop.blockZ; if(mop != null) { System.out.println("Block X: " + x + ", " + "Block Y: " + y + ", " + "Block Z: " + z); } MovingObjectPosition mop = Minecraft.getMinecraft().renderViewEntity.rayTrace(200, 1.0F); if(mop != null) { int blockHitSide = mop.sideHit; Block blockLookingAt = world.getBlock(mop.blockX, mop.blockY, mop.blockZ); System.out.println("Block X: " + mop.blockX + ", " + "Block Y: " + mop.blockY + ", " + "Block Z: " + mop.blockZ); } If someone can help me that'd be great! I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.
March 30, 201510 yr On the client side I think you can use: Minecraft.getMinecraft().objectMouseOver, which is the current MovingObjectPosition as determined by the EntityRenderer. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
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.