Advertisement
Darker666

Minecraft packet 0x2C - Set entity properties

Sep 15th, 2013
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.88 KB | None | 0 0
  1. /***
  2. Program output as of folowing code:
  3.  
  4. Received 0x2c
  5. Setting properties (2) for entity 4d    <---- For some reason, this shows as hex. Also, it's not player entity ID
  6.     generic.movementSpeed = 0.25; (list length:0)
  7.     generic.maxHealth = 10; (list length:0)
  8. Received 0xd3                    <--- this is bullshit. It just means I'm out of sync right here
  9. ERROR: Unknown packet! (0xd3)
  10.  
  11. ---***VARIABLES***---
  12. scl = some class specialised to comunicate with minecraft (read and write variables to stream)
  13.  
  14.  
  15. ***/
  16.  
  17.         case 0x2C : {   //Entity properties array
  18.             int entity_id = 0;
  19.             int array_length = 0;
  20.             //Read entity Id and array length
  21.             scl>>entity_id;    //4 bytes read (int)
  22.             scl>>array_length; //4 bytes read (int)
  23.  
  24.             std::cout<<"Setting properties ("<<(int)array_length<<") for entity "<<(int)entity_id<<'\n';  //Setting properties (2) for entity 4d
  25.             for(int i=0; i<array_length; i++) {
  26.                 std::string m_name("");
  27.                 double value=0;
  28.                 short list_length = -1;  //-1 to make sure that the value was changed
  29.                 scl>>m_name;    //2+? bytes read (this displays correct strings like generic.Something)
  30.                 scl>>value;     //8 bytes read (values seem to be OK)
  31.                 scl>>list_length; //2 bytes - always zero so far
  32.                 std::cout<<"    "<<m_name<<" = "<<value<<"; (list length:"<<list_length<<")\n";  //generic.movementSpeed = 0.25; (list length:0)
  33.                 if(list_length>0)  //because of -1
  34.                   scl.ignore(list_length*25);  //Ignore them list items, one should be 25 bytes long
  35.             }
  36.         }
  37.  
  38. /** Whole program output: (not very iseful, just in case you were curious)
  39.  
  40. Received 0x10
  41. Held item changed to 0
  42. Received 0x4
  43. Received 0x3
  44. [CHAT] [Server] : {"text":"Hello, MXXIV."}
  45. Received 0x3
  46. [CHAT] [Server] : {"text":"The time now is 09:18 (9:18 am) and you\u0027re in wo
  47. rld \u0027world\u0027."}
  48. Received 0x3
  49. [CHAT] [Server] : {"text":"Online (2/20): Darker, MXXIV"}
  50. Received 0x3
  51. [CHAT] [Server] : {"text":"MXXIV joined the game."}
  52. Received 0x17
  53. Received 0x28
  54. Received 0x23
  55. Received 0x17
  56. Received 0x28
  57. Received 0x23
  58. Received 0xc9
  59. Received 0xc9
  60. Received 0xc9
  61. Received 0x3
  62. [CHAT] [Server] : {"text":"Welcome, MXXIV. This is spawn."}
  63. Received 0xd
  64. WARNING: Position corrected! Yaw= 0 Pitch= 0
  65. Received 0x4
  66. Received 0x68
  67. Received 0x67
  68. Received 0x67
  69. Received 0x38
  70. Packet 0x38 received.     <-- receiving chunks
  71. Column X:fffffff7 Z:13 set.
  72. Column X:fffffff8 Z:13 set.
  73. Column X:fffffff8 Z:14 set.
  74. Column X:fffffff7 Z:14 set.
  75. Column X:fffffff6 Z:14 set.
  76. Received 0x18
  77. Received 0x28
  78. Received 0x2c
  79. Setting properties (2) for entity 4d
  80.     generic.movementSpeed = 0.25; (list length:0)
  81.     generic.maxHealth = 10; (list length:0)
  82. Received 0xd3
  83. ERROR: Unknown packet! (0xd3)
  84. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement