Posted October 26, 20186 yr 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.
October 26, 20186 yr 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.
October 26, 20186 yr 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
October 26, 20186 yr Author Right so i figured out a fix i simple made the method Sideonly Client and it works for now so all is good
October 26, 20186 yr 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.
October 28, 20186 yr 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
October 28, 20186 yr 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.