mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Protocol changes for 1.8.0 release
This commit is contained in:
parent
f704061618
commit
30f5a8fac6
@ -120,6 +120,7 @@ use pocketmine\network\mcpe\protocol\MobEffectPacket;
|
|||||||
use pocketmine\network\mcpe\protocol\MobEquipmentPacket;
|
use pocketmine\network\mcpe\protocol\MobEquipmentPacket;
|
||||||
use pocketmine\network\mcpe\protocol\ModalFormRequestPacket;
|
use pocketmine\network\mcpe\protocol\ModalFormRequestPacket;
|
||||||
use pocketmine\network\mcpe\protocol\MovePlayerPacket;
|
use pocketmine\network\mcpe\protocol\MovePlayerPacket;
|
||||||
|
use pocketmine\network\mcpe\protocol\NetworkChunkPublisherUpdatePacket;
|
||||||
use pocketmine\network\mcpe\protocol\PlayerActionPacket;
|
use pocketmine\network\mcpe\protocol\PlayerActionPacket;
|
||||||
use pocketmine\network\mcpe\protocol\PlayStatusPacket;
|
use pocketmine\network\mcpe\protocol\PlayStatusPacket;
|
||||||
use pocketmine\network\mcpe\protocol\ProtocolInfo;
|
use pocketmine\network\mcpe\protocol\ProtocolInfo;
|
||||||
@ -1149,6 +1150,14 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->loadQueue = $newOrder;
|
$this->loadQueue = $newOrder;
|
||||||
|
if(!empty($this->loadQueue) or !empty($unloadChunks)){
|
||||||
|
$pk = new NetworkChunkPublisherUpdatePacket();
|
||||||
|
$pk->x = $this->getFloorX();
|
||||||
|
$pk->y = $this->getFloorY();
|
||||||
|
$pk->z = $this->getFloorZ();
|
||||||
|
$pk->radius = $this->viewDistance * 16; //blocks, not chunks >.>
|
||||||
|
$this->dataPacket($pk);
|
||||||
|
}
|
||||||
|
|
||||||
Timings::$playerChunkOrderTimer->stopTiming();
|
Timings::$playerChunkOrderTimer->stopTiming();
|
||||||
}
|
}
|
||||||
|
@ -435,6 +435,7 @@ abstract class Liquid extends Transparent{
|
|||||||
$ev->call();
|
$ev->call();
|
||||||
if(!$ev->isCancelled()){
|
if(!$ev->isCancelled()){
|
||||||
$this->level->setBlock($this, $ev->getNewState(), true, true);
|
$this->level->setBlock($this, $ev->getNewState(), true, true);
|
||||||
|
//TODO: recheck this (it doesn't work in MCPE 1.8)
|
||||||
$this->level->broadcastLevelSoundEvent($this->add(0.5, 0.5, 0.5), LevelSoundEventPacket::SOUND_FIZZ, (int) ((2.6 + (lcg_value() - lcg_value()) * 0.8) * 1000));
|
$this->level->broadcastLevelSoundEvent($this->add(0.5, 0.5, 0.5), LevelSoundEventPacket::SOUND_FIZZ, (int) ((2.6 + (lcg_value() - lcg_value()) * 0.8) * 1000));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -71,8 +71,9 @@ interface EntityIds{
|
|||||||
public const ENDER_DRAGON = 53;
|
public const ENDER_DRAGON = 53;
|
||||||
public const SHULKER = 54;
|
public const SHULKER = 54;
|
||||||
public const ENDERMITE = 55;
|
public const ENDERMITE = 55;
|
||||||
public const LEARN_TO_CODE_MASCOT = 56;
|
public const AGENT = 56, LEARN_TO_CODE_MASCOT = 56;
|
||||||
public const VINDICATOR = 57;
|
public const VINDICATOR = 57;
|
||||||
|
public const PHANTOM = 58;
|
||||||
|
|
||||||
public const ARMOR_STAND = 61;
|
public const ARMOR_STAND = 61;
|
||||||
public const TRIPOD_CAMERA = 62;
|
public const TRIPOD_CAMERA = 62;
|
||||||
@ -86,8 +87,9 @@ interface EntityIds{
|
|||||||
public const EYE_OF_ENDER_SIGNAL = 70;
|
public const EYE_OF_ENDER_SIGNAL = 70;
|
||||||
public const ENDER_CRYSTAL = 71;
|
public const ENDER_CRYSTAL = 71;
|
||||||
public const FIREWORKS_ROCKET = 72;
|
public const FIREWORKS_ROCKET = 72;
|
||||||
public const TRIDENT = 73;
|
public const THROWN_TRIDENT = 73, TRIDENT = 73;
|
||||||
|
public const TURTLE = 74;
|
||||||
|
public const CAT = 75;
|
||||||
public const SHULKER_BULLET = 76;
|
public const SHULKER_BULLET = 76;
|
||||||
public const FISHING_HOOK = 77;
|
public const FISHING_HOOK = 77;
|
||||||
public const CHALKBOARD = 78;
|
public const CHALKBOARD = 78;
|
||||||
@ -97,7 +99,7 @@ interface EntityIds{
|
|||||||
public const EGG = 82;
|
public const EGG = 82;
|
||||||
public const PAINTING = 83;
|
public const PAINTING = 83;
|
||||||
public const MINECART = 84;
|
public const MINECART = 84;
|
||||||
public const LARGE_FIREBALL = 85;
|
public const FIREBALL = 85, LARGE_FIREBALL = 85;
|
||||||
public const SPLASH_POTION = 86;
|
public const SPLASH_POTION = 86;
|
||||||
public const ENDER_PEARL = 87;
|
public const ENDER_PEARL = 87;
|
||||||
public const LEASH_KNOT = 88;
|
public const LEASH_KNOT = 88;
|
||||||
@ -122,6 +124,7 @@ interface EntityIds{
|
|||||||
public const PUFFERFISH = 108;
|
public const PUFFERFISH = 108;
|
||||||
public const SALMON = 109;
|
public const SALMON = 109;
|
||||||
public const DROWNED = 110;
|
public const DROWNED = 110;
|
||||||
public const TROPICAL_FISH = 111;
|
public const TROPICALFISH = 111, TROPICAL_FISH = 111;
|
||||||
public const FISH = 112;
|
public const COD = 112, FISH = 112;
|
||||||
|
public const PANDA = 113;
|
||||||
}
|
}
|
||||||
|
@ -450,7 +450,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
|||||||
|
|
||||||
private function playLevelUpSound(int $newLevel) : void{
|
private function playLevelUpSound(int $newLevel) : void{
|
||||||
$volume = 0x10000000 * (min(30, $newLevel) / 5); //No idea why such odd numbers, but this works...
|
$volume = 0x10000000 * (min(30, $newLevel) / 5); //No idea why such odd numbers, but this works...
|
||||||
$this->level->broadcastLevelSoundEvent($this, LevelSoundEventPacket::SOUND_LEVELUP, 1, (int) $volume);
|
$this->level->broadcastLevelSoundEvent($this, LevelSoundEventPacket::SOUND_LEVELUP, (int) $volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
namespace pocketmine\item;
|
namespace pocketmine\item;
|
||||||
|
|
||||||
use pocketmine\entity\Entity;
|
use pocketmine\entity\Entity;
|
||||||
|
use pocketmine\entity\EntityIds;
|
||||||
use pocketmine\entity\projectile\Projectile;
|
use pocketmine\entity\projectile\Projectile;
|
||||||
use pocketmine\event\entity\ProjectileLaunchEvent;
|
use pocketmine\event\entity\ProjectileLaunchEvent;
|
||||||
use pocketmine\math\Vector3;
|
use pocketmine\math\Vector3;
|
||||||
@ -65,9 +66,7 @@ abstract class ProjectileItem extends Item{
|
|||||||
}else{
|
}else{
|
||||||
$projectile->spawnToAll();
|
$projectile->spawnToAll();
|
||||||
|
|
||||||
//319 is the Player's entity type ID in MCPE, with all its flags (which we don't know)
|
$player->getLevel()->broadcastLevelSoundEvent($player, LevelSoundEventPacket::SOUND_THROW, 0, EntityIds::PLAYER);
|
||||||
//without this, it doesn't work at all.
|
|
||||||
$player->getLevel()->broadcastLevelSoundEvent($player, LevelSoundEventPacket::SOUND_THROW, 319);
|
|
||||||
}
|
}
|
||||||
}elseif($projectile !== null){
|
}elseif($projectile !== null){
|
||||||
$projectile->spawnToAll();
|
$projectile->spawnToAll();
|
||||||
|
@ -69,6 +69,7 @@ use pocketmine\metadata\Metadatable;
|
|||||||
use pocketmine\metadata\MetadataValue;
|
use pocketmine\metadata\MetadataValue;
|
||||||
use pocketmine\nbt\tag\ListTag;
|
use pocketmine\nbt\tag\ListTag;
|
||||||
use pocketmine\nbt\tag\StringTag;
|
use pocketmine\nbt\tag\StringTag;
|
||||||
|
use pocketmine\network\mcpe\protocol\AddEntityPacket;
|
||||||
use pocketmine\network\mcpe\protocol\BatchPacket;
|
use pocketmine\network\mcpe\protocol\BatchPacket;
|
||||||
use pocketmine\network\mcpe\protocol\DataPacket;
|
use pocketmine\network\mcpe\protocol\DataPacket;
|
||||||
use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||||
@ -500,16 +501,16 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
*
|
*
|
||||||
* @param Vector3 $pos
|
* @param Vector3 $pos
|
||||||
* @param int $soundId
|
* @param int $soundId
|
||||||
* @param int $pitch
|
|
||||||
* @param int $extraData
|
* @param int $extraData
|
||||||
|
* @param int $entityTypeId
|
||||||
* @param bool $isBabyMob
|
* @param bool $isBabyMob
|
||||||
* @param bool $disableRelativeVolume If true, all players receiving this sound-event will hear the sound at full volume regardless of distance
|
* @param bool $disableRelativeVolume If true, all players receiving this sound-event will hear the sound at full volume regardless of distance
|
||||||
*/
|
*/
|
||||||
public function broadcastLevelSoundEvent(Vector3 $pos, int $soundId, int $pitch = 1, int $extraData = -1, bool $isBabyMob = false, bool $disableRelativeVolume = false){
|
public function broadcastLevelSoundEvent(Vector3 $pos, int $soundId, int $extraData = 1, int $entityTypeId = -1, bool $isBabyMob = false, bool $disableRelativeVolume = false){
|
||||||
$pk = new LevelSoundEventPacket();
|
$pk = new LevelSoundEventPacket();
|
||||||
$pk->sound = $soundId;
|
$pk->sound = $soundId;
|
||||||
$pk->pitch = $pitch;
|
|
||||||
$pk->extraData = $extraData;
|
$pk->extraData = $extraData;
|
||||||
|
$pk->entityType = AddEntityPacket::LEGACY_ID_MAP_BC[$entityTypeId] ?? ":";
|
||||||
$pk->isBabyMob = $isBabyMob;
|
$pk->isBabyMob = $isBabyMob;
|
||||||
$pk->disableRelativeVolume = $disableRelativeVolume;
|
$pk->disableRelativeVolume = $disableRelativeVolume;
|
||||||
$pk->position = $pos->asVector3();
|
$pk->position = $pos->asVector3();
|
||||||
@ -1935,7 +1936,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($playSound){
|
if($playSound){
|
||||||
$this->broadcastLevelSoundEvent($hand, LevelSoundEventPacket::SOUND_PLACE, 1, $hand->getRuntimeId());
|
$this->broadcastLevelSoundEvent($hand, LevelSoundEventPacket::SOUND_PLACE, $hand->getRuntimeId());
|
||||||
}
|
}
|
||||||
|
|
||||||
$item->pop();
|
$item->pop();
|
||||||
|
@ -32,6 +32,8 @@ use pocketmine\network\mcpe\protocol\AddPlayerPacket;
|
|||||||
use pocketmine\network\mcpe\protocol\AdventureSettingsPacket;
|
use pocketmine\network\mcpe\protocol\AdventureSettingsPacket;
|
||||||
use pocketmine\network\mcpe\protocol\AnimatePacket;
|
use pocketmine\network\mcpe\protocol\AnimatePacket;
|
||||||
use pocketmine\network\mcpe\protocol\AvailableCommandsPacket;
|
use pocketmine\network\mcpe\protocol\AvailableCommandsPacket;
|
||||||
|
use pocketmine\network\mcpe\protocol\AvailableEntityIdentifiersPacket;
|
||||||
|
use pocketmine\network\mcpe\protocol\BiomeDefinitionListPacket;
|
||||||
use pocketmine\network\mcpe\protocol\BlockEntityDataPacket;
|
use pocketmine\network\mcpe\protocol\BlockEntityDataPacket;
|
||||||
use pocketmine\network\mcpe\protocol\BlockEventPacket;
|
use pocketmine\network\mcpe\protocol\BlockEventPacket;
|
||||||
use pocketmine\network\mcpe\protocol\BlockPickRequestPacket;
|
use pocketmine\network\mcpe\protocol\BlockPickRequestPacket;
|
||||||
@ -69,6 +71,7 @@ use pocketmine\network\mcpe\protocol\ItemFrameDropItemPacket;
|
|||||||
use pocketmine\network\mcpe\protocol\LabTablePacket;
|
use pocketmine\network\mcpe\protocol\LabTablePacket;
|
||||||
use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||||
|
use pocketmine\network\mcpe\protocol\LevelSoundEventPacketV1;
|
||||||
use pocketmine\network\mcpe\protocol\LoginPacket;
|
use pocketmine\network\mcpe\protocol\LoginPacket;
|
||||||
use pocketmine\network\mcpe\protocol\MapInfoRequestPacket;
|
use pocketmine\network\mcpe\protocol\MapInfoRequestPacket;
|
||||||
use pocketmine\network\mcpe\protocol\MobArmorEquipmentPacket;
|
use pocketmine\network\mcpe\protocol\MobArmorEquipmentPacket;
|
||||||
@ -79,6 +82,7 @@ use pocketmine\network\mcpe\protocol\ModalFormResponsePacket;
|
|||||||
use pocketmine\network\mcpe\protocol\MoveEntityAbsolutePacket;
|
use pocketmine\network\mcpe\protocol\MoveEntityAbsolutePacket;
|
||||||
use pocketmine\network\mcpe\protocol\MoveEntityDeltaPacket;
|
use pocketmine\network\mcpe\protocol\MoveEntityDeltaPacket;
|
||||||
use pocketmine\network\mcpe\protocol\MovePlayerPacket;
|
use pocketmine\network\mcpe\protocol\MovePlayerPacket;
|
||||||
|
use pocketmine\network\mcpe\protocol\NetworkChunkPublisherUpdatePacket;
|
||||||
use pocketmine\network\mcpe\protocol\NetworkStackLatencyPacket;
|
use pocketmine\network\mcpe\protocol\NetworkStackLatencyPacket;
|
||||||
use pocketmine\network\mcpe\protocol\NpcRequestPacket;
|
use pocketmine\network\mcpe\protocol\NpcRequestPacket;
|
||||||
use pocketmine\network\mcpe\protocol\PhotoTransferPacket;
|
use pocketmine\network\mcpe\protocol\PhotoTransferPacket;
|
||||||
@ -126,6 +130,7 @@ use pocketmine\network\mcpe\protocol\ShowProfilePacket;
|
|||||||
use pocketmine\network\mcpe\protocol\ShowStoreOfferPacket;
|
use pocketmine\network\mcpe\protocol\ShowStoreOfferPacket;
|
||||||
use pocketmine\network\mcpe\protocol\SimpleEventPacket;
|
use pocketmine\network\mcpe\protocol\SimpleEventPacket;
|
||||||
use pocketmine\network\mcpe\protocol\SpawnExperienceOrbPacket;
|
use pocketmine\network\mcpe\protocol\SpawnExperienceOrbPacket;
|
||||||
|
use pocketmine\network\mcpe\protocol\SpawnParticleEffectPacket;
|
||||||
use pocketmine\network\mcpe\protocol\StartGamePacket;
|
use pocketmine\network\mcpe\protocol\StartGamePacket;
|
||||||
use pocketmine\network\mcpe\protocol\StopSoundPacket;
|
use pocketmine\network\mcpe\protocol\StopSoundPacket;
|
||||||
use pocketmine\network\mcpe\protocol\StructureBlockUpdatePacket;
|
use pocketmine\network\mcpe\protocol\StructureBlockUpdatePacket;
|
||||||
@ -237,7 +242,7 @@ abstract class NetworkSession{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handleLevelSoundEvent(LevelSoundEventPacket $packet) : bool{
|
public function handleLevelSoundEventPacketV1(LevelSoundEventPacketV1 $packet) : bool{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -608,4 +613,25 @@ abstract class NetworkSession{
|
|||||||
public function handleScriptCustomEvent(ScriptCustomEventPacket $packet) : bool{
|
public function handleScriptCustomEvent(ScriptCustomEventPacket $packet) : bool{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function handleSpawnParticleEffect(SpawnParticleEffectPacket $packet) : bool{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handleAvailableEntityIdentifiers(AvailableEntityIdentifiersPacket $packet) : bool{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handleLevelSoundEvent(LevelSoundEventPacket $packet) : bool{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handleNetworkChunkPublisherUpdate(NetworkChunkPublisherUpdatePacket $packet) : bool{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handleBiomeDefinitionList(BiomeDefinitionListPacket $packet) : bool{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ use pocketmine\network\mcpe\protocol\InteractPacket;
|
|||||||
use pocketmine\network\mcpe\protocol\InventoryTransactionPacket;
|
use pocketmine\network\mcpe\protocol\InventoryTransactionPacket;
|
||||||
use pocketmine\network\mcpe\protocol\ItemFrameDropItemPacket;
|
use pocketmine\network\mcpe\protocol\ItemFrameDropItemPacket;
|
||||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||||
|
use pocketmine\network\mcpe\protocol\LevelSoundEventPacketV1;
|
||||||
use pocketmine\network\mcpe\protocol\LoginPacket;
|
use pocketmine\network\mcpe\protocol\LoginPacket;
|
||||||
use pocketmine\network\mcpe\protocol\MapInfoRequestPacket;
|
use pocketmine\network\mcpe\protocol\MapInfoRequestPacket;
|
||||||
use pocketmine\network\mcpe\protocol\MobArmorEquipmentPacket;
|
use pocketmine\network\mcpe\protocol\MobArmorEquipmentPacket;
|
||||||
@ -125,8 +126,8 @@ class PlayerNetworkSessionAdapter extends NetworkSession{
|
|||||||
return $this->player->handleMovePlayer($packet);
|
return $this->player->handleMovePlayer($packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handleLevelSoundEvent(LevelSoundEventPacket $packet) : bool{
|
public function handleLevelSoundEventPacketV1(LevelSoundEventPacketV1 $packet) : bool{
|
||||||
return $this->player->handleLevelSoundEvent($packet);
|
return true; //useless leftover from 1.8
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handleEntityEvent(EntityEventPacket $packet) : bool{
|
public function handleEntityEvent(EntityEventPacket $packet) : bool{
|
||||||
@ -280,4 +281,8 @@ class PlayerNetworkSessionAdapter extends NetworkSession{
|
|||||||
public function handleServerSettingsRequest(ServerSettingsRequestPacket $packet) : bool{
|
public function handleServerSettingsRequest(ServerSettingsRequestPacket $packet) : bool{
|
||||||
return false; //TODO: GUI stuff
|
return false; //TODO: GUI stuff
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function handleLevelSoundEvent(LevelSoundEventPacket $packet) : bool{
|
||||||
|
return $this->player->handleLevelSoundEvent($packet);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
|
|||||||
#include <rules/DataPacket.h>
|
#include <rules/DataPacket.h>
|
||||||
|
|
||||||
use pocketmine\entity\Attribute;
|
use pocketmine\entity\Attribute;
|
||||||
|
use pocketmine\entity\EntityIds;
|
||||||
use pocketmine\math\Vector3;
|
use pocketmine\math\Vector3;
|
||||||
use pocketmine\network\mcpe\NetworkSession;
|
use pocketmine\network\mcpe\NetworkSession;
|
||||||
use pocketmine\network\mcpe\protocol\types\EntityLink;
|
use pocketmine\network\mcpe\protocol\types\EntityLink;
|
||||||
@ -33,6 +34,114 @@ use pocketmine\network\mcpe\protocol\types\EntityLink;
|
|||||||
class AddEntityPacket extends DataPacket{
|
class AddEntityPacket extends DataPacket{
|
||||||
public const NETWORK_ID = ProtocolInfo::ADD_ENTITY_PACKET;
|
public const NETWORK_ID = ProtocolInfo::ADD_ENTITY_PACKET;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Really really really really really nasty hack, to preserve backwards compatibility.
|
||||||
|
* We can't transition to string IDs within 3.x because the network IDs (the integer ones) are exposed
|
||||||
|
* to the API in some places (for god's sake shoghi).
|
||||||
|
*
|
||||||
|
* TODO: remove this on 4.0
|
||||||
|
*/
|
||||||
|
public const LEGACY_ID_MAP_BC = [
|
||||||
|
EntityIds::NPC => "minecraft:npc",
|
||||||
|
EntityIds::PLAYER => "minecraft:player",
|
||||||
|
EntityIds::WITHER_SKELETON => "minecraft:wither_skeleton",
|
||||||
|
EntityIds::HUSK => "minecraft:husk",
|
||||||
|
EntityIds::STRAY => "minecraft:stray",
|
||||||
|
EntityIds::WITCH => "minecraft:witch",
|
||||||
|
EntityIds::ZOMBIE_VILLAGER => "minecraft:zombie_villager",
|
||||||
|
EntityIds::BLAZE => "minecraft:blaze",
|
||||||
|
EntityIds::MAGMA_CUBE => "minecraft:magma_cube",
|
||||||
|
EntityIds::GHAST => "minecraft:ghast",
|
||||||
|
EntityIds::CAVE_SPIDER => "minecraft:cave_spider",
|
||||||
|
EntityIds::SILVERFISH => "minecraft:silverfish",
|
||||||
|
EntityIds::ENDERMAN => "minecraft:enderman",
|
||||||
|
EntityIds::SLIME => "minecraft:slime",
|
||||||
|
EntityIds::ZOMBIE_PIGMAN => "minecraft:zombie_pigman",
|
||||||
|
EntityIds::SPIDER => "minecraft:spider",
|
||||||
|
EntityIds::SKELETON => "minecraft:skeleton",
|
||||||
|
EntityIds::CREEPER => "minecraft:creeper",
|
||||||
|
EntityIds::ZOMBIE => "minecraft:zombie",
|
||||||
|
EntityIds::SKELETON_HORSE => "minecraft:skeleton_horse",
|
||||||
|
EntityIds::MULE => "minecraft:mule",
|
||||||
|
EntityIds::DONKEY => "minecraft:donkey",
|
||||||
|
EntityIds::DOLPHIN => "minecraft:dolphin",
|
||||||
|
EntityIds::TROPICALFISH => "minecraft:tropicalfish",
|
||||||
|
EntityIds::WOLF => "minecraft:wolf",
|
||||||
|
EntityIds::SQUID => "minecraft:squid",
|
||||||
|
EntityIds::DROWNED => "minecraft:drowned",
|
||||||
|
EntityIds::SHEEP => "minecraft:sheep",
|
||||||
|
EntityIds::MOOSHROOM => "minecraft:mooshroom",
|
||||||
|
EntityIds::PANDA => "minecraft:panda",
|
||||||
|
EntityIds::SALMON => "minecraft:salmon",
|
||||||
|
EntityIds::PIG => "minecraft:pig",
|
||||||
|
EntityIds::VILLAGER => "minecraft:villager",
|
||||||
|
EntityIds::COD => "minecraft:cod",
|
||||||
|
EntityIds::PUFFERFISH => "minecraft:pufferfish",
|
||||||
|
EntityIds::COW => "minecraft:cow",
|
||||||
|
EntityIds::CHICKEN => "minecraft:chicken",
|
||||||
|
EntityIds::BALLOON => "minecraft:balloon",
|
||||||
|
EntityIds::LLAMA => "minecraft:llama",
|
||||||
|
EntityIds::IRON_GOLEM => "minecraft:iron_golem",
|
||||||
|
EntityIds::RABBIT => "minecraft:rabbit",
|
||||||
|
EntityIds::SNOW_GOLEM => "minecraft:snow_golem",
|
||||||
|
EntityIds::BAT => "minecraft:bat",
|
||||||
|
EntityIds::OCELOT => "minecraft:ocelot",
|
||||||
|
EntityIds::HORSE => "minecraft:horse",
|
||||||
|
EntityIds::CAT => "minecraft:cat",
|
||||||
|
EntityIds::POLAR_BEAR => "minecraft:polar_bear",
|
||||||
|
EntityIds::ZOMBIE_HORSE => "minecraft:zombie_horse",
|
||||||
|
EntityIds::TURTLE => "minecraft:turtle",
|
||||||
|
EntityIds::PARROT => "minecraft:parrot",
|
||||||
|
EntityIds::GUARDIAN => "minecraft:guardian",
|
||||||
|
EntityIds::ELDER_GUARDIAN => "minecraft:elder_guardian",
|
||||||
|
EntityIds::VINDICATOR => "minecraft:vindicator",
|
||||||
|
EntityIds::WITHER => "minecraft:wither",
|
||||||
|
EntityIds::ENDER_DRAGON => "minecraft:ender_dragon",
|
||||||
|
EntityIds::SHULKER => "minecraft:shulker",
|
||||||
|
EntityIds::ENDERMITE => "minecraft:endermite",
|
||||||
|
EntityIds::MINECART => "minecraft:minecart",
|
||||||
|
EntityIds::HOPPER_MINECART => "minecraft:hopper_minecart",
|
||||||
|
EntityIds::TNT_MINECART => "minecraft:tnt_minecart",
|
||||||
|
EntityIds::CHEST_MINECART => "minecraft:chest_minecart",
|
||||||
|
EntityIds::COMMAND_BLOCK_MINECART => "minecraft:command_block_minecart",
|
||||||
|
EntityIds::ARMOR_STAND => "minecraft:armor_stand",
|
||||||
|
EntityIds::ITEM => "minecraft:item",
|
||||||
|
EntityIds::TNT => "minecraft:tnt",
|
||||||
|
EntityIds::FALLING_BLOCK => "minecraft:falling_block",
|
||||||
|
EntityIds::XP_BOTTLE => "minecraft:xp_bottle",
|
||||||
|
EntityIds::XP_ORB => "minecraft:xp_orb",
|
||||||
|
EntityIds::EYE_OF_ENDER_SIGNAL => "minecraft:eye_of_ender_signal",
|
||||||
|
EntityIds::ENDER_CRYSTAL => "minecraft:ender_crystal",
|
||||||
|
EntityIds::SHULKER_BULLET => "minecraft:shulker_bullet",
|
||||||
|
EntityIds::FISHING_HOOK => "minecraft:fishing_hook",
|
||||||
|
EntityIds::DRAGON_FIREBALL => "minecraft:dragon_fireball",
|
||||||
|
EntityIds::ARROW => "minecraft:arrow",
|
||||||
|
EntityIds::SNOWBALL => "minecraft:snowball",
|
||||||
|
EntityIds::EGG => "minecraft:egg",
|
||||||
|
EntityIds::PAINTING => "minecraft:painting",
|
||||||
|
EntityIds::THROWN_TRIDENT => "minecraft:thrown_trident",
|
||||||
|
EntityIds::FIREBALL => "minecraft:fireball",
|
||||||
|
EntityIds::SPLASH_POTION => "minecraft:splash_potion",
|
||||||
|
EntityIds::ENDER_PEARL => "minecraft:ender_pearl",
|
||||||
|
EntityIds::LEASH_KNOT => "minecraft:leash_knot",
|
||||||
|
EntityIds::WITHER_SKULL => "minecraft:wither_skull",
|
||||||
|
EntityIds::WITHER_SKULL_DANGEROUS => "minecraft:wither_skull_dangerous",
|
||||||
|
EntityIds::BOAT => "minecraft:boat",
|
||||||
|
EntityIds::LIGHTNING_BOLT => "minecraft:lightning_bolt",
|
||||||
|
EntityIds::SMALL_FIREBALL => "minecraft:small_fireball",
|
||||||
|
EntityIds::LLAMA_SPIT => "minecraft:llama_spit",
|
||||||
|
EntityIds::AREA_EFFECT_CLOUD => "minecraft:area_effect_cloud",
|
||||||
|
EntityIds::LINGERING_POTION => "minecraft:lingering_potion",
|
||||||
|
EntityIds::FIREWORKS_ROCKET => "minecraft:fireworks_rocket",
|
||||||
|
EntityIds::EVOCATION_FANG => "minecraft:evocation_fang",
|
||||||
|
EntityIds::EVOCATION_ILLAGER => "minecraft:evocation_illager",
|
||||||
|
EntityIds::VEX => "minecraft:vex",
|
||||||
|
EntityIds::AGENT => "minecraft:agent",
|
||||||
|
EntityIds::ICE_BOMB => "minecraft:ice_bomb",
|
||||||
|
EntityIds::PHANTOM => "minecraft:phantom",
|
||||||
|
EntityIds::TRIPOD_CAMERA => "minecraft:tripod_camera"
|
||||||
|
];
|
||||||
|
|
||||||
/** @var int|null */
|
/** @var int|null */
|
||||||
public $entityUniqueId = null; //TODO
|
public $entityUniqueId = null; //TODO
|
||||||
/** @var int */
|
/** @var int */
|
||||||
@ -60,7 +169,10 @@ class AddEntityPacket extends DataPacket{
|
|||||||
protected function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->entityUniqueId = $this->getEntityUniqueId();
|
$this->entityUniqueId = $this->getEntityUniqueId();
|
||||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||||
$this->type = $this->getUnsignedVarInt();
|
$this->type = array_search($t = $this->getString(), self::LEGACY_ID_MAP_BC);
|
||||||
|
if($this->type === false){
|
||||||
|
throw new \UnexpectedValueException("Can't map ID $t to legacy ID");
|
||||||
|
}
|
||||||
$this->position = $this->getVector3();
|
$this->position = $this->getVector3();
|
||||||
$this->motion = $this->getVector3();
|
$this->motion = $this->getVector3();
|
||||||
$this->pitch = $this->getLFloat();
|
$this->pitch = $this->getLFloat();
|
||||||
@ -95,7 +207,7 @@ class AddEntityPacket extends DataPacket{
|
|||||||
protected function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
|
$this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
|
||||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||||
$this->putUnsignedVarInt($this->type);
|
$this->putString(self::LEGACY_ID_MAP_BC[$this->type]);
|
||||||
$this->putVector3($this->position);
|
$this->putVector3($this->position);
|
||||||
$this->putVector3Nullable($this->motion);
|
$this->putVector3Nullable($this->motion);
|
||||||
$this->putLFloat($this->pitch);
|
$this->putLFloat($this->pitch);
|
||||||
|
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ____ _ _ __ __ _ __ __ ____
|
||||||
|
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||||
|
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||||
|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||||
|
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||||
|
*
|
||||||
|
* This program 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.
|
||||||
|
*
|
||||||
|
* @author PocketMine Team
|
||||||
|
* @link http://www.pocketmine.net/
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace pocketmine\network\mcpe\protocol;
|
||||||
|
|
||||||
|
#include <rules/DataPacket.h>
|
||||||
|
|
||||||
|
use pocketmine\network\mcpe\NetworkSession;
|
||||||
|
|
||||||
|
class AvailableEntityIdentifiersPacket extends DataPacket{
|
||||||
|
public const NETWORK_ID = ProtocolInfo::AVAILABLE_ENTITY_IDENTIFIERS_PACKET;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
public $namedtag;
|
||||||
|
|
||||||
|
protected function decodePayload(){
|
||||||
|
$this->namedtag = $this->getRemaining();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function encodePayload(){
|
||||||
|
$this->put($this->namedtag);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle(NetworkSession $session) : bool{
|
||||||
|
return $session->handleAvailableEntityIdentifiers($this);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ____ _ _ __ __ _ __ __ ____
|
||||||
|
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||||
|
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||||
|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||||
|
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||||
|
*
|
||||||
|
* This program 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.
|
||||||
|
*
|
||||||
|
* @author PocketMine Team
|
||||||
|
* @link http://www.pocketmine.net/
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace pocketmine\network\mcpe\protocol;
|
||||||
|
|
||||||
|
#include <rules/DataPacket.h>
|
||||||
|
|
||||||
|
use pocketmine\network\mcpe\NetworkSession;
|
||||||
|
|
||||||
|
class BiomeDefinitionListPacket extends DataPacket{
|
||||||
|
public const NETWORK_ID = ProtocolInfo::BIOME_DEFINITION_LIST_PACKET;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
public $namedtag;
|
||||||
|
|
||||||
|
protected function decodePayload(){
|
||||||
|
$this->namedtag = $this->getRemaining();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function encodePayload(){
|
||||||
|
$this->put($this->namedtag);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle(NetworkSession $session) : bool{
|
||||||
|
return $session->handleBiomeDefinitionList($this);
|
||||||
|
}
|
||||||
|
}
|
@ -249,9 +249,9 @@ class LevelSoundEventPacket extends DataPacket{
|
|||||||
/** @var Vector3 */
|
/** @var Vector3 */
|
||||||
public $position;
|
public $position;
|
||||||
/** @var int */
|
/** @var int */
|
||||||
public $extraData = -1;
|
public $extraData = 0;
|
||||||
/** @var int */
|
/** @var string */
|
||||||
public $pitch = 1;
|
public $entityType = ":"; //???
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
public $isBabyMob = false; //...
|
public $isBabyMob = false; //...
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
@ -261,7 +261,7 @@ class LevelSoundEventPacket extends DataPacket{
|
|||||||
$this->sound = $this->getByte();
|
$this->sound = $this->getByte();
|
||||||
$this->position = $this->getVector3();
|
$this->position = $this->getVector3();
|
||||||
$this->extraData = $this->getVarInt();
|
$this->extraData = $this->getVarInt();
|
||||||
$this->pitch = $this->getVarInt();
|
$this->entityType = $this->getString();
|
||||||
$this->isBabyMob = $this->getBool();
|
$this->isBabyMob = $this->getBool();
|
||||||
$this->disableRelativeVolume = $this->getBool();
|
$this->disableRelativeVolume = $this->getBool();
|
||||||
}
|
}
|
||||||
@ -270,7 +270,7 @@ class LevelSoundEventPacket extends DataPacket{
|
|||||||
$this->putByte($this->sound);
|
$this->putByte($this->sound);
|
||||||
$this->putVector3($this->position);
|
$this->putVector3($this->position);
|
||||||
$this->putVarInt($this->extraData);
|
$this->putVarInt($this->extraData);
|
||||||
$this->putVarInt($this->pitch);
|
$this->putString($this->entityType);
|
||||||
$this->putBool($this->isBabyMob);
|
$this->putBool($this->isBabyMob);
|
||||||
$this->putBool($this->disableRelativeVolume);
|
$this->putBool($this->disableRelativeVolume);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ____ _ _ __ __ _ __ __ ____
|
||||||
|
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||||
|
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||||
|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||||
|
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||||
|
*
|
||||||
|
* This program 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.
|
||||||
|
*
|
||||||
|
* @author PocketMine Team
|
||||||
|
* @link http://www.pocketmine.net/
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace pocketmine\network\mcpe\protocol;
|
||||||
|
|
||||||
|
#include <rules/DataPacket.h>
|
||||||
|
|
||||||
|
use pocketmine\math\Vector3;
|
||||||
|
use pocketmine\network\mcpe\NetworkSession;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Useless leftover from a 1.8 refactor, does nothing
|
||||||
|
*/
|
||||||
|
class LevelSoundEventPacketV1 extends DataPacket{
|
||||||
|
public const NETWORK_ID = ProtocolInfo::LEVEL_SOUND_EVENT_PACKET_V1;
|
||||||
|
|
||||||
|
/** @var int */
|
||||||
|
public $sound;
|
||||||
|
/** @var Vector3 */
|
||||||
|
public $position;
|
||||||
|
/** @var int */
|
||||||
|
public $extraData = 0;
|
||||||
|
/** @var int */
|
||||||
|
public $entityType = 1;
|
||||||
|
/** @var bool */
|
||||||
|
public $isBabyMob = false; //...
|
||||||
|
/** @var bool */
|
||||||
|
public $disableRelativeVolume = false;
|
||||||
|
|
||||||
|
protected function decodePayload(){
|
||||||
|
$this->sound = $this->getByte();
|
||||||
|
$this->position = $this->getVector3();
|
||||||
|
$this->extraData = $this->getVarInt();
|
||||||
|
$this->entityType = $this->getVarInt();
|
||||||
|
$this->isBabyMob = $this->getBool();
|
||||||
|
$this->disableRelativeVolume = $this->getBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function encodePayload(){
|
||||||
|
$this->putByte($this->sound);
|
||||||
|
$this->putVector3($this->position);
|
||||||
|
$this->putVarInt($this->extraData);
|
||||||
|
$this->putVarInt($this->entityType);
|
||||||
|
$this->putBool($this->isBabyMob);
|
||||||
|
$this->putBool($this->disableRelativeVolume);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle(NetworkSession $session) : bool{
|
||||||
|
return $session->handleLevelSoundEventPacketV1($this);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ____ _ _ __ __ _ __ __ ____
|
||||||
|
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||||
|
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||||
|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||||
|
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||||
|
*
|
||||||
|
* This program 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.
|
||||||
|
*
|
||||||
|
* @author PocketMine Team
|
||||||
|
* @link http://www.pocketmine.net/
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace pocketmine\network\mcpe\protocol;
|
||||||
|
|
||||||
|
#include <rules/DataPacket.h>
|
||||||
|
|
||||||
|
use pocketmine\network\mcpe\NetworkSession;
|
||||||
|
|
||||||
|
class NetworkChunkPublisherUpdatePacket extends DataPacket{
|
||||||
|
public const NETWORK_ID = ProtocolInfo::NETWORK_CHUNK_PUBLISHER_UPDATE_PACKET;
|
||||||
|
|
||||||
|
/** @var int */
|
||||||
|
public $x;
|
||||||
|
/** @var int */
|
||||||
|
public $y;
|
||||||
|
/** @var int */
|
||||||
|
public $z;
|
||||||
|
/** @var int */
|
||||||
|
public $radius;
|
||||||
|
|
||||||
|
protected function decodePayload(){
|
||||||
|
$this->getSignedBlockPosition($this->x, $this->y, $this->z);
|
||||||
|
$this->radius = $this->getUnsignedVarInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function encodePayload(){
|
||||||
|
$this->putSignedBlockPosition($this->x, $this->y, $this->z);
|
||||||
|
$this->putUnsignedVarInt($this->radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle(NetworkSession $session) : bool{
|
||||||
|
return $session->handleNetworkChunkPublisherUpdate($this);
|
||||||
|
}
|
||||||
|
}
|
@ -54,7 +54,7 @@ class PacketPool{
|
|||||||
static::registerPacket(new UpdateBlockPacket());
|
static::registerPacket(new UpdateBlockPacket());
|
||||||
static::registerPacket(new AddPaintingPacket());
|
static::registerPacket(new AddPaintingPacket());
|
||||||
static::registerPacket(new ExplodePacket());
|
static::registerPacket(new ExplodePacket());
|
||||||
static::registerPacket(new LevelSoundEventPacket());
|
static::registerPacket(new LevelSoundEventPacketV1());
|
||||||
static::registerPacket(new LevelEventPacket());
|
static::registerPacket(new LevelEventPacket());
|
||||||
static::registerPacket(new BlockEventPacket());
|
static::registerPacket(new BlockEventPacket());
|
||||||
static::registerPacket(new EntityEventPacket());
|
static::registerPacket(new EntityEventPacket());
|
||||||
@ -147,6 +147,11 @@ class PacketPool{
|
|||||||
static::registerPacket(new UpdateSoftEnumPacket());
|
static::registerPacket(new UpdateSoftEnumPacket());
|
||||||
static::registerPacket(new NetworkStackLatencyPacket());
|
static::registerPacket(new NetworkStackLatencyPacket());
|
||||||
static::registerPacket(new ScriptCustomEventPacket());
|
static::registerPacket(new ScriptCustomEventPacket());
|
||||||
|
static::registerPacket(new SpawnParticleEffectPacket());
|
||||||
|
static::registerPacket(new AvailableEntityIdentifiersPacket());
|
||||||
|
static::registerPacket(new LevelSoundEventPacket());
|
||||||
|
static::registerPacket(new NetworkChunkPublisherUpdatePacket());
|
||||||
|
static::registerPacket(new BiomeDefinitionListPacket());
|
||||||
|
|
||||||
static::registerPacket(new BatchPacket());
|
static::registerPacket(new BatchPacket());
|
||||||
}
|
}
|
||||||
@ -178,4 +183,5 @@ class PacketPool{
|
|||||||
|
|
||||||
return $pk;
|
return $pk;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,15 +39,15 @@ interface ProtocolInfo{
|
|||||||
/**
|
/**
|
||||||
* Actual Minecraft: PE protocol version
|
* Actual Minecraft: PE protocol version
|
||||||
*/
|
*/
|
||||||
public const CURRENT_PROTOCOL = 291;
|
public const CURRENT_PROTOCOL = 313;
|
||||||
/**
|
/**
|
||||||
* Current Minecraft PE version reported by the server. This is usually the earliest currently supported version.
|
* Current Minecraft PE version reported by the server. This is usually the earliest currently supported version.
|
||||||
*/
|
*/
|
||||||
public const MINECRAFT_VERSION = 'v1.7.0';
|
public const MINECRAFT_VERSION = 'v1.8.0';
|
||||||
/**
|
/**
|
||||||
* Version number sent to clients in ping responses.
|
* Version number sent to clients in ping responses.
|
||||||
*/
|
*/
|
||||||
public const MINECRAFT_VERSION_NETWORK = '1.7.0';
|
public const MINECRAFT_VERSION_NETWORK = '1.8.0';
|
||||||
|
|
||||||
public const LOGIN_PACKET = 0x01;
|
public const LOGIN_PACKET = 0x01;
|
||||||
public const PLAY_STATUS_PACKET = 0x02;
|
public const PLAY_STATUS_PACKET = 0x02;
|
||||||
@ -72,7 +72,7 @@ interface ProtocolInfo{
|
|||||||
public const UPDATE_BLOCK_PACKET = 0x15;
|
public const UPDATE_BLOCK_PACKET = 0x15;
|
||||||
public const ADD_PAINTING_PACKET = 0x16;
|
public const ADD_PAINTING_PACKET = 0x16;
|
||||||
public const EXPLODE_PACKET = 0x17;
|
public const EXPLODE_PACKET = 0x17;
|
||||||
public const LEVEL_SOUND_EVENT_PACKET = 0x18;
|
public const LEVEL_SOUND_EVENT_PACKET_V1 = 0x18;
|
||||||
public const LEVEL_EVENT_PACKET = 0x19;
|
public const LEVEL_EVENT_PACKET = 0x19;
|
||||||
public const BLOCK_EVENT_PACKET = 0x1a;
|
public const BLOCK_EVENT_PACKET = 0x1a;
|
||||||
public const ENTITY_EVENT_PACKET = 0x1b;
|
public const ENTITY_EVENT_PACKET = 0x1b;
|
||||||
@ -164,6 +164,12 @@ interface ProtocolInfo{
|
|||||||
public const SET_LOCAL_PLAYER_AS_INITIALIZED_PACKET = 0x71;
|
public const SET_LOCAL_PLAYER_AS_INITIALIZED_PACKET = 0x71;
|
||||||
public const UPDATE_SOFT_ENUM_PACKET = 0x72;
|
public const UPDATE_SOFT_ENUM_PACKET = 0x72;
|
||||||
public const NETWORK_STACK_LATENCY_PACKET = 0x73;
|
public const NETWORK_STACK_LATENCY_PACKET = 0x73;
|
||||||
|
|
||||||
public const SCRIPT_CUSTOM_EVENT_PACKET = 0x75;
|
public const SCRIPT_CUSTOM_EVENT_PACKET = 0x75;
|
||||||
|
public const SPAWN_PARTICLE_EFFECT_PACKET = 0x76;
|
||||||
|
public const AVAILABLE_ENTITY_IDENTIFIERS_PACKET = 0x77;
|
||||||
|
public const LEVEL_SOUND_EVENT_PACKET = 0x78;
|
||||||
|
public const NETWORK_CHUNK_PUBLISHER_UPDATE_PACKET = 0x79;
|
||||||
|
public const BIOME_DEFINITION_LIST_PACKET = 0x7a;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,9 @@ class ResourcePackStackPacket extends DataPacket{
|
|||||||
/** @var ResourcePack[] */
|
/** @var ResourcePack[] */
|
||||||
public $resourcePackStack = [];
|
public $resourcePackStack = [];
|
||||||
|
|
||||||
|
/** @var bool */
|
||||||
|
public $isExperimental = false;
|
||||||
|
|
||||||
protected function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->mustAccept = $this->getBool();
|
$this->mustAccept = $this->getBool();
|
||||||
$behaviorPackCount = $this->getUnsignedVarInt();
|
$behaviorPackCount = $this->getUnsignedVarInt();
|
||||||
@ -56,6 +59,8 @@ class ResourcePackStackPacket extends DataPacket{
|
|||||||
$this->getString();
|
$this->getString();
|
||||||
$this->getString();
|
$this->getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->isExperimental = $this->getBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function encodePayload(){
|
protected function encodePayload(){
|
||||||
@ -74,6 +79,8 @@ class ResourcePackStackPacket extends DataPacket{
|
|||||||
$this->putString($entry->getPackVersion());
|
$this->putString($entry->getPackVersion());
|
||||||
$this->putString(""); //TODO: subpack name
|
$this->putString(""); //TODO: subpack name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->putBool($this->isExperimental);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle(NetworkSession $session) : bool{
|
public function handle(NetworkSession $session) : bool{
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ____ _ _ __ __ _ __ __ ____
|
||||||
|
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||||
|
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||||
|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||||
|
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||||
|
*
|
||||||
|
* This program 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.
|
||||||
|
*
|
||||||
|
* @author PocketMine Team
|
||||||
|
* @link http://www.pocketmine.net/
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace pocketmine\network\mcpe\protocol;
|
||||||
|
|
||||||
|
#include <rules/DataPacket.h>
|
||||||
|
|
||||||
|
use pocketmine\math\Vector3;
|
||||||
|
use pocketmine\network\mcpe\NetworkSession;
|
||||||
|
use pocketmine\network\mcpe\protocol\types\DimensionIds;
|
||||||
|
|
||||||
|
class SpawnParticleEffectPacket extends DataPacket{
|
||||||
|
public const NETWORK_ID = ProtocolInfo::SPAWN_PARTICLE_EFFECT_PACKET;
|
||||||
|
|
||||||
|
/** @var int */
|
||||||
|
public $dimensionId = DimensionIds::OVERWORLD; //wtf mojang
|
||||||
|
/** @var Vector3 */
|
||||||
|
public $position;
|
||||||
|
/** @var string */
|
||||||
|
public $particleName;
|
||||||
|
|
||||||
|
protected function decodePayload(){
|
||||||
|
$this->dimensionId = $this->getByte();
|
||||||
|
$this->position = $this->getVector3();
|
||||||
|
$this->particleName = $this->getString();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function encodePayload(){
|
||||||
|
$this->putByte($this->dimensionId);
|
||||||
|
$this->putVector3($this->position);
|
||||||
|
$this->putString($this->particleName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle(NetworkSession $session) : bool{
|
||||||
|
return $session->handleSpawnParticleEffect($this);
|
||||||
|
}
|
||||||
|
}
|
@ -118,6 +118,10 @@ class StartGamePacket extends DataPacket{
|
|||||||
public $isFromLockedWorldTemplate = false;
|
public $isFromLockedWorldTemplate = false;
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
public $useMsaGamertagsOnly = false;
|
public $useMsaGamertagsOnly = false;
|
||||||
|
/** @var bool */
|
||||||
|
public $isFromWorldTemplate = false;
|
||||||
|
/** @var bool */
|
||||||
|
public $isWorldTemplateOptionLocked = false;
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public $levelId = ""; //base64 string, usually the same as world folder name in vanilla
|
public $levelId = ""; //base64 string, usually the same as world folder name in vanilla
|
||||||
@ -176,6 +180,8 @@ class StartGamePacket extends DataPacket{
|
|||||||
$this->hasLockedResourcePack = $this->getBool();
|
$this->hasLockedResourcePack = $this->getBool();
|
||||||
$this->isFromLockedWorldTemplate = $this->getBool();
|
$this->isFromLockedWorldTemplate = $this->getBool();
|
||||||
$this->useMsaGamertagsOnly = $this->getBool();
|
$this->useMsaGamertagsOnly = $this->getBool();
|
||||||
|
$this->isFromWorldTemplate = $this->getBool();
|
||||||
|
$this->isWorldTemplateOptionLocked = $this->getBool();
|
||||||
|
|
||||||
$this->levelId = $this->getString();
|
$this->levelId = $this->getString();
|
||||||
$this->worldName = $this->getString();
|
$this->worldName = $this->getString();
|
||||||
@ -236,6 +242,8 @@ class StartGamePacket extends DataPacket{
|
|||||||
$this->putBool($this->hasLockedResourcePack);
|
$this->putBool($this->hasLockedResourcePack);
|
||||||
$this->putBool($this->isFromLockedWorldTemplate);
|
$this->putBool($this->isFromLockedWorldTemplate);
|
||||||
$this->putBool($this->useMsaGamertagsOnly);
|
$this->putBool($this->useMsaGamertagsOnly);
|
||||||
|
$this->putBool($this->isFromWorldTemplate);
|
||||||
|
$this->putBool($this->isWorldTemplateOptionLocked);
|
||||||
|
|
||||||
$this->putString($this->levelId);
|
$this->putString($this->levelId);
|
||||||
$this->putString($this->worldName);
|
$this->putString($this->worldName);
|
||||||
|
@ -43,6 +43,8 @@ class UpdateTradePacket extends DataPacket{
|
|||||||
public $varint1;
|
public $varint1;
|
||||||
/** @var int */
|
/** @var int */
|
||||||
public $varint2;
|
public $varint2;
|
||||||
|
/** @var int */
|
||||||
|
public $varint3;
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
public $isWilling;
|
public $isWilling;
|
||||||
/** @var int */
|
/** @var int */
|
||||||
@ -59,6 +61,7 @@ class UpdateTradePacket extends DataPacket{
|
|||||||
$this->windowType = $this->getByte();
|
$this->windowType = $this->getByte();
|
||||||
$this->varint1 = $this->getVarInt();
|
$this->varint1 = $this->getVarInt();
|
||||||
$this->varint2 = $this->getVarInt();
|
$this->varint2 = $this->getVarInt();
|
||||||
|
$this->varint3 = $this->getVarInt();
|
||||||
$this->isWilling = $this->getBool();
|
$this->isWilling = $this->getBool();
|
||||||
$this->traderEid = $this->getEntityUniqueId();
|
$this->traderEid = $this->getEntityUniqueId();
|
||||||
$this->playerEid = $this->getEntityUniqueId();
|
$this->playerEid = $this->getEntityUniqueId();
|
||||||
@ -71,6 +74,7 @@ class UpdateTradePacket extends DataPacket{
|
|||||||
$this->putByte($this->windowType);
|
$this->putByte($this->windowType);
|
||||||
$this->putVarInt($this->varint1);
|
$this->putVarInt($this->varint1);
|
||||||
$this->putVarInt($this->varint2);
|
$this->putVarInt($this->varint2);
|
||||||
|
$this->putVarInt($this->varint3);
|
||||||
$this->putBool($this->isWilling);
|
$this->putBool($this->isWilling);
|
||||||
$this->putEntityUniqueId($this->traderEid);
|
$this->putEntityUniqueId($this->traderEid);
|
||||||
$this->putEntityUniqueId($this->playerEid);
|
$this->putEntityUniqueId($this->playerEid);
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user