diff --git a/composer.lock b/composer.lock index a54965a7f..965fe8c56 100644 --- a/composer.lock +++ b/composer.lock @@ -530,12 +530,12 @@ "source": { "type": "git", "url": "https://github.com/pmmp/NBT.git", - "reference": "f2517ec187a8306a3d3f594bf06a7c828645b9d7" + "reference": "6b2234572b5d06a0532e3851e72bdc108e0c4387" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/NBT/zipball/f2517ec187a8306a3d3f594bf06a7c828645b9d7", - "reference": "f2517ec187a8306a3d3f594bf06a7c828645b9d7", + "url": "https://api.github.com/repos/pmmp/NBT/zipball/6b2234572b5d06a0532e3851e72bdc108e0c4387", + "reference": "6b2234572b5d06a0532e3851e72bdc108e0c4387", "shasum": "" }, "require": { @@ -559,7 +559,7 @@ "LGPL-3.0" ], "description": "PHP library for working with Named Binary Tags", - "time": "2020-03-04T18:52:35+00:00" + "time": "2020-04-15T11:29:45+00:00" }, { "name": "pocketmine/raklib", @@ -760,6 +760,20 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://www.patreon.com/phpstan", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", + "type": "tidelift" + } + ], "time": "2020-03-22T16:51:47+00:00" }, { @@ -911,5 +925,6 @@ "ext-zip": "*", "ext-zlib": ">=1.2.11" }, - "platform-dev": [] + "platform-dev": [], + "plugin-api-version": "1.1.0" } diff --git a/src/network/mcpe/protocol/ActorEventPacket.php b/src/network/mcpe/protocol/ActorEventPacket.php index 292a0fcbf..14e1ff457 100644 --- a/src/network/mcpe/protocol/ActorEventPacket.php +++ b/src/network/mcpe/protocol/ActorEventPacket.php @@ -31,10 +31,11 @@ use pocketmine\network\mcpe\serializer\NetworkBinaryStream; class ActorEventPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{ public const NETWORK_ID = ProtocolInfo::ACTOR_EVENT_PACKET; + public const JUMP = 1; public const HURT_ANIMATION = 2; public const DEATH_ANIMATION = 3; public const ARM_SWING = 4; - + public const STOP_ATTACK = 5; public const TAME_FAIL = 6; public const TAME_SUCCESS = 7; public const SHAKE_WET = 8; @@ -51,16 +52,18 @@ class ActorEventPacket extends DataPacket implements ClientboundPacket, Serverbo public const IRON_GOLEM_OFFER_FLOWER = 19; public const IRON_GOLEM_WITHDRAW_FLOWER = 20; public const LOVE_PARTICLES = 21; //breeding - + public const VILLAGER_ANGRY = 22; + public const VILLAGER_HAPPY = 23; public const WITCH_SPELL_PARTICLES = 24; public const FIREWORK_PARTICLES = 25; - + public const IN_LOVE_PARTICLES = 26; public const SILVERFISH_SPAWN_ANIMATION = 27; - + public const GUARDIAN_ATTACK = 28; public const WITCH_DRINK_POTION = 29; public const WITCH_THROW_POTION = 30; public const MINECART_TNT_PRIME_FUSE = 31; - + public const CREEPER_PRIME_FUSE = 32; + public const AIR_SUPPLY_EXPIRED = 33; public const PLAYER_ADD_XP_LEVELS = 34; public const ELDER_GUARDIAN_CURSE = 35; public const AGENT_ARM_SWING = 36; @@ -80,6 +83,11 @@ class ActorEventPacket extends DataPacket implements ClientboundPacket, Serverbo public const ENTITY_SPAWN = 67; //used for MinecraftEventing stuff, not needed public const DRAGON_PUKE = 68; //they call this puke particles public const ITEM_ENTITY_MERGE = 69; + public const START_SWIM = 70; + public const BALLOON_POP = 71; + public const TREASURE_HUNT = 72; + public const AGENT_SUMMON = 73; + public const CHARGED_CROSSBOW = 74; //TODO: add more events diff --git a/src/network/mcpe/protocol/AnimatePacket.php b/src/network/mcpe/protocol/AnimatePacket.php index 58a910a80..ea64998b5 100644 --- a/src/network/mcpe/protocol/AnimatePacket.php +++ b/src/network/mcpe/protocol/AnimatePacket.php @@ -35,6 +35,7 @@ class AnimatePacket extends DataPacket implements ClientboundPacket, Serverbound public const ACTION_STOP_SLEEP = 3; public const ACTION_CRITICAL_HIT = 4; + public const ACTION_MAGICAL_CRITICAL_HIT = 5; public const ACTION_ROW_RIGHT = 128; public const ACTION_ROW_LEFT = 129; diff --git a/src/network/mcpe/protocol/InteractPacket.php b/src/network/mcpe/protocol/InteractPacket.php index 38c8e2a2b..1260665df 100644 --- a/src/network/mcpe/protocol/InteractPacket.php +++ b/src/network/mcpe/protocol/InteractPacket.php @@ -33,7 +33,7 @@ class InteractPacket extends DataPacket implements ServerboundPacket{ public const ACTION_LEAVE_VEHICLE = 3; public const ACTION_MOUSEOVER = 4; - + public const ACTION_OPEN_NPC = 5; public const ACTION_OPEN_INVENTORY = 6; /** @var int */ diff --git a/src/network/mcpe/protocol/LabTablePacket.php b/src/network/mcpe/protocol/LabTablePacket.php index 801c7d50e..fcf24bb5f 100644 --- a/src/network/mcpe/protocol/LabTablePacket.php +++ b/src/network/mcpe/protocol/LabTablePacket.php @@ -31,8 +31,12 @@ use pocketmine\network\mcpe\serializer\NetworkBinaryStream; class LabTablePacket extends DataPacket implements ClientboundPacket, ServerboundPacket{ public const NETWORK_ID = ProtocolInfo::LAB_TABLE_PACKET; + public const TYPE_START_COMBINE = 0; + public const TYPE_START_REACTION = 1; + public const TYPE_RESET = 2; + /** @var int */ - public $uselessByte; //0 for client -> server, 1 for server -> client. Seems useless. + public $type; /** @var int */ public $x; @@ -45,13 +49,13 @@ class LabTablePacket extends DataPacket implements ClientboundPacket, Serverboun public $reactionType; protected function decodePayload(NetworkBinaryStream $in) : void{ - $this->uselessByte = $in->getByte(); + $this->type = $in->getByte(); $in->getSignedBlockPosition($this->x, $this->y, $this->z); $this->reactionType = $in->getByte(); } protected function encodePayload(NetworkBinaryStream $out) : void{ - $out->putByte($this->uselessByte); + $out->putByte($this->type); $out->putSignedBlockPosition($this->x, $this->y, $this->z); $out->putByte($this->reactionType); } diff --git a/src/network/mcpe/protocol/StructureBlockUpdatePacket.php b/src/network/mcpe/protocol/StructureBlockUpdatePacket.php index 69e258de5..f139c6e09 100644 --- a/src/network/mcpe/protocol/StructureBlockUpdatePacket.php +++ b/src/network/mcpe/protocol/StructureBlockUpdatePacket.php @@ -26,17 +26,33 @@ namespace pocketmine\network\mcpe\protocol; #include use pocketmine\network\mcpe\handler\PacketHandler; +use pocketmine\network\mcpe\protocol\types\StructureEditorData; use pocketmine\network\mcpe\serializer\NetworkBinaryStream; class StructureBlockUpdatePacket extends DataPacket implements ServerboundPacket{ public const NETWORK_ID = ProtocolInfo::STRUCTURE_BLOCK_UPDATE_PACKET; + /** @var int */ + public $x; + /** @var int */ + public $y; + /** @var int */ + public $z; + /** @var StructureEditorData */ + public $structureEditorData; + /** @var bool */ + public $isPowered; + protected function decodePayload(NetworkBinaryStream $in) : void{ - //TODO + $in->getBlockPosition($this->x, $this->y, $this->z); + $this->structureEditorData = $in->getStructureEditorData(); + $this->isPowered = $in->getBool(); } protected function encodePayload(NetworkBinaryStream $out) : void{ - //TODO + $out->putBlockPosition($this->x, $this->y, $this->z); + $out->putStructureEditorData($this->structureEditorData); + $out->putBool($this->isPowered); } public function handle(PacketHandler $handler) : bool{ diff --git a/src/network/mcpe/protocol/UpdateEquipPacket.php b/src/network/mcpe/protocol/UpdateEquipPacket.php index 3c155c611..61629a037 100644 --- a/src/network/mcpe/protocol/UpdateEquipPacket.php +++ b/src/network/mcpe/protocol/UpdateEquipPacket.php @@ -36,7 +36,7 @@ class UpdateEquipPacket extends DataPacket implements ClientboundPacket{ /** @var int */ public $windowType; /** @var int */ - public $unknownVarint; //TODO: find out what this is (vanilla always sends 0) + public $windowSlotCount; //useless, seems to be part of a standard container header /** @var int */ public $entityUniqueId; /** @var string */ @@ -45,7 +45,7 @@ class UpdateEquipPacket extends DataPacket implements ClientboundPacket{ protected function decodePayload(NetworkBinaryStream $in) : void{ $this->windowId = $in->getByte(); $this->windowType = $in->getByte(); - $this->unknownVarint = $in->getVarInt(); + $this->windowSlotCount = $in->getVarInt(); $this->entityUniqueId = $in->getEntityUniqueId(); $this->namedtag = $in->getRemaining(); } @@ -53,7 +53,7 @@ class UpdateEquipPacket extends DataPacket implements ClientboundPacket{ protected function encodePayload(NetworkBinaryStream $out) : void{ $out->putByte($this->windowId); $out->putByte($this->windowType); - $out->putVarInt($this->unknownVarint); + $out->putVarInt($this->windowSlotCount); $out->putEntityUniqueId($this->entityUniqueId); $out->put($this->namedtag); } diff --git a/src/network/mcpe/protocol/UpdateTradePacket.php b/src/network/mcpe/protocol/UpdateTradePacket.php index 6fc84a9c1..a97bbcb57 100644 --- a/src/network/mcpe/protocol/UpdateTradePacket.php +++ b/src/network/mcpe/protocol/UpdateTradePacket.php @@ -39,7 +39,7 @@ class UpdateTradePacket extends DataPacket implements ClientboundPacket{ /** @var int */ public $windowType = WindowTypes::TRADING; //Mojang hardcoded this -_- /** @var int */ - public $thisIsAlwaysZero = 0; //hardcoded to 0 + public $windowSlotCount = 0; //useless, seems to be part of a standard container header /** @var int */ public $tradeTier; /** @var int */ @@ -58,7 +58,7 @@ class UpdateTradePacket extends DataPacket implements ClientboundPacket{ protected function decodePayload(NetworkBinaryStream $in) : void{ $this->windowId = $in->getByte(); $this->windowType = $in->getByte(); - $this->thisIsAlwaysZero = $in->getVarInt(); + $this->windowSlotCount = $in->getVarInt(); $this->tradeTier = $in->getVarInt(); $this->traderEid = $in->getEntityUniqueId(); $this->playerEid = $in->getEntityUniqueId(); @@ -71,7 +71,7 @@ class UpdateTradePacket extends DataPacket implements ClientboundPacket{ protected function encodePayload(NetworkBinaryStream $out) : void{ $out->putByte($this->windowId); $out->putByte($this->windowType); - $out->putVarInt($this->thisIsAlwaysZero); + $out->putVarInt($this->windowSlotCount); $out->putVarInt($this->tradeTier); $out->putEntityUniqueId($this->traderEid); $out->putEntityUniqueId($this->playerEid); diff --git a/src/network/mcpe/protocol/types/StructureEditorData.php b/src/network/mcpe/protocol/types/StructureEditorData.php new file mode 100644 index 000000000..9e7f04263 --- /dev/null +++ b/src/network/mcpe/protocol/types/StructureEditorData.php @@ -0,0 +1,48 @@ +mirror = $this->getByte(); $result->integrityValue = $this->getFloat(); $result->integritySeed = $this->getInt(); + $result->pivot = $this->getVector3(); return $result; } @@ -662,5 +664,34 @@ class NetworkBinaryStream extends BinaryStream{ $this->putByte($structureSettings->mirror); $this->putFloat($structureSettings->integrityValue); $this->putInt($structureSettings->integritySeed); + $this->putVector3($structureSettings->pivot); + } + + public function getStructureEditorData() : StructureEditorData{ + $result = new StructureEditorData(); + + $result->structureName = $this->getString(); + $result->structureDataField = $this->getString(); + + $result->includePlayers = $this->getBool(); + $result->showBoundingBox = $this->getBool(); + + $result->structureBlockType = $this->getVarInt(); + $result->structureSettings = $this->getStructureSettings(); + $result->structureRedstoneSaveMove = $this->getVarInt(); + + return $result; + } + + public function putStructureEditorData(StructureEditorData $structureEditorData) : void{ + $this->putString($structureEditorData->structureName); + $this->putString($structureEditorData->structureDataField); + + $this->putBool($structureEditorData->includePlayers); + $this->putBool($structureEditorData->showBoundingBox); + + $this->putVarInt($structureEditorData->structureBlockType); + $this->putStructureSettings($structureEditorData->structureSettings); + $this->putVarInt($structureEditorData->structureRedstoneSaveMove); } }