Skip to content

Commit

Permalink
Fix invalid FullContainerName
Browse files Browse the repository at this point in the history
  • Loading branch information
AkmalFairuz committed Sep 20, 2024
1 parent c38c1a0 commit 6128c9d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/InventoryContentPacket.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected function encodePayload(PacketSerializer $out) : void{
if($out->getProtocol() >= ProtocolInfo::PROTOCOL_729){
$this->containerName->write($out);
$out->putUnsignedVarInt($this->dynamicContainerSize);
}else {
}else{
$out->putUnsignedVarInt($this->containerName->getDynamicId());
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/ProtocolInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ private function __construct(){
/** Actual Minecraft: PE protocol version */
public const CURRENT_PROTOCOL = 729;
/** Current Minecraft PE version reported by the server. This is usually the earliest currently supported version. */
public const MINECRAFT_VERSION = 'v1.21.20';
public const MINECRAFT_VERSION = 'v1.21.30';
/** Version number sent to clients in ping responses. */
public const MINECRAFT_VERSION_NETWORK = '1.21.20';
public const MINECRAFT_VERSION_NETWORK = '1.21.30';

public const BASE_VERSION = '1.18.0';

Expand Down
4 changes: 2 additions & 2 deletions src/TransferPacket.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ class TransferPacket extends DataPacket implements ClientboundPacket{

public string $address;
public int $port = 19132;
public bool $reloadWorld = true;
public bool $reloadWorld = false;

/**
* @generate-create-func
*/
public static function create(string $address, int $port, bool $reloadWorld = true) : self{
public static function create(string $address, int $port, bool $reloadWorld = false) : self{
$result = new self;
$result->address = $address;
$result->port = $port;
Expand Down
8 changes: 4 additions & 4 deletions src/types/inventory/FullContainerName.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@
final class FullContainerName{
public function __construct(
private int $containerId,
private int $dynamicId = 0
private ?int $dynamicId = null
){}

public function getContainerId() : int{ return $this->containerId; }

public function getDynamicId() : int{ return $this->dynamicId; }
public function getDynamicId() : ?int{ return $this->dynamicId; }

public static function read(PacketSerializer $in) : self{
$containerId = $in->getByte();
$dynamicId = $in->getLInt();
$dynamicId = $in->readOptional($in->getLInt(...));
return new self($containerId, $dynamicId);
}

public function write(PacketSerializer $out) : void{
$out->putByte($this->containerId);
$out->putLInt($this->dynamicId);
$out->writeOptional($this->dynamicId, $out->putLInt(...));
}
}

0 comments on commit 6128c9d

Please sign in to comment.