Jump to content

Recommended Posts

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.

Posted
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.

Posted
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

Posted
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.

Posted
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

 

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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