ContainerAckPacket implement

This commit is contained in:
yefengeeeeeeeeeee 2025-04-28 17:56:50 +08:00
parent 1eceb700c2
commit a992bb614c
3 changed files with 48 additions and 2 deletions

View file

@ -57,6 +57,7 @@ class PacketPool{
self::registerPacket(ContainerSetContentPacket::class);
self::registerPacket(ContainerSetDataPacket::class);
self::registerPacket(ContainerSetSlotPacket::class);
self::registerPacket(ContainerAckPacket::class);
self::registerPacket(DisconnectPacket::class);
self::registerPacket(DropItemPacket::class);

View file

@ -73,7 +73,6 @@ abstract class ProtocolInfo{
}
/*Unused:
* 0xb5
* 0x96
* 0x17
* 0x14
@ -142,7 +141,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 = 0xb4;
const CHAT_PACKET = 0xb5;
const ADVENTURE_SETTINGS_PACKET = 0xb6;
const ENTITY_DATA_PACKET = 0xb7;

View file

@ -0,0 +1,46 @@
<?php
class ContainerAckPacket extends RakNetDataPacket{
public $unknwonubyte1;
public $unknownshort;
public $write1;
public $write0;
public function pid(){
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
return ProtocolInfo4::CONTAINER_ACK_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
return ProtocolInfo5::CONTAINER_ACK_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
return ProtocolInfo7::CONTAINER_ACK_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
return ProtocolInfo9::CONTAINER_ACK_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
return ProtocolInfo12::CONTAINER_ACK_PACKET;
}
return ProtocolInfo::CONTAINER_ACK_PACKET;
}
public function decode(){
$this->unknwonubyte1 = $this->getByte();
$this->unknownshort = $this->getShort();
$this->write1 = $this->get();
$this->write0 = $this->get();
ConsoleAPI::debug($this->unknwonubyte1);
ConsoleAPI::debug($this->unknownshort);
ConsoleAPI::debug($this->write1);
ConsoleAPI::debug($this->write0);
}
public function encode(){
$this->putByte($this->unknwonubyte1);
$this->putShort($this->unknownshort);
$this->put($this->write1);
$this->put($this->write0);
ConsoleAPI::debug($this->unknwonubyte1);
ConsoleAPI::debug($this->unknownshort);
ConsoleAPI::debug($this->write1);
ConsoleAPI::debug($this->write0);
}
}