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

Since 1.15 introduced a lot of significant changes as opposed to 1.12, I cannot figure out how to RayTrace an entity from a range further than what pointedEntity allows (~4 blocks)

I am able to raytrace blocks from an increased range using BlockRayTraceResult, but I am unsure how to apply this to entities. I want to be able to target an entity from a range of about 50 blocks.

Please let me know where to start. Thank You.

 

Howdy

Have you looked at ProjectileHelper::rayTraceEntities? 

You should be able to adapt the code in there to do what you want.  50 blocks is a very long way,though.   It might be more efficient to use a different algorithm which filters entities manually, i.e.

for each entity in world {

vec3d entityPosition = entity - origin

check if position is in the correct octant (x +ve or -ve, y +ve or -ve, z + or -ve etc)

if so {

  vec3d distanceFromEntityToRay = cross product (position, ray) / norm (ray)

  if distanceFromEntityToRay < 5 then include in detailed raytrace otherwise exclude

}

}

you'll need to know a bit of vector math to do that...

 

-TGG

 

 

  • Author

hmm the code i used in my old mod came from the source code of a different mod, but im not sure if it can be adapted to 1.15, i believe it involved vector math aswell might have to give it a go 
Thank you for the pointers though!

 

Edit: Found some code from another mod that I believe I can adapt to my specific use case

Edited by -TheLittleGuy

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.