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 i am wondering how i can check the distance from a mob to a player Server side i know how to do it client using something like entity.getDistance(Minecraft.getMinecraft().player) < 4F      bit how would i do this server side

 

 

Thank you.

7 minutes ago, Discult said:

how i can check the distance from a mob to a player Server side

Which player? There can be a lot of players on the server... And you have to account for that if your mod isn't client only. 

You can get the list of all players with World#playerEntities.

  • Author
1 minute ago, V0idWa1k3r said:

Which player? There can be a lot of players on the server... And you have to account for that if your mod isn't client only. 

You can get the list of all players with World#playerEntities.

Its any player as soon as any player is a certain distance to the mob it changes the model all works fine in client but on server it does not 

i will try the World#playerEntities

  • Author

Right so i figured out a fix i simple made the method Sideonly Client and it works for now so all is good

12 minutes ago, Discult said:

i figured out a fix i simple made the method Sideonly Client and it works for now

If your code has any reference to that method that is invoked from common code you will crash the server.

 

15 minutes ago, Discult said:

any player is a certain distance to the mob it changes the model

The client will not observe the model changing as soon as another player comes into range with your current implementation.

  • Author
On 10/27/2018 at 12:29 AM, V0idWa1k3r said:

If your code has any reference to that method that is invoked from common code you will crash the server.

 

The client will not observe the model changing as soon as another player comes into range with your current implementation.

how do you think i should go about doing it then

 

I already told you. Iterate

On 10/27/2018 at 2:15 AM, V0idWa1k3r said:

World#playerEntities

get the closest player and work from there.

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.