Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[HELP] The data type of client ID

Comments in 'Plugin Development' started by PEMapModder, May 16, 2014.

  1. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I don't have a lot of samples, so I cannot test.

    But can anyone tell me the data type of the client ID of an MCPE client? Signed or not signed (will it be negative) long, int or short is the best for saving it with low memory usage? (I am making a single-file database with binary data saving with Utils::writeLong() etc.)
    iJoshuaHD likes this.
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Like?
  3. wies
    Offline

    wies Notable Member

    Joined:
    Aug 23, 2013
    Posts:
    390
    Do you mean the entity id? That's an unsigned long (32 bit, big endian byte order)
    PEMapModder likes this.
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Client ID, the one sent from the MCPE client. ($clientID at Player::__construct())

    Entity ID is the one by the server.
  5. wies
    Offline

    wies Notable Member

    Joined:
    Aug 23, 2013
    Posts:
    390
    Oh ok, it's a 64 bit unsigned integer: http://wiki.vg/Pocket_Minecraft_Protocol
    PEMapModder likes this.
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
  7. wies
    Offline

    wies Notable Member

    Joined:
    Aug 23, 2013
    Posts:
    390
    Yes, but in the mcpe protocol documentation they call it an integer.
  8. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Wow v0.7.3 #11
    wies likes this.
  9. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I saw it call double too. Then should I use Utils::writeDouble() or Utils::writeLong()?
    wies likes this.
  10. wies
    Offline

    wies Notable Member

    Joined:
    Aug 23, 2013
    Posts:
    390
    I'm not sure about that. writeDouble() just uses the pack() function of php which size is system dependent, writeLong() uses a method that I can't understand but looks like a non system dependent double (64 bit). I would go for writeLong()
    PEMapModder likes this.
  11. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Thanks!

Share This Page

Advertisement