NostalgiaCore/src/network/protocol/packet/ContainerSetSlotPacket.php
yefengeeeeeeeeeee 0fefb140f4 Support 0.7.0
2026-07-12 17:55:36 +08:00

38 lines
No EOL
1.2 KiB
PHP

<?php
class ContainerSetSlotPacket extends RakNetDataPacket{
public $windowid;
public $slot;
public $item;
public function pid(){
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
return ProtocolInfo4::CONTAINER_SET_SLOT_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo6::CURRENT_PROTOCOL_6){
return ProtocolInfo5::CONTAINER_SET_SLOT_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo8::CURRENT_PROTOCOL_8){
return ProtocolInfo6::CONTAINER_SET_SLOT_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
return ProtocolInfo8::CONTAINER_SET_SLOT_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
return ProtocolInfo9::CONTAINER_SET_SLOT_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
return ProtocolInfo12::CONTAINER_SET_SLOT_PACKET;
}
return ProtocolInfo::CONTAINER_SET_SLOT_PACKET;
}
public function decode(){
$this->windowid = $this->getByte();
$this->slot = $this->getShort();
$this->item = $this->getSlot();
}
public function encode(){
$this->reset();
$this->putByte($this->windowid);
$this->putShort($this->slot);
$this->putSlot($this->PROTOCOL, $this->item);
}
}