Thanks to @ArkQuark

This commit is contained in:
yefengeeeeeeeeeee 2025-04-08 18:00:05 +08:00
parent e4538e166e
commit 490516fa04
3 changed files with 22 additions and 21 deletions

View file

@ -2829,7 +2829,6 @@ class Player{
if (EventHandler::callEvent(new DataPacketReceiveEvent($this, $packet)) === BaseEvent::DENY) {
return;
}
switch ($packet->pid()) {
case 0x01:
break;
@ -3235,6 +3234,7 @@ class Player{
$this->entity->inActionCounter = 0;
$this->entity->updateMetadata();
}
if ($this->blocked === true or ($this->entity->position instanceof Vector3 and $blockVector->distance($this->entity->position) > 10)) {
@ -3797,6 +3797,7 @@ class Player{
}
break;
case ProtocolInfo7::SEND_INVENTORY_PACKET:
console("send");
if ($this->spawned === false) {
break;
}

View file

@ -34,7 +34,7 @@ abstract class ProtocolInfo{
const MOVE_ENTITY_PACKET_POSROT = 0x93;
const ROTATE_HEAD_PACKET = 0x94;
const MOVE_PLAYER_PACKET = 0x95;
//const PLACE_BLOCK_PACKET = 0x96;
const PLACE_BLOCK_PACKET = 0x96;
const REMOVE_BLOCK_PACKET = 0x97;
const UPDATE_BLOCK_PACKET = 0x98;
const ADD_PAINTING_PACKET = 0x99;
@ -65,7 +65,7 @@ abstract class ProtocolInfo{
const CONTAINER_SET_SLOT_PACKET = 0xb2;
const CONTAINER_SET_DATA_PACKET = 0xb3;
const CONTAINER_SET_CONTENT_PACKET = 0xb4;
//const CONTAINER_ACK_PACKET = 0xb5;
const CONTAINER_ACK_PACKET = 0xb5;
const CHAT_PACKET = 0xb6;
const ADVENTURE_SETTINGS_PACKET = 0xb7;
const ENTITY_DATA_PACKET = 0xb8;
@ -111,7 +111,7 @@ abstract class ProtocolInfo12{
const MOVE_ENTITY_PACKET_POSROT = 0x93;
const ROTATE_HEAD_PACKET = 0xff;
const MOVE_PLAYER_PACKET = 0x94;
//const PLACE_BLOCK_PACKET = 0x96;
const PLACE_BLOCK_PACKET = 0x96;
const REMOVE_BLOCK_PACKET = 0x96;
const UPDATE_BLOCK_PACKET = 0x97;
const ADD_PAINTING_PACKET = 0x98;
@ -142,7 +142,7 @@ abstract class ProtocolInfo12{
const CONTAINER_SET_SLOT_PACKET = 0xb1;
const CONTAINER_SET_DATA_PACKET = 0xb2;
const CONTAINER_SET_CONTENT_PACKET = 0xb3;
//const CONTAINER_ACK_PACKET = 0xb5; //Bruh
const CONTAINER_ACK_PACKET = 0xb5; //Bruh
const CHAT_PACKET = 0xb5;
const ADVENTURE_SETTINGS_PACKET = 0xb6;
const ENTITY_DATA_PACKET = 0xb7;
@ -180,7 +180,7 @@ abstract class ProtocolInfo9{
const MOVE_ENTITY_PACKET_POSROT = 0x93;
const MOVE_PLAYER_PACKET = 0x94;
//const PLACE_BLOCK_PACKET = 0x95;
const PLACE_BLOCK_PACKET = 0x95;
const REMOVE_BLOCK_PACKET = 0x96;
const UPDATE_BLOCK_PACKET = 0x97;
const ADD_PAINTING_PACKET = 0x98;
@ -206,12 +206,12 @@ abstract class ProtocolInfo9{
const RESPAWN_PACKET = 0xab;
const SEND_INVENTORY_PACKET = 0xac;
const DROP_ITEM_PACKET = 0xad;
const CONTAINER_OPEN_PACKET = 0xae;
const CONTAINER_CLOSE_PACKET = 0xaf;
const CONTAINER_SET_SLOT_PACKET = 0xb0;
const CONTAINER_SET_DATA_PACKET = 0xb1;
const CONTAINER_SET_CONTENT_PACKET = 0xb2;
//const CONTAINER_ACK_PACKET = 0xb3;
const CONTAINER_OPEN_PACKET = 0xab;
const CONTAINER_CLOSE_PACKET = 0xac;
const CONTAINER_SET_SLOT_PACKET = 0xad;
const CONTAINER_SET_DATA_PACKET = 0xae;
const CONTAINER_SET_CONTENT_PACKET = 0xaf;
const CONTAINER_ACK_PACKET = 0xb;
const CHAT_PACKET = 0xb4;//12 change
const ADVENTURE_SETTINGS_PACKET = 0xb6;
const ENTITY_DATA_PACKET = 0xb7;
@ -252,7 +252,7 @@ abstract class ProtocolInfo7{ // MCPE 0.3 - 0.5 seem using same packet id
const MOVE_ENTITY_PACKET_POSROT = 0x93;
const MOVE_PLAYER_PACKET = 0x94;
//const PLACE_BLOCK_PACKET = 0x95;
const PLACE_BLOCK_PACKET = 0x95;
const REMOVE_BLOCK_PACKET = 0x96;
const UPDATE_BLOCK_PACKET = 0x97;
const ADD_PAINTING_PACKET = 0x98;// Maybe exist
@ -263,12 +263,12 @@ abstract class ProtocolInfo7{ // MCPE 0.3 - 0.5 seem using same packet id
const REQUEST_CHUNK_PACKET = 0x9d;
const CHUNK_DATA_PACKET = 0x9e;
const PLAYER_EQUIPMENT_PACKET = 0x9f;
//const PLAYER_ARMOR_EQUIPMENT_PACKET = 0xa0;
const PLAYER_ARMOR_EQUIPMENT_PACKET = 0xa0;
const INTERACT_PACKET = 0xa0;//Change
const USE_ITEM_PACKET = 0xa1;
const PLAYER_ACTION_PACKET = 0xa2;
//const HURT_ARMOR_PACKET = 0xa3;
const HURT_ARMOR_PACKET = 0xa3;
const SET_ENTITY_DATA_PACKET = 0xa3;
const SET_ENTITY_MOTION_PACKET = 0xa4;
//const SET_ENTITY_LINK_PACKET = 0xa?;
@ -281,13 +281,13 @@ abstract class ProtocolInfo7{ // MCPE 0.3 - 0.5 seem using same packet id
const CONTAINER_OPEN_PACKET = 0xab;
const CONTAINER_CLOSE_PACKET = 0xac;
const CONTAINER_SET_SLOT_PACKET = 0xad;
//const CONTAINER_SET_DATA_PACKET = 0xb1;
//const CONTAINER_SET_CONTENT_PACKET = 0xb2;
//const CONTAINER_ACK_PACKET = 0xb3;
const CONTAINER_SET_DATA_PACKET = 0xae;
const CONTAINER_SET_CONTENT_PACKET = 0xaf;
const CONTAINER_ACK_PACKET = 0xb;
const CHAT_PACKET = 0xb1;//12 change
const ADVENTURE_SETTINGS_PACKET = 0xb3;
const ENTITY_DATA_PACKET = 0xb2;
//const PLAYER_INPUT_PACKET = 0xb9;
const PLAYER_INPUT_PACKET = 0xb9;
}
/***REM_START***/
require_once(FILE_PATH . "src/network/raknet/RakNetDataPacket.php");

View file

@ -17,7 +17,7 @@ class PlayerEquipmentPacket extends RakNetDataPacket{
$this->eid = $this->getInt();
$this->item = $this->getShort();
$this->meta = $this->getShort();
$this->slot = $this->getSignedByte();
if($this->PROTOCOL === ProtocolInfo::CURRENT_PROTOCOL){$this->slot = $this->getSignedByte();}
}
public function encode(){
@ -25,7 +25,7 @@ class PlayerEquipmentPacket extends RakNetDataPacket{
$this->putInt($this->eid);
$this->putShort($this->item);
$this->putShort($this->meta);
$this->putByte($this->slot);
if($this->PROTOCOL === ProtocolInfo::CURRENT_PROTOCOL){$this->putByte($this->slot);}
}
}