Posted February 11, 201510 yr Hi, sorry I posting so late at night (If your on Mountain Time) but I have a few problems. Problem #1) I would like to know to detect if a player is looking at my custom block. Problem #2) I would like to draw some quads (I know how to do that) and make them rotate depending on the direction the player is looking. Like barriers (I know that's in 1.8 and uses particles, but that's besides the point). Is there any way to do this? If so how? Could anyone point to some good tutorials, if any?
February 11, 201510 yr Problem #1) Which block you are looking at, try this: MovingObjectPosition mop = Minecraft.getMinecraft().objectMouseOver() or you could try rayTracing, but i'ts proven to be a bit inaccurate over long distances. http://jabelarminecraft.blogspot.com/p/minecraft-forge-172-finding-block.html Problem #2) Get the players looking vector, you could look at the code for the enchanting table, the book does something similar. I require Java, both the coffee and the code
February 12, 201510 yr Thanks, I'll try that. Edit: Uhh... I'm not very good with Vec3's, sorry, but how do I get the angle from the lookvec of the player?
February 12, 201510 yr When I had to do problem 2, I looked at custom named entities. Here's my half-working result: https://bitbucket.org/JavaMatrix/snowtech/src/577af81dcbc980f306df52daa769e279fef212e4/SnowTech/java/com/defenestrationcoding/snowtech/renderers/RendererReceiver.java?at=master You Only Live Once, So Win At Golf. Sorry for my English, I'm American.
February 12, 201510 yr Ok, but how do I get the look angles from a Vec3 (where the player is looking)?
February 12, 201510 yr Ok, but how do I get the look angles from a Vec3 (where the player is looking)? Ill just send you a bit of code that I use whenever I get home.
April 17, 201510 yr Ok, but how do I get the look angles from a Vec3 (where the player is looking)? Ill just send you a bit of code that I use whenever I get home. I know this is an older thread, but mind sharing that code with everyone if you can? I'm trying to solve this same problem.
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.