Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***
- Program output as of folowing code:
- Received 0x2c
- Setting properties (2) for entity 4d <---- For some reason, this shows as hex. Also, it's not player entity ID
- generic.movementSpeed = 0.25; (list length:0)
- generic.maxHealth = 10; (list length:0)
- Received 0xd3 <--- this is bullshit. It just means I'm out of sync right here
- ERROR: Unknown packet! (0xd3)
- ---***VARIABLES***---
- scl = some class specialised to comunicate with minecraft (read and write variables to stream)
- ***/
- case 0x2C : { //Entity properties array
- int entity_id = 0;
- int array_length = 0;
- //Read entity Id and array length
- scl>>entity_id; //4 bytes read (int)
- scl>>array_length; //4 bytes read (int)
- std::cout<<"Setting properties ("<<(int)array_length<<") for entity "<<(int)entity_id<<'\n'; //Setting properties (2) for entity 4d
- for(int i=0; i<array_length; i++) {
- std::string m_name("");
- double value=0;
- short list_length = -1; //-1 to make sure that the value was changed
- scl>>m_name; //2+? bytes read (this displays correct strings like generic.Something)
- scl>>value; //8 bytes read (values seem to be OK)
- scl>>list_length; //2 bytes - always zero so far
- std::cout<<" "<<m_name<<" = "<<value<<"; (list length:"<<list_length<<")\n"; //generic.movementSpeed = 0.25; (list length:0)
- if(list_length>0) //because of -1
- scl.ignore(list_length*25); //Ignore them list items, one should be 25 bytes long
- }
- }
- /** Whole program output: (not very iseful, just in case you were curious)
- Received 0x10
- Held item changed to 0
- Received 0x4
- Received 0x3
- [CHAT] [Server] : {"text":"Hello, MXXIV."}
- Received 0x3
- [CHAT] [Server] : {"text":"The time now is 09:18 (9:18 am) and you\u0027re in wo
- rld \u0027world\u0027."}
- Received 0x3
- [CHAT] [Server] : {"text":"Online (2/20): Darker, MXXIV"}
- Received 0x3
- [CHAT] [Server] : {"text":"MXXIV joined the game."}
- Received 0x17
- Received 0x28
- Received 0x23
- Received 0x17
- Received 0x28
- Received 0x23
- Received 0xc9
- Received 0xc9
- Received 0xc9
- Received 0x3
- [CHAT] [Server] : {"text":"Welcome, MXXIV. This is spawn."}
- Received 0xd
- WARNING: Position corrected! Yaw= 0 Pitch= 0
- Received 0x4
- Received 0x68
- Received 0x67
- Received 0x67
- Received 0x38
- Packet 0x38 received. <-- receiving chunks
- Column X:fffffff7 Z:13 set.
- Column X:fffffff8 Z:13 set.
- Column X:fffffff8 Z:14 set.
- Column X:fffffff7 Z:14 set.
- Column X:fffffff6 Z:14 set.
- Received 0x18
- Received 0x28
- Received 0x2c
- Setting properties (2) for entity 4d
- generic.movementSpeed = 0.25; (list length:0)
- generic.maxHealth = 10; (list length:0)
- Received 0xd3
- ERROR: Unknown packet! (0xd3)
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement