-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redesign ItemStack extraData handling, nuke PacketSerializerContext
the shield stuff can be handled on the PM side by TypeConverter if this is needed.
- Loading branch information
Showing
8 changed files
with
136 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?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; | ||
|
||
use pocketmine\nbt\tag\CompoundTag; | ||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer; | ||
|
||
/** | ||
* Extension of ItemStackExtraData for shield items, which have an additional field for the blocking tick. | ||
*/ | ||
final class ItemStackExtraDataShield extends ItemStackExtraData{ | ||
|
||
/** | ||
* @param string[] $canPlaceOn | ||
* @param string[] $canDestroy | ||
*/ | ||
public function __construct( | ||
?CompoundTag $nbt, | ||
array $canPlaceOn, | ||
array $canDestroy, | ||
private int $blockingTick | ||
){ | ||
parent::__construct($nbt, $canPlaceOn, $canDestroy); | ||
} | ||
|
||
public function getBlockingTick() : int{ return $this->blockingTick; } | ||
|
||
public static function read(PacketSerializer $in) : self{ | ||
$base = parent::read($in); | ||
$blockingTick = $in->getLLong(); | ||
|
||
return new self($base->getNbt(), $base->getCanPlaceOn(), $base->getCanDestroy(), $blockingTick); | ||
} | ||
|
||
public function write(PacketSerializer $out) : void{ | ||
parent::write($out); | ||
$out->putLLong($this->blockingTick); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters