Noxxous Posted September 22, 2022 Share Posted September 22, 2022 (edited) Hello, I was just wondering how I could get the block the player is looking at Edited September 22, 2022 by Noxxous too formal Quote Link to comment Share on other sites More sharing options...
ChampionAsh5357 Posted September 23, 2022 Share Posted September 23, 2022 Use `Entity#pick`. Supply the scale that should be applied to the view vector, the partial tick (which is 1.0 on the server), and whether it should look for fluids. Quote Link to comment Share on other sites More sharing options...
warjort Posted September 23, 2022 Share Posted September 23, 2022 Example of forge doing it on the client for the debug overlay: https://github.com/MinecraftForge/MinecraftForge/blob/98823a8f071e04c360a99ad5b46910f6c15028a8/src/main/java/net/minecraftforge/client/gui/overlay/ForgeGui.java#L680 Quote Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post. Link to comment Share on other sites More sharing options...
Noxxous Posted September 26, 2022 Author Share Posted September 26, 2022 On 9/23/2022 at 10:02 AM, ChampionAsh5357 said: Use `Entity#pick`. Supply the scale that should be applied to the view vector, the partial tick (which is 1.0 on the server), and whether it should look for fluids. Sorry for my ignorance but I don't get the autocomplete and I'm not entirely sure how to do it Quote Link to comment Share on other sites More sharing options...
Potato5 Posted September 26, 2022 Share Posted September 26, 2022 here's an alternative - look at the lilypad code. when the player uses lilypad item, that class checks what's exactly in front of player. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.