Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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?

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 :)

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?

Ok, but how do I get the look angles from a Vec3 (where the player is looking)?

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.

  • 2 months later...

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.