protocol: remove final remaining Vector3 mutations

this really should be replaced with a network layer BlockPos structure in the absence of a general int-vector structure in math.
This commit is contained in:
Dylan K. Taylor 2020-09-25 17:41:12 +01:00
parent a5e21bfaa9
commit 7c192f85e2
2 changed files with 6 additions and 5 deletions

View File

@ -44,9 +44,9 @@ final class BlockPosMetadataProperty implements MetadataProperty{
}
public static function read(PacketSerializer $in) : self{
$vec = new Vector3(0, 0, 0);
$in->getSignedBlockPosition($vec->x, $vec->y, $vec->z);
return new self($vec);
$x = $y = $z = 0;
$in->getSignedBlockPosition($x, $y, $z);
return new self(new Vector3($x, $y, $z));
}
public function write(PacketSerializer $out) : void{

View File

@ -87,8 +87,9 @@ class UseItemTransactionData extends TransactionData{
protected function decodeData(PacketSerializer $stream) : void{
$this->actionType = $stream->getUnsignedVarInt();
$this->blockPos = new Vector3(0, 0, 0);
$stream->getBlockPosition($this->blockPos->x, $this->blockPos->y, $this->blockPos->z);
$x = $y = $z = 0;
$stream->getBlockPosition($x, $y, $z);
$this->blockPos = new Vector3($x, $y, $z);
$this->face = $stream->getVarInt();
$this->hotbarSlot = $stream->getVarInt();
$this->itemInHand = $stream->getSlot();