Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dries-c committed Aug 16, 2024
1 parent f47772b commit f9bf4af
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 6 deletions.
10 changes: 8 additions & 2 deletions src/types/camera/CameraSetInstruction.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use pocketmine\nbt\tag\DoubleTag;
use pocketmine\nbt\tag\FloatTag;
use pocketmine\nbt\tag\ListTag;
use pocketmine\network\mcpe\protocol\ProtocolInfo;
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
use function count;
use function is_infinite;
Expand Down Expand Up @@ -58,7 +59,9 @@ public static function read(PacketSerializer $in) : self{
$cameraPosition = $in->readOptional($in->getVector3(...));
$rotation = $in->readOptional(fn() => CameraSetInstructionRotation::read($in));
$facingPosition = $in->readOptional($in->getVector3(...));
$viewOffset = $in->readOptional($in->getVector2(...));
if($in->getProtocolId() >= ProtocolInfo::PROTOCOL_1_21_20){
$viewOffset = $in->readOptional($in->getVector2(...));
}
$default = $in->readOptional($in->getBool(...));

return new self(
Expand Down Expand Up @@ -96,6 +99,7 @@ public static function fromNBT(CompoundTag $nbt) : self{
$cameraPosition,
$rotation,
$facingPosition,
null,
$default
);
}
Expand All @@ -106,7 +110,9 @@ public function write(PacketSerializer $out) : void{
$out->writeOptional($this->cameraPosition, $out->putVector3(...));
$out->writeOptional($this->rotation, fn(CameraSetInstructionRotation $v) => $v->write($out));
$out->writeOptional($this->facingPosition, $out->putVector3(...));
$out->writeOptional($this->viewOffset, $out->putVector2(...));
if($out->getProtocolId() >= ProtocolInfo::PROTOCOL_1_21_20){
$out->writeOptional($this->viewOffset, $out->putVector2(...));
}
$out->writeOptional($this->default, $out->putBool(...));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ final public function __construct(

public function getRecipeId() : int{ return $this->recipeId; }

public function getRepetitions() : int { return $this->repetitions; }
public function getRepetitions() : int{ return $this->repetitions; }

public function getRepetitions2() : int{ return $this->repetitions2; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final public function __construct(

public function getRecipeId() : int{ return $this->recipeId; }

public function getRepetitions() : int { return $this->repetitions; }
public function getRepetitions() : int{ return $this->repetitions; }

public static function read(PacketSerializer $in) : self{
$recipeId = $in->readRecipeNetId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __construct(

public function getCreativeItemId() : int{ return $this->creativeItemId; }

public function getRepetitions() : int { return $this->repetitions; }
public function getRepetitions() : int{ return $this->repetitions; }

public static function read(PacketSerializer $in) : self{
$creativeItemId = $in->readCreativeItemNetId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function getRecipeId() : int{ return $this->recipeId; }
/** WARNING: This may be negative */
public function getRepairCost() : int{ return $this->repairCost; }

public function getRepetitions() : int { return $this->repetitions; }
public function getRepetitions() : int{ return $this->repetitions; }

public static function read(PacketSerializer $in) : self{
$recipeId = $in->readRecipeNetId();
Expand Down
2 changes: 2 additions & 0 deletions src/types/inventory/stackrequest/ItemStackRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ private static function readAction(PacketSerializer $in, int $typeId) : ItemStac
DestroyStackRequestAction::ID => DestroyStackRequestAction::read($in),
CraftingConsumeInputStackRequestAction::ID => CraftingConsumeInputStackRequestAction::read($in),
CraftingCreateSpecificResultStackRequestAction::ID => CraftingCreateSpecificResultStackRequestAction::read($in),
PlaceIntoBundleStackRequestAction::ID => PlaceIntoBundleStackRequestAction::read($in),
TakeFromBundleStackRequestAction::ID => TakeFromBundleStackRequestAction::read($in),

Check failure on line 62 in src/types/inventory/stackrequest/ItemStackRequest.php

View workflow job for this annotation

GitHub Actions / Tests (PHP 8.1)

Access to constant ID on an unknown class pocketmine\network\mcpe\protocol\types\inventory\stackrequest\TakeFromBundleStackRequestAction.

Check failure on line 62 in src/types/inventory/stackrequest/ItemStackRequest.php

View workflow job for this annotation

GitHub Actions / Tests (PHP 8.1)

Call to static method read() on an unknown class pocketmine\network\mcpe\protocol\types\inventory\stackrequest\TakeFromBundleStackRequestAction.

Check failure on line 62 in src/types/inventory/stackrequest/ItemStackRequest.php

View workflow job for this annotation

GitHub Actions / Tests (PHP 8.2)

Access to constant ID on an unknown class pocketmine\network\mcpe\protocol\types\inventory\stackrequest\TakeFromBundleStackRequestAction.

Check failure on line 62 in src/types/inventory/stackrequest/ItemStackRequest.php

View workflow job for this annotation

GitHub Actions / Tests (PHP 8.2)

Call to static method read() on an unknown class pocketmine\network\mcpe\protocol\types\inventory\stackrequest\TakeFromBundleStackRequestAction.

Check failure on line 62 in src/types/inventory/stackrequest/ItemStackRequest.php

View workflow job for this annotation

GitHub Actions / Tests (PHP 8.3)

Access to constant ID on an unknown class pocketmine\network\mcpe\protocol\types\inventory\stackrequest\TakeFromBundleStackRequestAction.

Check failure on line 62 in src/types/inventory/stackrequest/ItemStackRequest.php

View workflow job for this annotation

GitHub Actions / Tests (PHP 8.3)

Call to static method read() on an unknown class pocketmine\network\mcpe\protocol\types\inventory\stackrequest\TakeFromBundleStackRequestAction.
LabTableCombineStackRequestAction::ID => LabTableCombineStackRequestAction::read($in),
BeaconPaymentStackRequestAction::ID => BeaconPaymentStackRequestAction::read($in),
MineBlockStackRequestAction::ID => MineBlockStackRequestAction::read($in),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ private function __construct(){
public const DESTROY = 4;
public const CRAFTING_CONSUME_INPUT = 5;
public const CRAFTING_CREATE_SPECIFIC_RESULT = 6;
public const PLACE_INTO_BUNDLE = 7;
public const TAKE_FROM_BUNDLE = 8;
public const LAB_TABLE_COMBINE = 9;
public const BEACON_PAYMENT = 10;
public const MINE_BLOCK = 11;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

/*
* This file is part of BedrockProtocol.
* Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol>
*
* BedrockProtocol is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*/

declare(strict_types=1);

namespace pocketmine\network\mcpe\protocol\types\inventory\stackrequest;

use pocketmine\network\mcpe\protocol\types\GetTypeIdFromConstTrait;

/**
* Insert an item into a bundle.
*/
final class PlaceIntoBundleStackRequestAction extends ItemStackRequestAction{
use GetTypeIdFromConstTrait;
use TakeOrPlaceStackRequestActionTrait;

public const ID = ItemStackRequestActionType::PLACE_INTO_BUNDLE;
}

0 comments on commit f9bf4af

Please sign in to comment.