Jump to content

1.19.3 Show Player Crawling For All Players


sFXprt

Recommended Posts

Currently I have a mod that involves flying, which when activated shows the user's players crawling/swimming in the air while flying but this is only visible to the person flying and not other clients on the server (I achieved this by using LocalPlayer and checking for id/Entity#equals then forcing swimming pose). How do I get other players to see the person flying's pose as crawling/swimming as well?

The current things I have tried is iterating through online player list in ServerLevel and casting the ServerPlayer to Players and getting ClientLevel from said Players and force editing the pose for any entities in the entitiesForRendering() method that matches the criteria for flying. But that did not work at all and nothing happened. (Sorry I have no code on me right now I am on the phone away from computer)

I also attempted to send packets to each nearby player that has said flying player rendered. This resulted in the flyer to no longer force crawl/swim in the air. I even attempted to mess with each clients LocalPlayer in attempt to show the flyer as crawl/swimming but that failed too and causes a bit of lag which is not optimal for me.

Any ideas or solutions would help me greatly!

Link to comment
Share on other sites

3 hours ago, sFXprt said:

I achieved this by using LocalPlayer

Then you are only setting players pose on the client. The server has no idea that the player should be swimming, so there is nothing telling the other players that this player should be swimming. 

Link to comment
Share on other sites

14 hours ago, Alpvax said:

Then you are only setting players pose on the client. The server has no idea that the player should be swimming, so there is nothing telling the other players that this player should be swimming. 

I understand that part already, the problem is trying to get other players to see the change

Link to comment
Share on other sites

I don't know much about forcedPose() but...

 

If you want to set the pose so that everybody sees it, then as was said above you need to do it on the server.

That should take care of broadcasting the new pose to everybody in range of the player you changed.

 

But that won't do much for the actual player you changed. The server doesn't usually "control" players.

https://forums.minecraftforge.net/topic/119553-1192-solved-cannot-get-passengers-of-an-entity-when-there-are-multiple-instances-of-the-entity-in-the-world/#comment-524427

So you will also need to force the pose on the client for that player you changed, otherwise player.updatePlayerPose() will just reset/recalculate it on the next client tick.

When other players are looking at a player they use a RemotePlayer which overrides that method to do nothing. So their view of the pose shouldn't get recalculated on their clients.

 

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

On 4/25/2023 at 1:43 AM, warjort said:

I don't know much about forcedPose() but...

 

If you want to set the pose so that everybody sees it, then as was said above you need to do it on the server.

That should take care of broadcasting the new pose to everybody in range of the player you changed.

 

But that won't do much for the actual player you changed. The server doesn't usually "control" players.

https://forums.minecraftforge.net/topic/119553-1192-solved-cannot-get-passengers-of-an-entity-when-there-are-multiple-instances-of-the-entity-in-the-world/#comment-524427

So you will also need to force the pose on the client for that player you changed, otherwise player.updatePlayerPose() will just reset/recalculate it on the next client tick.

When other players are looking at a player they use a RemotePlayer which overrides that method to do nothing. So their view of the pose shouldn't get recalculated on their clients.

 

ah I think I know what to do now. Thank you

Link to comment
Share on other sites

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.