Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.7.10: Player name tags show as MISSING #141

Closed
iceiix opened this issue May 11, 2019 · 3 comments
Closed

1.7.10: Player name tags show as MISSING #141

iceiix opened this issue May 11, 2019 · 3 comments
Labels
bug Something isn't working

Comments

@iceiix
Copy link
Owner

iceiix commented May 11, 2019

Screen Shot 2019-05-10 at 6 38 41 PM

// src/server/mod.rs
        let entity = entity::player::create_remote(&mut self.entities, 
self.players.get(&uuid).map_or("MISSING", |v| &v.name));

Broken in 1.7.10, works in 1.8.9+

@iceiix iceiix added the bug Something isn't working label May 11, 2019
@iceiix
Copy link
Owner Author

iceiix commented May 19, 2019

self.players on empty when accessed in on_player_spawn, expected to be populated with on_player_info but it is different for 1.7, this bug corresponds to this comment:

    fn on_player_info_string(&mut self, _player_info: packet::play::clientbound::PlayerInfo_String) {
          // TODO: support PlayerInfo_String for 1.7
      }
  
      fn on_player_info(&mut self, player_info: packet::play::clientbound::PlayerInfo) {

https://wiki.vg/index.php?title=Protocol&oldid=6003#Player_List_Item

            packet PlayerInfo_String {
                field name: String =,
                field online: bool =,
                field ping: u16 =,
            }

translates to online=false Remove, ping=UpdateLatency, but what about uuid? It is not in this packet, only the player name.

@iceiix iceiix changed the title 1.7.10: Player name tags show as MISSING 1.7.10: Player name tags show as MISSING (handle PlayerInfo_String packet) May 19, 2019
@iceiix
Copy link
Owner Author

iceiix commented Jan 18, 2021

Something broke? Testing on 1.7.10 with master branch 56f9c0e (56f9c0e), I only see a disembodied head, no name tag not even MISSING:

Screen Shot 2021-01-18 at 10 46 38 AM

There were changes to src/render: https://github.com/iceiix/stevenarella/commits/master/src/render

Reverting back to 710a773 (Tue Nov 24 19:35:55 2020), the full model appears (with MISSING name tag, as expected due to this bug).

Testing on 0aa062f (Fri Dec 25 10:00:22 2020), which is the commit that introduced the port to glow, this disembodiment problem does reproduce. Was it introduced with #262?

Reverting to the previous commit before glow, 9700ffe (Sun Dec 20 16:21:02 2020), the player model is intact. So it does look like #262 broke it.

Maybe set_float_multi_raw() The change to this call was sketchy. Commenting it out, no model shown at all, not even the player head.

Aha, the wrong length is passed to from_raw_parts(). It should be times 4 * 4, for the matrix size. This works:

    #[allow(clippy::missing_safety_doc)]
    pub unsafe fn set_float_multi_raw(&self, data: *const f32, len: usize) {
        glow_context().uniform_4_f32_slice(Some(&self.0), std::slice::from_raw_parts(data, len * 4 * 4));

iceiix added a commit that referenced this issue Jan 18, 2021
Regression introduced in #262 by the glow port, correct the raw size to
account for the matrix. See #141 (comment)
iceiix added a commit that referenced this issue Jan 18, 2021
Regression introduced in #262 by the glow port, correct the raw size to
include all elements in set_float_multi().

See #141 (comment)
@iceiix
Copy link
Owner Author

iceiix commented Jan 18, 2021

Back to the original issue of the MISSING name tag, here is the problem. In 1.7.10:

post-1.7.10:

both PlayerInfo packets are meant to "update the user list (<tab> in the client).", and both SpawnPlayers packets are for creating the client-side entity for the player when they come in range.

We keep track of players in the Server struct, field players: HashMap<protocol::UUID, PlayerInfo.... PlayerInfo is defined thusly:

pub struct PlayerInfo {
    name: String,
    uuid: protocol::UUID,
    skin_url: Option<String>,

    display_name: Option<format::Component>,
    ping: i32,
    gamemode: Gamemode,
}

Is this players list supposed to be the player entities in range, or all the players on the server?

We don't have the <tab> online player list yet, but if we did, on 1.7.10 it couldn't use: uuid, skin_url, display_name, or gamemode because these fields aren't available in the PlayerInfo_String packet. And we can't even set or get from self.players because the hash map is keyed by the uuid.

Perhaps the solution is to have a separate self.online_players list, with only player names and pings, for the tab list, and use self.players for 1) nearby players, 1.7.10, and 2) all players, >1.7.10. Post-1.7.10, populate both lists. In on_player_spawn_i32_helditem_string(), populate self.players before calling the generic on_player_spawn() handler (which calls entity::player::create_remote with PlayerInfo looked by uuid).

Thinking through other alternatives: change most of the fields of self.player PlayerInfo to be Options, and PlayerInfo_String would leave most of them None, then SpawnPlayer_i32_HeldItem_String updates them. To allow this, would have to change self.players from a HashMap to a Vec, then iterate to lookup by UUID or name: slower, but shouldn't be that much slower given the number of players.

@iceiix iceiix changed the title 1.7.10: Player name tags show as MISSING (handle PlayerInfo_String packet) 1.7.10: Player name tags show as MISSING Jan 18, 2021
@iceiix iceiix closed this as completed in 0b4c56b Jan 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant