Posted November 20, 20159 yr I'm assuming I should use rayTraceBlocks but I'm not sure how to use it. Can anyone help? Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.
November 20, 20159 yr Closest to what? From where? You need to provide sufficient context with your questions so we don't have to waste time asking for it. http://i.imgur.com/NdrFdld.png[/img]
November 20, 20159 yr Author I want to find how far the player is from the ground Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.
November 20, 20159 yr Still not sufficient enough. Define "ground". Ground can be world height in given place or ANY block that is below you (which would also count if you were high on floating island or deep down in caves. No, you don't need to use rayTrace, if you just want to check what is below you you take player's pos and iterate down and check what block is on "player.posY - iteration". Now depending on "ground" definition - if ground would be ANY block that's it, but if you want to have ground height then it can get harder. Solutions may include saving world's height in given x/z into chunkData when world is generated. 1.7.10 is no longer supported by forge, you are on your own.
November 20, 20159 yr Author The ground is the closest block downwards from the player. Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.
November 20, 20159 yr The ground is the closest block downwards from the player. Then you already have your answer: iterate from the player's position downwards until you find a solid block. http://i.imgur.com/NdrFdld.png[/img]
November 20, 20159 yr Have a look at this: https://github.com/m1k3s/parachute/blob/1.8.0/parachute/common/EntityParachute.java Look at lines 510, 524, and 537
November 20, 20159 yr Look at lines 510, 524, and 537 You can link to specific lines on Github either by appending #L<line> to the URL or just clicking on the line. You can also link to a range of lines using #L<start>-L<end> at the end of the URL. In addition, you can link a range of lines by clicking a line number and then shift-clicking another line number. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
November 21, 20159 yr Thanks, I've seen people link to a specific line before, I just wasn't sure how to do it. Learn something new everyday. Hopefully some of that code was useful.
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.