mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
Merge changes from ALPHA11 for 1.2.13
This commit is contained in:
commit
5b7b2dd0e2
@ -2778,7 +2778,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
break; //TODO
|
||||
case PlayerActionPacket::ACTION_CONTINUE_BREAK:
|
||||
$block = $this->level->getBlock($pos);
|
||||
$this->level->broadcastLevelEvent($pos, LevelEventPacket::EVENT_PARTICLE_PUNCH_BLOCK, $block->getId() | ($block->getDamage() << 8) | ($packet->face << 16));
|
||||
$this->level->broadcastLevelEvent($pos, LevelEventPacket::EVENT_PARTICLE_PUNCH_BLOCK, BlockFactory::toStaticRuntimeId($block->getId(), $block->getDamage()) | ($packet->face << 24));
|
||||
//TODO: destroy-progress level event
|
||||
break;
|
||||
default:
|
||||
$this->server->getLogger()->debug("Unhandled/unknown player action type " . $packet->action . " from " . $this->getName());
|
||||
@ -2967,7 +2968,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
|
||||
public function handleBookEdit(BookEditPacket $packet) : bool{
|
||||
/** @var WritableBook $oldBook */
|
||||
$oldBook = $this->inventory->getItem($packet->inventorySlot - 9);
|
||||
$oldBook = $this->inventory->getItem($packet->inventorySlot);
|
||||
if($oldBook->getId() !== Item::WRITABLE_BOOK){
|
||||
return false;
|
||||
}
|
||||
@ -3008,7 +3009,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->getInventory()->setItem($packet->inventorySlot - 9, $event->getNewBook());
|
||||
$this->getInventory()->setItem($packet->inventorySlot, $event->getNewBook());
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -3314,7 +3315,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
public function sendWhisper(string $sender, string $message){
|
||||
$pk = new TextPacket();
|
||||
$pk->type = TextPacket::TYPE_WHISPER;
|
||||
$pk->source = $sender;
|
||||
$pk->sourceName = $sender;
|
||||
$pk->message = $message;
|
||||
$this->dataPacket($pk);
|
||||
}
|
||||
|
@ -2301,7 +2301,8 @@ class Server{
|
||||
$pk = new PlayerListPacket();
|
||||
$pk->type = PlayerListPacket::TYPE_ADD;
|
||||
|
||||
$pk->entries[] = PlayerListEntry::createAdditionEntry($uuid, $entityId, $name, $skin, $xboxUserId);
|
||||
$pk->entries[] = PlayerListEntry::createAdditionEntry($uuid, $entityId, $name, "", 0, $skin, $xboxUserId);
|
||||
|
||||
$this->broadcastPacket($players ?? $this->playerList, $pk);
|
||||
}
|
||||
|
||||
@ -2323,7 +2324,7 @@ class Server{
|
||||
$pk = new PlayerListPacket();
|
||||
$pk->type = PlayerListPacket::TYPE_ADD;
|
||||
foreach($this->playerList as $player){
|
||||
$pk->entries[] = PlayerListEntry::createAdditionEntry($player->getUniqueId(), $player->getId(), $player->getDisplayName(), $player->getSkin(), $player->getXuid());
|
||||
$pk->entries[] = PlayerListEntry::createAdditionEntry($player->getUniqueId(), $player->getId(), $player->getDisplayName(), "", 0, $player->getSkin(), $player->getXuid());
|
||||
}
|
||||
|
||||
$p->dataPacket($pk);
|
||||
|
@ -25,6 +25,7 @@ namespace pocketmine\block;
|
||||
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\level\Position;
|
||||
use pocketmine\utils\MainLogger;
|
||||
|
||||
/**
|
||||
* Manages block registration and instance creation
|
||||
@ -50,6 +51,15 @@ class BlockFactory{
|
||||
/** @var \SplFixedArray<float> */
|
||||
public static $blastResistance = null;
|
||||
|
||||
/** @var int[] */
|
||||
public static $staticRuntimeIdMap = [];
|
||||
|
||||
/** @var int[] */
|
||||
public static $legacyIdMap = [];
|
||||
|
||||
/** @var int */
|
||||
private static $lastRuntimeId = 0;
|
||||
|
||||
/**
|
||||
* Initializes the block factory. By default this is called only once on server start, however you may wish to use
|
||||
* this if you need to reset the block factory back to its original defaults for whatever reason.
|
||||
@ -322,6 +332,12 @@ class BlockFactory{
|
||||
self::registerBlock(new UnknownBlock($id));
|
||||
}
|
||||
}
|
||||
|
||||
/** @var mixed[] $runtimeIdMap */
|
||||
$runtimeIdMap = json_decode(file_get_contents(\pocketmine\RESOURCE_PATH . "runtimeid_table.json"), true);
|
||||
foreach($runtimeIdMap as $obj){
|
||||
self::registerMapping($obj["runtimeID"], $obj["id"], $obj["data"]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -413,4 +429,41 @@ class BlockFactory{
|
||||
$b = self::$list[$id];
|
||||
return $b !== null and !($b instanceof UnknownBlock);
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @param int $id
|
||||
* @param int $meta
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function toStaticRuntimeId(int $id, int $meta = 0) : int{
|
||||
$index = ($id << 4) | $meta;
|
||||
if(!isset(self::$staticRuntimeIdMap[$index])){
|
||||
self::registerMapping($rtId = ++self::$lastRuntimeId, $id, $meta);
|
||||
MainLogger::getLogger()->error("ID $id meta $meta does not have a corresponding block static runtime ID, added a new unknown runtime ID ($rtId)");
|
||||
return $rtId;
|
||||
}
|
||||
|
||||
return self::$staticRuntimeIdMap[$index];
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @param int $runtimeId
|
||||
*
|
||||
* @return int[] [id, meta]
|
||||
*/
|
||||
public static function fromStaticRuntimeId(int $runtimeId) : array{
|
||||
$v = self::$legacyIdMap[$runtimeId];
|
||||
return [$v >> 4, $v & 0xf];
|
||||
}
|
||||
|
||||
private static function registerMapping(int $staticRuntimeId, int $legacyId, int $legacyMeta) : void{
|
||||
self::$staticRuntimeIdMap[($legacyId << 4) | $legacyMeta] = $staticRuntimeId;
|
||||
self::$legacyIdMap[$staticRuntimeId] = ($legacyId << 4) | $legacyMeta;
|
||||
self::$lastRuntimeId = max(self::$lastRuntimeId, $staticRuntimeId);
|
||||
}
|
||||
}
|
||||
|
@ -114,61 +114,60 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
//TODO: add more properties
|
||||
|
||||
public const DATA_ENDERMAN_HELD_ITEM_ID = 23; //short
|
||||
public const DATA_ENDERMAN_HELD_ITEM_DAMAGE = 24; //short
|
||||
public const DATA_ENTITY_AGE = 25; //short
|
||||
public const DATA_ENTITY_AGE = 24; //short
|
||||
|
||||
/* 27 (byte) player-specific flags
|
||||
* 28 (int) player "index"?
|
||||
* 29 (block coords) bed position */
|
||||
public const DATA_FIREBALL_POWER_X = 30; //float
|
||||
public const DATA_FIREBALL_POWER_Y = 31;
|
||||
public const DATA_FIREBALL_POWER_Z = 32;
|
||||
/* 33 (unknown)
|
||||
/* 26 (byte) player-specific flags
|
||||
* 27 (int) player "index"?
|
||||
* 28 (block coords) bed position */
|
||||
public const DATA_FIREBALL_POWER_X = 29; //float
|
||||
public const DATA_FIREBALL_POWER_Y = 30;
|
||||
public const DATA_FIREBALL_POWER_Z = 31;
|
||||
/* 32 (unknown)
|
||||
* 33 (float) fishing bobber
|
||||
* 34 (float) fishing bobber
|
||||
* 35 (float) fishing bobber
|
||||
* 36 (float) fishing bobber */
|
||||
public const DATA_POTION_AUX_VALUE = 37; //short
|
||||
public const DATA_LEAD_HOLDER_EID = 38; //long
|
||||
public const DATA_SCALE = 39; //float
|
||||
public const DATA_INTERACTIVE_TAG = 40; //string (button text)
|
||||
public const DATA_NPC_SKIN_ID = 41; //string
|
||||
public const DATA_URL_TAG = 42; //string
|
||||
public const DATA_MAX_AIR = 43; //short
|
||||
public const DATA_MARK_VARIANT = 44; //int
|
||||
/* 45 (byte) container stuff
|
||||
* 46 (int) container stuff
|
||||
* 47 (int) container stuff */
|
||||
public const DATA_BLOCK_TARGET = 48; //block coords (ender crystal)
|
||||
public const DATA_WITHER_INVULNERABLE_TICKS = 49; //int
|
||||
public const DATA_WITHER_TARGET_1 = 50; //long
|
||||
public const DATA_WITHER_TARGET_2 = 51; //long
|
||||
public const DATA_WITHER_TARGET_3 = 52; //long
|
||||
/* 53 (short) */
|
||||
public const DATA_BOUNDING_BOX_WIDTH = 54; //float
|
||||
public const DATA_BOUNDING_BOX_HEIGHT = 55; //float
|
||||
public const DATA_FUSE_LENGTH = 56; //int
|
||||
public const DATA_RIDER_SEAT_POSITION = 57; //vector3f
|
||||
public const DATA_RIDER_ROTATION_LOCKED = 58; //byte
|
||||
public const DATA_RIDER_MAX_ROTATION = 59; //float
|
||||
public const DATA_RIDER_MIN_ROTATION = 60; //float
|
||||
public const DATA_AREA_EFFECT_CLOUD_RADIUS = 61; //float
|
||||
public const DATA_AREA_EFFECT_CLOUD_WAITING = 62; //int
|
||||
public const DATA_AREA_EFFECT_CLOUD_PARTICLE_ID = 63; //int
|
||||
/* 64 (int) shulker-related */
|
||||
public const DATA_SHULKER_ATTACH_FACE = 65; //byte
|
||||
/* 66 (short) shulker-related */
|
||||
public const DATA_SHULKER_ATTACH_POS = 67; //block coords
|
||||
public const DATA_TRADING_PLAYER_EID = 68; //long
|
||||
* 35 (float) fishing bobber */
|
||||
public const DATA_POTION_AUX_VALUE = 36; //short
|
||||
public const DATA_LEAD_HOLDER_EID = 37; //long
|
||||
public const DATA_SCALE = 38; //float
|
||||
public const DATA_INTERACTIVE_TAG = 39; //string (button text)
|
||||
public const DATA_NPC_SKIN_ID = 40; //string
|
||||
public const DATA_URL_TAG = 41; //string
|
||||
public const DATA_MAX_AIR = 42; //short
|
||||
public const DATA_MARK_VARIANT = 43; //int
|
||||
/* 44 (byte) container stuff
|
||||
* 45 (int) container stuff
|
||||
* 46 (int) container stuff */
|
||||
public const DATA_BLOCK_TARGET = 47; //block coords (ender crystal)
|
||||
public const DATA_WITHER_INVULNERABLE_TICKS = 48; //int
|
||||
public const DATA_WITHER_TARGET_1 = 49; //long
|
||||
public const DATA_WITHER_TARGET_2 = 50; //long
|
||||
public const DATA_WITHER_TARGET_3 = 51; //long
|
||||
/* 52 (short) */
|
||||
public const DATA_BOUNDING_BOX_WIDTH = 53; //float
|
||||
public const DATA_BOUNDING_BOX_HEIGHT = 54; //float
|
||||
public const DATA_FUSE_LENGTH = 55; //int
|
||||
public const DATA_RIDER_SEAT_POSITION = 56; //vector3f
|
||||
public const DATA_RIDER_ROTATION_LOCKED = 57; //byte
|
||||
public const DATA_RIDER_MAX_ROTATION = 58; //float
|
||||
public const DATA_RIDER_MIN_ROTATION = 59; //float
|
||||
public const DATA_AREA_EFFECT_CLOUD_RADIUS = 60; //float
|
||||
public const DATA_AREA_EFFECT_CLOUD_WAITING = 61; //int
|
||||
public const DATA_AREA_EFFECT_CLOUD_PARTICLE_ID = 62; //int
|
||||
/* 63 (int) shulker-related */
|
||||
public const DATA_SHULKER_ATTACH_FACE = 64; //byte
|
||||
/* 65 (short) shulker-related */
|
||||
public const DATA_SHULKER_ATTACH_POS = 66; //block coords
|
||||
public const DATA_TRADING_PLAYER_EID = 67; //long
|
||||
|
||||
/* 70 (byte) command-block */
|
||||
public const DATA_COMMAND_BLOCK_COMMAND = 71; //string
|
||||
public const DATA_COMMAND_BLOCK_LAST_OUTPUT = 72; //string
|
||||
public const DATA_COMMAND_BLOCK_TRACK_OUTPUT = 73; //byte
|
||||
public const DATA_CONTROLLING_RIDER_SEAT_NUMBER = 74; //byte
|
||||
public const DATA_STRENGTH = 75; //int
|
||||
public const DATA_MAX_STRENGTH = 76; //int
|
||||
/* 77 (int)
|
||||
* 78 (int) */
|
||||
/* 69 (byte) command-block */
|
||||
public const DATA_COMMAND_BLOCK_COMMAND = 70; //string
|
||||
public const DATA_COMMAND_BLOCK_LAST_OUTPUT = 71; //string
|
||||
public const DATA_COMMAND_BLOCK_TRACK_OUTPUT = 72; //byte
|
||||
public const DATA_CONTROLLING_RIDER_SEAT_NUMBER = 73; //byte
|
||||
public const DATA_STRENGTH = 74; //int
|
||||
public const DATA_MAX_STRENGTH = 75; //int
|
||||
/* 76 (int)
|
||||
* 77 (int) */
|
||||
|
||||
|
||||
public const DATA_FLAG_ONFIRE = 0;
|
||||
@ -193,33 +192,35 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
public const DATA_FLAG_CAN_CLIMB = 19;
|
||||
public const DATA_FLAG_SWIMMER = 20;
|
||||
public const DATA_FLAG_CAN_FLY = 21;
|
||||
public const DATA_FLAG_RESTING = 22;
|
||||
public const DATA_FLAG_SITTING = 23;
|
||||
public const DATA_FLAG_ANGRY = 24;
|
||||
public const DATA_FLAG_INTERESTED = 25;
|
||||
public const DATA_FLAG_CHARGED = 26;
|
||||
public const DATA_FLAG_TAMED = 27;
|
||||
public const DATA_FLAG_LEASHED = 28;
|
||||
public const DATA_FLAG_SHEARED = 29;
|
||||
public const DATA_FLAG_GLIDING = 30;
|
||||
public const DATA_FLAG_ELDER = 31;
|
||||
public const DATA_FLAG_MOVING = 32;
|
||||
public const DATA_FLAG_BREATHING = 33;
|
||||
public const DATA_FLAG_CHESTED = 34;
|
||||
public const DATA_FLAG_STACKABLE = 35;
|
||||
public const DATA_FLAG_SHOWBASE = 36;
|
||||
public const DATA_FLAG_REARING = 37;
|
||||
public const DATA_FLAG_VIBRATING = 38;
|
||||
public const DATA_FLAG_IDLING = 39;
|
||||
public const DATA_FLAG_EVOKER_SPELL = 40;
|
||||
public const DATA_FLAG_CHARGE_ATTACK = 41;
|
||||
public const DATA_FLAG_WASD_CONTROLLED = 42;
|
||||
public const DATA_FLAG_CAN_POWER_JUMP = 43;
|
||||
public const DATA_FLAG_LINGER = 44;
|
||||
public const DATA_FLAG_HAS_COLLISION = 45;
|
||||
public const DATA_FLAG_AFFECTED_BY_GRAVITY = 46;
|
||||
public const DATA_FLAG_FIRE_IMMUNE = 47;
|
||||
public const DATA_FLAG_DANCING = 48;
|
||||
public const DATA_FLAG_WALKER = 22;
|
||||
public const DATA_FLAG_RESTING = 23;
|
||||
public const DATA_FLAG_SITTING = 24;
|
||||
public const DATA_FLAG_ANGRY = 25;
|
||||
public const DATA_FLAG_INTERESTED = 26;
|
||||
public const DATA_FLAG_CHARGED = 27;
|
||||
public const DATA_FLAG_TAMED = 28;
|
||||
public const DATA_FLAG_LEASHED = 29;
|
||||
public const DATA_FLAG_SHEARED = 30;
|
||||
public const DATA_FLAG_GLIDING = 31;
|
||||
public const DATA_FLAG_ELDER = 32;
|
||||
public const DATA_FLAG_MOVING = 33;
|
||||
public const DATA_FLAG_BREATHING = 34;
|
||||
public const DATA_FLAG_CHESTED = 35;
|
||||
public const DATA_FLAG_STACKABLE = 36;
|
||||
public const DATA_FLAG_SHOWBASE = 37;
|
||||
public const DATA_FLAG_REARING = 38;
|
||||
public const DATA_FLAG_VIBRATING = 39;
|
||||
public const DATA_FLAG_IDLING = 40;
|
||||
public const DATA_FLAG_EVOKER_SPELL = 41;
|
||||
public const DATA_FLAG_CHARGE_ATTACK = 42;
|
||||
public const DATA_FLAG_WASD_CONTROLLED = 43;
|
||||
public const DATA_FLAG_CAN_POWER_JUMP = 44;
|
||||
public const DATA_FLAG_LINGER = 45;
|
||||
public const DATA_FLAG_HAS_COLLISION = 46;
|
||||
public const DATA_FLAG_AFFECTED_BY_GRAVITY = 47;
|
||||
public const DATA_FLAG_FIRE_IMMUNE = 48;
|
||||
public const DATA_FLAG_DANCING = 49;
|
||||
public const DATA_FLAG_ENCHANTED = 50;
|
||||
|
||||
public static $entityCount = 1;
|
||||
/** @var Entity[] */
|
||||
|
@ -54,9 +54,9 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
public const DATA_PLAYER_FLAG_SLEEP = 1;
|
||||
public const DATA_PLAYER_FLAG_DEAD = 2; //TODO: CHECK
|
||||
|
||||
public const DATA_PLAYER_FLAGS = 27;
|
||||
public const DATA_PLAYER_FLAGS = 26;
|
||||
|
||||
public const DATA_PLAYER_BED_POSITION = 29;
|
||||
public const DATA_PLAYER_BED_POSITION = 28;
|
||||
|
||||
/** @var PlayerInventory */
|
||||
protected $inventory;
|
||||
|
@ -47,7 +47,7 @@ class Skin{
|
||||
public function isValid() : bool{
|
||||
return (
|
||||
$this->skinId !== "" and
|
||||
(($s = strlen($this->skinData)) === 16384 or $s === 8192) and
|
||||
(($s = strlen($this->skinData)) === 16384 or $s === 8192 or $s === 65536) and
|
||||
($this->capeData === "" or strlen($this->capeData) === 8192)
|
||||
);
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ class FallingBlock extends Entity{
|
||||
|
||||
$this->block = BlockFactory::get($blockId, $damage);
|
||||
|
||||
$this->propertyManager->setInt(self::DATA_VARIANT, $this->block->getId() | ($this->block->getDamage() << 8));
|
||||
$this->propertyManager->setInt(self::DATA_VARIANT, BlockFactory::toStaticRuntimeId($this->block->getId(), $this->block->getDamage()));
|
||||
}
|
||||
|
||||
public function canCollideWith(Entity $entity) : bool{
|
||||
|
@ -893,14 +893,16 @@ class Level implements ChunkManager, Metadatable{
|
||||
$pk->z = $b->z;
|
||||
|
||||
if($b instanceof Block){
|
||||
$pk->blockId = $b->getId();
|
||||
$pk->blockData = $b->getDamage();
|
||||
$blockId = $b->getId();
|
||||
$blockData = $b->getDamage();
|
||||
}else{
|
||||
$fullBlock = $this->getFullBlock($b->x, $b->y, $b->z);
|
||||
$pk->blockId = $fullBlock >> 4;
|
||||
$pk->blockData = $fullBlock & 0xf;
|
||||
$blockId = $fullBlock >> 4;
|
||||
$blockData = $fullBlock & 0xf;
|
||||
}
|
||||
|
||||
$pk->blockRuntimeId = BlockFactory::toStaticRuntimeId($blockId, $blockData);
|
||||
|
||||
$pk->flags = $first ? $flags : UpdateBlockPacket::FLAG_NONE;
|
||||
|
||||
$packets[] = $pk;
|
||||
@ -917,14 +919,16 @@ class Level implements ChunkManager, Metadatable{
|
||||
$pk->z = $b->z;
|
||||
|
||||
if($b instanceof Block){
|
||||
$pk->blockId = $b->getId();
|
||||
$pk->blockData = $b->getDamage();
|
||||
$blockId = $b->getId();
|
||||
$blockData = $b->getDamage();
|
||||
}else{
|
||||
$fullBlock = $this->getFullBlock($b->x, $b->y, $b->z);
|
||||
$pk->blockId = $fullBlock >> 4;
|
||||
$pk->blockData = $fullBlock & 0xf;
|
||||
$blockId = $fullBlock >> 4;
|
||||
$blockData = $fullBlock & 0xf;
|
||||
}
|
||||
|
||||
$pk->blockRuntimeId = BlockFactory::toStaticRuntimeId($blockId, $blockData);
|
||||
|
||||
$pk->flags = $flags;
|
||||
|
||||
$packets[] = $pk;
|
||||
@ -1874,7 +1878,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
}
|
||||
|
||||
if($playSound){
|
||||
$this->broadcastLevelSoundEvent($hand, LevelSoundEventPacket::SOUND_PLACE, 1, $hand->getId());
|
||||
$this->broadcastLevelSoundEvent($hand, LevelSoundEventPacket::SOUND_PLACE, 1, BlockFactory::toStaticRuntimeId($hand->getId(), $hand->getDamage()));
|
||||
}
|
||||
|
||||
$item->pop();
|
||||
|
@ -24,11 +24,12 @@ declare(strict_types=1);
|
||||
namespace pocketmine\level\particle;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\BlockFactory;
|
||||
use pocketmine\math\Vector3;
|
||||
|
||||
class DestroyBlockParticle extends DestroyParticle{
|
||||
|
||||
public function __construct(Vector3 $pos, Block $b){
|
||||
parent::__construct($pos, $b->getId() | ($b->getDamage() << 8));
|
||||
parent::__construct($pos, BlockFactory::toStaticRuntimeId($b->getId(), $b->getDamage()));
|
||||
}
|
||||
}
|
||||
|
@ -24,10 +24,11 @@ declare(strict_types=1);
|
||||
namespace pocketmine\level\particle;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\BlockFactory;
|
||||
use pocketmine\math\Vector3;
|
||||
|
||||
class TerrainParticle extends GenericParticle{
|
||||
public function __construct(Vector3 $pos, Block $b){
|
||||
parent::__construct($pos, Particle::TYPE_TERRAIN, ($b->getDamage() << 8) | $b->getId());
|
||||
parent::__construct($pos, Particle::TYPE_TERRAIN, BlockFactory::toStaticRuntimeId($b->getId(), $b->getDamage()));
|
||||
}
|
||||
}
|
||||
|
@ -31,14 +31,14 @@ class AddBehaviorTreePacket extends DataPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::ADD_BEHAVIOR_TREE_PACKET;
|
||||
|
||||
/** @var string */
|
||||
public $unknownString1;
|
||||
public $behaviorTreeJson;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->unknownString1 = $this->getString();
|
||||
$this->behaviorTreeJson = $this->getString();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putString($this->unknownString1);
|
||||
$this->putString($this->behaviorTreeJson);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -44,6 +44,8 @@ class AddItemEntityPacket extends DataPacket{
|
||||
public $motion;
|
||||
/** @var array */
|
||||
public $metadata = [];
|
||||
/** @var bool */
|
||||
public $isFromFishing = false;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->entityUniqueId = $this->getEntityUniqueId();
|
||||
@ -52,6 +54,7 @@ class AddItemEntityPacket extends DataPacket{
|
||||
$this->position = $this->getVector3();
|
||||
$this->motion = $this->getVector3();
|
||||
$this->metadata = $this->getEntityMetadata();
|
||||
$this->isFromFishing = $this->getBool();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
@ -61,6 +64,7 @@ class AddItemEntityPacket extends DataPacket{
|
||||
$this->putVector3($this->position);
|
||||
$this->putVector3Nullable($this->motion);
|
||||
$this->putEntityMetadata($this->metadata);
|
||||
$this->putBool($this->isFromFishing);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -38,10 +38,16 @@ class AddPlayerPacket extends DataPacket{
|
||||
public $uuid;
|
||||
/** @var string */
|
||||
public $username;
|
||||
/** @var string */
|
||||
public $thirdPartyName = "";
|
||||
/** @var int */
|
||||
public $platform = 0;
|
||||
/** @var int|null */
|
||||
public $entityUniqueId = null; //TODO
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
/** @var string */
|
||||
public $platformChatId = "";
|
||||
/** @var Vector3 */
|
||||
public $position;
|
||||
/** @var Vector3|null */
|
||||
@ -72,8 +78,11 @@ class AddPlayerPacket extends DataPacket{
|
||||
protected function decodePayload(){
|
||||
$this->uuid = $this->getUUID();
|
||||
$this->username = $this->getString();
|
||||
$this->thirdPartyName = $this->getString();
|
||||
$this->platform = $this->getVarInt();
|
||||
$this->entityUniqueId = $this->getEntityUniqueId();
|
||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||
$this->platformChatId = $this->getString();
|
||||
$this->position = $this->getVector3();
|
||||
$this->motion = $this->getVector3();
|
||||
$this->pitch = $this->getLFloat();
|
||||
@ -99,8 +108,11 @@ class AddPlayerPacket extends DataPacket{
|
||||
protected function encodePayload(){
|
||||
$this->putUUID($this->uuid);
|
||||
$this->putString($this->username);
|
||||
$this->putString($this->thirdPartyName);
|
||||
$this->putVarInt($this->platform);
|
||||
$this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
|
||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$this->putString($this->platformChatId);
|
||||
$this->putVector3($this->position);
|
||||
$this->putVector3Nullable($this->motion);
|
||||
$this->putLFloat($this->pitch);
|
||||
|
@ -54,6 +54,8 @@ class BookEditPacket extends DataPacket{
|
||||
public $title;
|
||||
/** @var string */
|
||||
public $author;
|
||||
/** @var string */
|
||||
public $xuid;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->type = $this->getByte();
|
||||
@ -76,6 +78,7 @@ class BookEditPacket extends DataPacket{
|
||||
case self::TYPE_SIGN_BOOK:
|
||||
$this->title = $this->getString();
|
||||
$this->author = $this->getString();
|
||||
$this->xuid = $this->getString();
|
||||
break;
|
||||
default:
|
||||
throw new \UnexpectedValueException("Unknown book edit type $this->type!");
|
||||
@ -103,6 +106,7 @@ class BookEditPacket extends DataPacket{
|
||||
case self::TYPE_SIGN_BOOK:
|
||||
$this->putString($this->title);
|
||||
$this->putString($this->author);
|
||||
$this->putString($this->xuid);
|
||||
break;
|
||||
default:
|
||||
throw new \UnexpectedValueException("Unknown book edit type $this->type!");
|
||||
|
@ -36,18 +36,18 @@ class EntityFallPacket extends DataPacket{
|
||||
/** @var float */
|
||||
public $fallDistance;
|
||||
/** @var bool */
|
||||
public $bool1;
|
||||
public $isInVoid;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||
$this->fallDistance = $this->getLFloat();
|
||||
$this->bool1 = $this->getBool();
|
||||
$this->isInVoid = $this->getBool();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$this->putLFloat($this->fallDistance);
|
||||
$this->putBool($this->bool1);
|
||||
$this->putBool($this->isInVoid);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -69,134 +69,146 @@ class LevelSoundEventPacket extends DataPacket{
|
||||
public const SOUND_LAND = 35;
|
||||
public const SOUND_SADDLE = 36;
|
||||
public const SOUND_ARMOR = 37;
|
||||
public const SOUND_ADD_CHEST = 38;
|
||||
public const SOUND_THROW = 39;
|
||||
public const SOUND_ATTACK = 40;
|
||||
public const SOUND_ATTACK_NODAMAGE = 41;
|
||||
public const SOUND_ATTACK_STRONG = 42;
|
||||
public const SOUND_WARN = 43;
|
||||
public const SOUND_SHEAR = 44;
|
||||
public const SOUND_MILK = 45;
|
||||
public const SOUND_THUNDER = 46;
|
||||
public const SOUND_EXPLODE = 47;
|
||||
public const SOUND_FIRE = 48;
|
||||
public const SOUND_IGNITE = 49;
|
||||
public const SOUND_FUSE = 50;
|
||||
public const SOUND_STARE = 51;
|
||||
public const SOUND_SPAWN = 52;
|
||||
public const SOUND_SHOOT = 53;
|
||||
public const SOUND_BREAK_BLOCK = 54;
|
||||
public const SOUND_LAUNCH = 55;
|
||||
public const SOUND_BLAST = 56;
|
||||
public const SOUND_LARGE_BLAST = 57;
|
||||
public const SOUND_TWINKLE = 58;
|
||||
public const SOUND_REMEDY = 59;
|
||||
public const SOUND_UNFECT = 60;
|
||||
public const SOUND_LEVELUP = 61;
|
||||
public const SOUND_BOW_HIT = 62;
|
||||
public const SOUND_BULLET_HIT = 63;
|
||||
public const SOUND_EXTINGUISH_FIRE = 64;
|
||||
public const SOUND_ITEM_FIZZ = 65;
|
||||
public const SOUND_CHEST_OPEN = 66;
|
||||
public const SOUND_CHEST_CLOSED = 67;
|
||||
public const SOUND_SHULKERBOX_OPEN = 68;
|
||||
public const SOUND_SHULKERBOX_CLOSED = 69;
|
||||
public const SOUND_POWER_ON = 70;
|
||||
public const SOUND_POWER_OFF = 71;
|
||||
public const SOUND_ATTACH = 72;
|
||||
public const SOUND_DETACH = 73;
|
||||
public const SOUND_DENY = 74;
|
||||
public const SOUND_TRIPOD = 75;
|
||||
public const SOUND_POP = 76;
|
||||
public const SOUND_DROP_SLOT = 77;
|
||||
public const SOUND_NOTE = 78;
|
||||
public const SOUND_THORNS = 79;
|
||||
public const SOUND_PISTON_IN = 80;
|
||||
public const SOUND_PISTON_OUT = 81;
|
||||
public const SOUND_PORTAL = 82;
|
||||
public const SOUND_WATER = 83;
|
||||
public const SOUND_LAVA_POP = 84;
|
||||
public const SOUND_LAVA = 85;
|
||||
public const SOUND_BURP = 86;
|
||||
public const SOUND_BUCKET_FILL_WATER = 87;
|
||||
public const SOUND_BUCKET_FILL_LAVA = 88;
|
||||
public const SOUND_BUCKET_EMPTY_WATER = 89;
|
||||
public const SOUND_BUCKET_EMPTY_LAVA = 90;
|
||||
public const SOUND_RECORD_13 = 91;
|
||||
public const SOUND_RECORD_CAT = 92;
|
||||
public const SOUND_RECORD_BLOCKS = 93;
|
||||
public const SOUND_RECORD_CHIRP = 94;
|
||||
public const SOUND_RECORD_FAR = 95;
|
||||
public const SOUND_RECORD_MALL = 96;
|
||||
public const SOUND_RECORD_MELLOHI = 97;
|
||||
public const SOUND_RECORD_STAL = 98;
|
||||
public const SOUND_RECORD_STRAD = 99;
|
||||
public const SOUND_RECORD_WARD = 100;
|
||||
public const SOUND_RECORD_11 = 101;
|
||||
public const SOUND_RECORD_WAIT = 102;
|
||||
public const SOUND_GUARDIAN_FLOP = 104;
|
||||
public const SOUND_ELDERGUARDIAN_CURSE = 105;
|
||||
public const SOUND_MOB_WARNING = 106;
|
||||
public const SOUND_MOB_WARNING_BABY = 107;
|
||||
public const SOUND_TELEPORT = 108;
|
||||
public const SOUND_SHULKER_OPEN = 109;
|
||||
public const SOUND_SHULKER_CLOSE = 110;
|
||||
public const SOUND_HAGGLE = 111;
|
||||
public const SOUND_HAGGLE_YES = 112;
|
||||
public const SOUND_HAGGLE_NO = 113;
|
||||
public const SOUND_HAGGLE_IDLE = 114;
|
||||
public const SOUND_CHORUSGROW = 115;
|
||||
public const SOUND_CHORUSDEATH = 116;
|
||||
public const SOUND_GLASS = 117;
|
||||
public const SOUND_CAST_SPELL = 118;
|
||||
public const SOUND_PREPARE_ATTACK = 119;
|
||||
public const SOUND_PREPARE_SUMMON = 120;
|
||||
public const SOUND_PREPARE_WOLOLO = 121;
|
||||
public const SOUND_FANG = 122;
|
||||
public const SOUND_CHARGE = 123;
|
||||
public const SOUND_CAMERA_TAKE_PICTURE = 124;
|
||||
public const SOUND_LEASHKNOT_PLACE = 125;
|
||||
public const SOUND_LEASHKNOT_BREAK = 126;
|
||||
public const SOUND_GROWL = 127;
|
||||
public const SOUND_WHINE = 128;
|
||||
public const SOUND_PANT = 129;
|
||||
public const SOUND_PURR = 130;
|
||||
public const SOUND_PURREOW = 131;
|
||||
public const SOUND_DEATH_MIN_VOLUME = 132;
|
||||
public const SOUND_DEATH_MID_VOLUME = 133;
|
||||
public const SOUND_IMITATE_BLAZE = 134;
|
||||
public const SOUND_IMITATE_CAVE_SPIDER = 135;
|
||||
public const SOUND_IMITATE_CREEPER = 136;
|
||||
public const SOUND_IMITATE_ELDER_GUARDIAN = 137;
|
||||
public const SOUND_IMITATE_ENDER_DRAGON = 138;
|
||||
public const SOUND_IMITATE_ENDERMAN = 139;
|
||||
public const SOUND_IMITATE_EVOCATION_ILLAGER = 141;
|
||||
public const SOUND_IMITATE_GHAST = 142;
|
||||
public const SOUND_IMITATE_HUSK = 143;
|
||||
public const SOUND_IMITATE_ILLUSION_ILLAGER = 144;
|
||||
public const SOUND_IMITATE_MAGMA_CUBE = 145;
|
||||
public const SOUND_IMITATE_POLAR_BEAR = 146;
|
||||
public const SOUND_IMITATE_SHULKER = 147;
|
||||
public const SOUND_IMITATE_SILVERFISH = 148;
|
||||
public const SOUND_IMITATE_SKELETON = 149;
|
||||
public const SOUND_IMITATE_SLIME = 150;
|
||||
public const SOUND_IMITATE_SPIDER = 151;
|
||||
public const SOUND_IMITATE_STRAY = 152;
|
||||
public const SOUND_IMITATE_VEX = 153;
|
||||
public const SOUND_IMITATE_VINDICATION_ILLAGER = 154;
|
||||
public const SOUND_IMITATE_WITCH = 155;
|
||||
public const SOUND_IMITATE_WITHER = 156;
|
||||
public const SOUND_IMITATE_WITHER_SKELETON = 157;
|
||||
public const SOUND_IMITATE_WOLF = 158;
|
||||
public const SOUND_IMITATE_ZOMBIE = 159;
|
||||
public const SOUND_IMITATE_ZOMBIE_PIGMAN = 160;
|
||||
public const SOUND_IMITATE_ZOMBIE_VILLAGER = 161;
|
||||
public const SOUND_BLOCK_END_PORTAL_FRAME_FILL = 162;
|
||||
public const SOUND_BLOCK_END_PORTAL_SPAWN = 163;
|
||||
public const SOUND_RANDOM_ANVIL_USE = 164;
|
||||
public const SOUND_BOTTLE_DRAGONBREATH = 165;
|
||||
public const SOUND_DEFAULT = 166;
|
||||
public const SOUND_UNDEFINED = 167;
|
||||
public const SOUND_MOB_ARMOR_STAND_PLACE = 38;
|
||||
public const SOUND_ADD_CHEST = 39;
|
||||
public const SOUND_THROW = 40;
|
||||
public const SOUND_ATTACK = 41;
|
||||
public const SOUND_ATTACK_NODAMAGE = 42;
|
||||
public const SOUND_ATTACK_STRONG = 43;
|
||||
public const SOUND_WARN = 44;
|
||||
public const SOUND_SHEAR = 45;
|
||||
public const SOUND_MILK = 46;
|
||||
public const SOUND_THUNDER = 47;
|
||||
public const SOUND_EXPLODE = 48;
|
||||
public const SOUND_FIRE = 49;
|
||||
public const SOUND_IGNITE = 50;
|
||||
public const SOUND_FUSE = 51;
|
||||
public const SOUND_STARE = 52;
|
||||
public const SOUND_SPAWN = 53;
|
||||
public const SOUND_SHOOT = 54;
|
||||
public const SOUND_BREAK_BLOCK = 55;
|
||||
public const SOUND_LAUNCH = 56;
|
||||
public const SOUND_BLAST = 57;
|
||||
public const SOUND_LARGE_BLAST = 58;
|
||||
public const SOUND_TWINKLE = 59;
|
||||
public const SOUND_REMEDY = 60;
|
||||
public const SOUND_UNFECT = 61;
|
||||
public const SOUND_LEVELUP = 62;
|
||||
public const SOUND_BOW_HIT = 63;
|
||||
public const SOUND_BULLET_HIT = 64;
|
||||
public const SOUND_EXTINGUISH_FIRE = 65;
|
||||
public const SOUND_ITEM_FIZZ = 66;
|
||||
public const SOUND_CHEST_OPEN = 67;
|
||||
public const SOUND_CHEST_CLOSED = 68;
|
||||
public const SOUND_SHULKERBOX_OPEN = 69;
|
||||
public const SOUND_SHULKERBOX_CLOSED = 70;
|
||||
public const SOUND_ENDERCHEST_OPEN = 71;
|
||||
public const SOUND_ENDERCHEST_CLOSED = 72;
|
||||
public const SOUND_POWER_ON = 73;
|
||||
public const SOUND_POWER_OFF = 74;
|
||||
public const SOUND_ATTACH = 75;
|
||||
public const SOUND_DETACH = 76;
|
||||
public const SOUND_DENY = 77;
|
||||
public const SOUND_TRIPOD = 78;
|
||||
public const SOUND_POP = 79;
|
||||
public const SOUND_DROP_SLOT = 80;
|
||||
public const SOUND_NOTE = 81;
|
||||
public const SOUND_THORNS = 82;
|
||||
public const SOUND_PISTON_IN = 83;
|
||||
public const SOUND_PISTON_OUT = 84;
|
||||
public const SOUND_PORTAL = 85;
|
||||
public const SOUND_WATER = 86;
|
||||
public const SOUND_LAVA_POP = 87;
|
||||
public const SOUND_LAVA = 88;
|
||||
public const SOUND_BURP = 89;
|
||||
public const SOUND_BUCKET_FILL_WATER = 90;
|
||||
public const SOUND_BUCKET_FILL_LAVA = 91;
|
||||
public const SOUND_BUCKET_EMPTY_WATER = 92;
|
||||
public const SOUND_BUCKET_EMPTY_LAVA = 93;
|
||||
public const SOUND_ARMOR_EQUIP_CHAIN = 94;
|
||||
public const SOUND_ARMOR_EQUIP_DIAMOND = 95;
|
||||
public const SOUND_ARMOR_EQUIP_GENERIC = 96;
|
||||
public const SOUND_ARMOR_EQUIP_GOLD = 97;
|
||||
public const SOUND_ARMOR_EQUIP_IRON = 98;
|
||||
public const SOUND_ARMOR_EQUIP_LEATHER = 99;
|
||||
public const SOUND_ARMOR_EQUIP_ELYTRA = 100;
|
||||
public const SOUND_RECORD_13 = 101;
|
||||
public const SOUND_RECORD_CAT = 102;
|
||||
public const SOUND_RECORD_BLOCKS = 103;
|
||||
public const SOUND_RECORD_CHIRP = 104;
|
||||
public const SOUND_RECORD_FAR = 105;
|
||||
public const SOUND_RECORD_MALL = 106;
|
||||
public const SOUND_RECORD_MELLOHI = 107;
|
||||
public const SOUND_RECORD_STAL = 108;
|
||||
public const SOUND_RECORD_STRAD = 109;
|
||||
public const SOUND_RECORD_WARD = 110;
|
||||
public const SOUND_RECORD_11 = 111;
|
||||
public const SOUND_RECORD_WAIT = 112;
|
||||
public const SOUND_GUARDIAN_FLOP = 114;
|
||||
public const SOUND_ELDERGUARDIAN_CURSE = 115;
|
||||
public const SOUND_MOB_WARNING = 116;
|
||||
public const SOUND_MOB_WARNING_BABY = 117;
|
||||
public const SOUND_TELEPORT = 118;
|
||||
public const SOUND_SHULKER_OPEN = 119;
|
||||
public const SOUND_SHULKER_CLOSE = 120;
|
||||
public const SOUND_HAGGLE = 121;
|
||||
public const SOUND_HAGGLE_YES = 122;
|
||||
public const SOUND_HAGGLE_NO = 123;
|
||||
public const SOUND_HAGGLE_IDLE = 124;
|
||||
public const SOUND_CHORUSGROW = 125;
|
||||
public const SOUND_CHORUSDEATH = 126;
|
||||
public const SOUND_GLASS = 127;
|
||||
public const SOUND_POTION_BREWED = 128;
|
||||
public const SOUND_CAST_SPELL = 129;
|
||||
public const SOUND_PREPARE_ATTACK = 130;
|
||||
public const SOUND_PREPARE_SUMMON = 131;
|
||||
public const SOUND_PREPARE_WOLOLO = 132;
|
||||
public const SOUND_FANG = 133;
|
||||
public const SOUND_CHARGE = 134;
|
||||
public const SOUND_CAMERA_TAKE_PICTURE = 135;
|
||||
public const SOUND_LEASHKNOT_PLACE = 136;
|
||||
public const SOUND_LEASHKNOT_BREAK = 137;
|
||||
public const SOUND_GROWL = 138;
|
||||
public const SOUND_WHINE = 139;
|
||||
public const SOUND_PANT = 140;
|
||||
public const SOUND_PURR = 141;
|
||||
public const SOUND_PURREOW = 142;
|
||||
public const SOUND_DEATH_MIN_VOLUME = 143;
|
||||
public const SOUND_DEATH_MID_VOLUME = 144;
|
||||
public const SOUND_IMITATE_BLAZE = 145;
|
||||
public const SOUND_IMITATE_CAVE_SPIDER = 146;
|
||||
public const SOUND_IMITATE_CREEPER = 147;
|
||||
public const SOUND_IMITATE_ELDER_GUARDIAN = 148;
|
||||
public const SOUND_IMITATE_ENDER_DRAGON = 149;
|
||||
public const SOUND_IMITATE_ENDERMAN = 150;
|
||||
public const SOUND_IMITATE_EVOCATION_ILLAGER = 152;
|
||||
public const SOUND_IMITATE_GHAST = 153;
|
||||
public const SOUND_IMITATE_HUSK = 154;
|
||||
public const SOUND_IMITATE_ILLUSION_ILLAGER = 155;
|
||||
public const SOUND_IMITATE_MAGMA_CUBE = 156;
|
||||
public const SOUND_IMITATE_POLAR_BEAR = 157;
|
||||
public const SOUND_IMITATE_SHULKER = 158;
|
||||
public const SOUND_IMITATE_SILVERFISH = 159;
|
||||
public const SOUND_IMITATE_SKELETON = 160;
|
||||
public const SOUND_IMITATE_SLIME = 161;
|
||||
public const SOUND_IMITATE_SPIDER = 162;
|
||||
public const SOUND_IMITATE_STRAY = 163;
|
||||
public const SOUND_IMITATE_VEX = 164;
|
||||
public const SOUND_IMITATE_VINDICATION_ILLAGER = 165;
|
||||
public const SOUND_IMITATE_WITCH = 166;
|
||||
public const SOUND_IMITATE_WITHER = 167;
|
||||
public const SOUND_IMITATE_WITHER_SKELETON = 168;
|
||||
public const SOUND_IMITATE_WOLF = 169;
|
||||
public const SOUND_IMITATE_ZOMBIE = 170;
|
||||
public const SOUND_IMITATE_ZOMBIE_PIGMAN = 171;
|
||||
public const SOUND_IMITATE_ZOMBIE_VILLAGER = 172;
|
||||
public const SOUND_BLOCK_END_PORTAL_FRAME_FILL = 173;
|
||||
public const SOUND_BLOCK_END_PORTAL_SPAWN = 174;
|
||||
public const SOUND_RANDOM_ANVIL_USE = 175;
|
||||
public const SOUND_BOTTLE_DRAGONBREATH = 176;
|
||||
public const SOUND_PORTAL_TRAVEL = 177;
|
||||
public const SOUND_DEFAULT = 178;
|
||||
public const SOUND_UNDEFINED = 179;
|
||||
|
||||
/** @var int */
|
||||
public $sound;
|
||||
|
@ -54,9 +54,9 @@ class MovePlayerPacket extends DataPacket{
|
||||
/** @var int */
|
||||
public $ridingEid = 0;
|
||||
/** @var int */
|
||||
public $int1 = 0;
|
||||
public $teleportCause = 0;
|
||||
/** @var int */
|
||||
public $int2 = 0;
|
||||
public $teleportItem = 0;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||
@ -68,8 +68,8 @@ class MovePlayerPacket extends DataPacket{
|
||||
$this->onGround = $this->getBool();
|
||||
$this->ridingEid = $this->getEntityRuntimeId();
|
||||
if($this->mode === MovePlayerPacket::MODE_TELEPORT){
|
||||
$this->int1 = $this->getLInt();
|
||||
$this->int2 = $this->getLInt();
|
||||
$this->teleportCause = $this->getLInt();
|
||||
$this->teleportItem = $this->getLInt();
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,8 +83,8 @@ class MovePlayerPacket extends DataPacket{
|
||||
$this->putBool($this->onGround);
|
||||
$this->putEntityRuntimeId($this->ridingEid);
|
||||
if($this->mode === MovePlayerPacket::MODE_TELEPORT){
|
||||
$this->putLInt($this->int1);
|
||||
$this->putLInt($this->int2);
|
||||
$this->putLInt($this->teleportCause);
|
||||
$this->putLInt($this->teleportItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,9 @@ use pocketmine\network\mcpe\protocol\types\ContainerIds;
|
||||
use pocketmine\utils\Binary;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* One of the most useless packets.
|
||||
*/
|
||||
class PlayerHotbarPacket extends DataPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::PLAYER_HOTBAR_PACKET;
|
||||
|
||||
@ -38,28 +41,18 @@ class PlayerHotbarPacket extends DataPacket{
|
||||
public $selectedHotbarSlot;
|
||||
/** @var int */
|
||||
public $windowId = ContainerIds::INVENTORY;
|
||||
/** @var int[] */
|
||||
public $slots = [];
|
||||
/** @var bool */
|
||||
public $selectHotbarSlot = true;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->selectedHotbarSlot = $this->getUnsignedVarInt();
|
||||
$this->windowId = $this->getByte();
|
||||
$count = $this->getUnsignedVarInt();
|
||||
for($i = 0; $i < $count; ++$i){
|
||||
$this->slots[$i] = Binary::signInt($this->getUnsignedVarInt());
|
||||
}
|
||||
$this->selectHotbarSlot = $this->getBool();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putUnsignedVarInt($this->selectedHotbarSlot);
|
||||
$this->putByte($this->windowId);
|
||||
$this->putUnsignedVarInt(count($this->slots));
|
||||
foreach($this->slots as $slot){
|
||||
$this->putUnsignedVarInt($slot);
|
||||
}
|
||||
$this->putBool($this->selectHotbarSlot);
|
||||
}
|
||||
|
||||
|
@ -36,22 +36,22 @@ class PlayerInputPacket extends DataPacket{
|
||||
/** @var float */
|
||||
public $motionY;
|
||||
/** @var bool */
|
||||
public $unknownBool1;
|
||||
public $jumping;
|
||||
/** @var bool */
|
||||
public $unknownBool2;
|
||||
public $sneaking;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->motionX = $this->getLFloat();
|
||||
$this->motionY = $this->getLFloat();
|
||||
$this->unknownBool1 = $this->getBool();
|
||||
$this->unknownBool2 = $this->getBool();
|
||||
$this->jumping = $this->getBool();
|
||||
$this->sneaking = $this->getBool();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putLFloat($this->motionX);
|
||||
$this->putLFloat($this->motionY);
|
||||
$this->putBool($this->unknownBool1);
|
||||
$this->putBool($this->unknownBool2);
|
||||
$this->putBool($this->jumping);
|
||||
$this->putBool($this->sneaking);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -56,14 +56,24 @@ class PlayerListPacket extends DataPacket{
|
||||
$entry->uuid = $this->getUUID();
|
||||
$entry->entityUniqueId = $this->getEntityUniqueId();
|
||||
$entry->username = $this->getString();
|
||||
$entry->thirdPartyName = $this->getString();
|
||||
$entry->platform = $this->getVarInt();
|
||||
|
||||
$skinId = $this->getString();
|
||||
$skinData = $this->getString();
|
||||
$capeData = $this->getString();
|
||||
$geometryName = $this->getString();
|
||||
$geometryData = $this->getString();
|
||||
|
||||
$entry->skin = new Skin(
|
||||
$this->getString(), //id
|
||||
$this->getString(), //data
|
||||
$this->getString(), //cape
|
||||
$this->getString(), //geometry name
|
||||
$this->getString() //geometry data
|
||||
$skinId,
|
||||
$skinData,
|
||||
$capeData,
|
||||
$geometryName,
|
||||
$geometryData
|
||||
);
|
||||
$entry->xboxUserId = $this->getString();
|
||||
$this->getString(); //unknown
|
||||
}else{
|
||||
$entry->uuid = $this->getUUID();
|
||||
}
|
||||
@ -80,12 +90,15 @@ class PlayerListPacket extends DataPacket{
|
||||
$this->putUUID($entry->uuid);
|
||||
$this->putEntityUniqueId($entry->entityUniqueId);
|
||||
$this->putString($entry->username);
|
||||
$this->putString($entry->thirdPartyName);
|
||||
$this->putVarInt($entry->platform);
|
||||
$this->putString($entry->skin->getSkinId());
|
||||
$this->putString($entry->skin->getSkinData());
|
||||
$this->putString($entry->skin->getCapeData());
|
||||
$this->putString($entry->skin->getGeometryName());
|
||||
$this->putString($entry->skin->getGeometryData());
|
||||
$this->putString($entry->xboxUserId);
|
||||
$this->putString("");
|
||||
}else{
|
||||
$this->putUUID($entry->uuid);
|
||||
}
|
||||
|
@ -39,15 +39,15 @@ interface ProtocolInfo{
|
||||
/**
|
||||
* Actual Minecraft: PE protocol version
|
||||
*/
|
||||
public const CURRENT_PROTOCOL = 201;
|
||||
public const CURRENT_PROTOCOL = 223;
|
||||
/**
|
||||
* Current Minecraft PE version reported by the server. This is usually the earliest currently supported version.
|
||||
*/
|
||||
public const MINECRAFT_VERSION = 'v1.2.10';
|
||||
public const MINECRAFT_VERSION = 'v1.2.13';
|
||||
/**
|
||||
* Version number sent to clients in ping responses.
|
||||
*/
|
||||
public const MINECRAFT_VERSION_NETWORK = '1.2.10';
|
||||
public const MINECRAFT_VERSION_NETWORK = '1.2.13';
|
||||
|
||||
public const LOGIN_PACKET = 0x01;
|
||||
public const PLAY_STATUS_PACKET = 0x02;
|
||||
|
@ -30,15 +30,18 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class SimpleEventPacket extends DataPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::SIMPLE_EVENT_PACKET;
|
||||
|
||||
public const TYPE_ENABLE_COMMANDS = 1;
|
||||
public const TYPE_DISABLE_COMMANDS = 2;
|
||||
|
||||
/** @var int */
|
||||
public $unknownShort1;
|
||||
public $eventType;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->unknownShort1 = $this->getLShort();
|
||||
$this->eventType = $this->getLShort();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putLShort($this->unknownShort1);
|
||||
$this->putLShort($this->eventType);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -98,6 +98,12 @@ class StartGamePacket extends DataPacket{
|
||||
public $xboxLiveBroadcastMode = 0; //TODO: find values
|
||||
/** @var int */
|
||||
public $serverChunkTickRadius = 4; //TODO (leave as default for now)
|
||||
/** @var bool */
|
||||
public $hasPlatformBroadcast = false;
|
||||
/** @var int */
|
||||
public $platformBroadcastMode = 0;
|
||||
/** @var bool */
|
||||
public $xboxLiveBroadcastIntent = false;
|
||||
|
||||
/** @var string */
|
||||
public $levelId = ""; //base64 string, usually the same as world folder name in vanilla
|
||||
@ -146,6 +152,9 @@ class StartGamePacket extends DataPacket{
|
||||
$this->defaultPlayerPermission = $this->getVarInt();
|
||||
$this->xboxLiveBroadcastMode = $this->getVarInt();
|
||||
$this->serverChunkTickRadius = $this->getLInt();
|
||||
$this->hasPlatformBroadcast = $this->getBool();
|
||||
$this->platformBroadcastMode = $this->getUnsignedVarInt();
|
||||
$this->xboxLiveBroadcastIntent = $this->getBool();
|
||||
|
||||
$this->levelId = $this->getString();
|
||||
$this->worldName = $this->getString();
|
||||
@ -190,6 +199,9 @@ class StartGamePacket extends DataPacket{
|
||||
$this->putVarInt($this->defaultPlayerPermission);
|
||||
$this->putVarInt($this->xboxLiveBroadcastMode);
|
||||
$this->putLInt($this->serverChunkTickRadius);
|
||||
$this->putBool($this->hasPlatformBroadcast);
|
||||
$this->putUnsignedVarInt($this->platformBroadcastMode);
|
||||
$this->putBool($this->xboxLiveBroadcastIntent);
|
||||
|
||||
$this->putString($this->levelId);
|
||||
$this->putString($this->worldName);
|
||||
|
@ -46,13 +46,19 @@ class TextPacket extends DataPacket{
|
||||
/** @var bool */
|
||||
public $needsTranslation = false;
|
||||
/** @var string */
|
||||
public $source;
|
||||
public $sourceName;
|
||||
/** @var string */
|
||||
public $sourceThirdPartyName = "";
|
||||
/** @var int */
|
||||
public $sourcePlatform = 0;
|
||||
/** @var string */
|
||||
public $message;
|
||||
/** @var string[] */
|
||||
public $parameters = [];
|
||||
/** @var string */
|
||||
public $xboxUserId = "";
|
||||
/** @var string */
|
||||
public $platformChatId = "";
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->type = $this->getByte();
|
||||
@ -62,7 +68,9 @@ class TextPacket extends DataPacket{
|
||||
case self::TYPE_WHISPER:
|
||||
/** @noinspection PhpMissingBreakStatementInspection */
|
||||
case self::TYPE_ANNOUNCEMENT:
|
||||
$this->source = $this->getString();
|
||||
$this->sourceName = $this->getString();
|
||||
$this->sourceThirdPartyName = $this->getString();
|
||||
$this->sourcePlatform = $this->getVarInt();
|
||||
case self::TYPE_RAW:
|
||||
case self::TYPE_TIP:
|
||||
case self::TYPE_SYSTEM:
|
||||
@ -81,6 +89,7 @@ class TextPacket extends DataPacket{
|
||||
}
|
||||
|
||||
$this->xboxUserId = $this->getString();
|
||||
$this->platformChatId = $this->getString();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
@ -91,7 +100,9 @@ class TextPacket extends DataPacket{
|
||||
case self::TYPE_WHISPER:
|
||||
/** @noinspection PhpMissingBreakStatementInspection */
|
||||
case self::TYPE_ANNOUNCEMENT:
|
||||
$this->putString($this->source);
|
||||
$this->putString($this->sourceName);
|
||||
$this->putString($this->sourceThirdPartyName);
|
||||
$this->putVarInt($this->sourcePlatform);
|
||||
case self::TYPE_RAW:
|
||||
case self::TYPE_TIP:
|
||||
case self::TYPE_SYSTEM:
|
||||
@ -110,6 +121,7 @@ class TextPacket extends DataPacket{
|
||||
}
|
||||
|
||||
$this->putString($this->xboxUserId);
|
||||
$this->putString($this->platformChatId);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -47,24 +47,20 @@ class UpdateBlockPacket extends DataPacket{
|
||||
/** @var int */
|
||||
public $y;
|
||||
/** @var int */
|
||||
public $blockId;
|
||||
/** @var int */
|
||||
public $blockData;
|
||||
public $blockRuntimeId;
|
||||
/** @var int */
|
||||
public $flags;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->getBlockPosition($this->x, $this->y, $this->z);
|
||||
$this->blockId = $this->getUnsignedVarInt();
|
||||
$aux = $this->getUnsignedVarInt();
|
||||
$this->blockData = $aux & 0x0f;
|
||||
$this->flags = $aux >> 4;
|
||||
$this->blockRuntimeId = $this->getUnsignedVarInt();
|
||||
$this->flags = $this->getUnsignedVarInt();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putBlockPosition($this->x, $this->y, $this->z);
|
||||
$this->putUnsignedVarInt($this->blockId);
|
||||
$this->putUnsignedVarInt(($this->flags << 4) | $this->blockData);
|
||||
$this->putUnsignedVarInt($this->blockRuntimeId);
|
||||
$this->putUnsignedVarInt($this->flags);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -31,14 +31,14 @@ class WSConnectPacket extends DataPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::W_S_CONNECT_PACKET;
|
||||
|
||||
/** @var string */
|
||||
public $string1;
|
||||
public $serverUri;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->string1 = $this->getString();
|
||||
$this->serverUri = $this->getString();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putString($this->string1);
|
||||
$this->putString($this->serverUri);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -34,6 +34,12 @@ class PlayerListEntry{
|
||||
public $entityUniqueId;
|
||||
/** @var string */
|
||||
public $username;
|
||||
/** @var string */
|
||||
public $thirdPartyName = "";
|
||||
/** @var int */
|
||||
public $platform = 0;
|
||||
/** @var string */
|
||||
public $platformChatId = "";
|
||||
/** @var Skin */
|
||||
public $skin;
|
||||
/** @var string */
|
||||
@ -46,11 +52,13 @@ class PlayerListEntry{
|
||||
return $entry;
|
||||
}
|
||||
|
||||
public static function createAdditionEntry(UUID $uuid, int $entityUniqueId, string $username, Skin $skin, string $xboxUserId = "") : PlayerListEntry{
|
||||
public static function createAdditionEntry(UUID $uuid, int $entityUniqueId, string $username, string $thirdPartyName, int $platform, Skin $skin, string $xboxUserId = "") : PlayerListEntry{
|
||||
$entry = new PlayerListEntry();
|
||||
$entry->uuid = $uuid;
|
||||
$entry->entityUniqueId = $entityUniqueId;
|
||||
$entry->username = $username;
|
||||
$entry->thirdPartyName = $thirdPartyName;
|
||||
$entry->platform = $platform;
|
||||
$entry->skin = $skin;
|
||||
$entry->xboxUserId = $xboxUserId;
|
||||
|
||||
|
1
src/pocketmine/resources/runtimeid_table.json
Normal file
1
src/pocketmine/resources/runtimeid_table.json
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user