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

Hello

In some code I'm working on, one item should teleport you on top of the block you're looking at. If there's no block there, nothing should happen. As it stands, someone else wrote this code and was able to get it almost perfect. The game crashes if you aren't looking at a block, the place you're teleported to isn't completely accurate, etc.

I've come up with a series of step that'll enable me to pull this off, but I don't know how to code these (keep in mind that I'm using the latest Forge version for 1.7.10:

[*]Extend the player's "reach" to be a massive or unbounded number

[*]Get the coordinates of the block they're looking at

[*]Return the player's "reach" to normal

[*]Add 0.5 to the X and Z values previously acquired, and 1.1 to the Y value (effectively making the new coordinates in the center and on top of the block selected)

[*]use setPosition() to send the player to the previously calculated coordinates

 

Is this at all possible in 1.7.10? If so, how would I pull it off? Also, is there a better and/or more efficient way to do this?

 

The code in its current form can be found here

First of all - learn why you should use logical sides and run logical code on server, where it is supposed to be ran.

 

Second - that is not really how you should do this. Check out vanilla's code for ray tracing blocks.

I am unsude where exacly it is in 1.7.10. Why? We alredy have 1.9... cmon man! (update).

1.7.10 is no longer supported by forge, you are on your own.

  • Author

I am unsude where exacly it is in 1.7.10. Why? We alredy have 1.9... cmon man! (update).

 

Well excuse me for preferring 1.7.10 for Forge

 

but thanks you anyways, I'll see what I can do

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.