Skip to content

Commit

Permalink
Added getMinecraftVersion function in RequestNetworkSettingsPacket
Browse files Browse the repository at this point in the history
  • Loading branch information
KnosTx authored Dec 1, 2024
1 parent 3e049bd commit 96a27b8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/RequestNetworkSettingsPacket.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ class RequestNetworkSettingsPacket extends DataPacket implements ServerboundPack
public const NETWORK_ID = ProtocolInfo::REQUEST_NETWORK_SETTINGS_PACKET;

private int $protocolVersion;
private int $minecraftVersion;

/**
* @generate-create-func
*/
public static function create(int $protocolVersion) : self{
public static function create(int $protocolVersion, int $minecraftVersion) : self{
$result = new self;
$result->protocolVersion = $protocolVersion;
$result->minecraftVersion = $minecraftVersion;
return $result;
}

Expand All @@ -41,12 +43,16 @@ public function canBeSentBeforeLogin() : bool{

public function getProtocolVersion() : int{ return $this->protocolVersion; }

public function getMinecraftVersion() : int{ return $this->protocolVersion; }

protected function decodePayload(PacketSerializer $in) : void{
$this->protocolVersion = $in->getInt();
$this->minecraftVersion = $in->getInt();
}

protected function encodePayload(PacketSerializer $out) : void{
$out->putInt($this->protocolVersion);
$out->putInt($this->minecraftVersion);
}

public function handle(PacketHandlerInterface $handler) : bool{
Expand Down

0 comments on commit 96a27b8

Please sign in to comment.