mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
Protocol changes for 1.9.0
This commit is contained in:
parent
37c2d78731
commit
b8703d5dff
@ -37,7 +37,7 @@ namespace pocketmine {
|
||||
use pocketmine\wizard\SetupWizard;
|
||||
|
||||
const NAME = "PocketMine-MP";
|
||||
const BASE_VERSION = "3.5.11";
|
||||
const BASE_VERSION = "3.6.0";
|
||||
const IS_DEVELOPMENT_BUILD = true;
|
||||
const BUILD_NUMBER = 0;
|
||||
|
||||
|
@ -430,8 +430,13 @@ class BlockFactory{
|
||||
public static function registerStaticRuntimeIdMappings() : void{
|
||||
/** @var mixed[] $runtimeIdMap */
|
||||
$runtimeIdMap = json_decode(file_get_contents(\pocketmine\RESOURCE_PATH . "runtimeid_table.json"), true);
|
||||
$legacyIdMap = json_decode(file_get_contents(\pocketmine\RESOURCE_PATH . "legacy_id_map.json"), true);
|
||||
foreach($runtimeIdMap as $k => $obj){
|
||||
self::registerMapping($k, $obj["id"], $obj["data"]);
|
||||
//this has to use the json offset to make sure the mapping is consistent with what we send over network, even though we aren't using all the entries
|
||||
if(!isset($legacyIdMap[$obj["name"]])){
|
||||
continue;
|
||||
}
|
||||
self::registerMapping($k, $legacyIdMap[$obj["name"]], $obj["data"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ class Item implements ItemIds, \JsonSerializable{
|
||||
/**
|
||||
* Sets the Item's NBT
|
||||
*
|
||||
* @param CompoundTag|string $tags
|
||||
* @param CompoundTag|string|null $tags
|
||||
*
|
||||
* @return Item
|
||||
*/
|
||||
@ -224,7 +224,7 @@ class Item implements ItemIds, \JsonSerializable{
|
||||
if($tags instanceof CompoundTag){
|
||||
$this->setNamedTag($tags);
|
||||
}else{
|
||||
$this->tags = (string) $tags;
|
||||
$this->tags = $tags === null ? "" : (string) $tags;
|
||||
$this->cachedNBT = null;
|
||||
}
|
||||
|
||||
@ -232,6 +232,9 @@ class Item implements ItemIds, \JsonSerializable{
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated This method returns NBT serialized in a network-dependent format. Prefer use of getNamedTag() instead.
|
||||
* @see Item::getNamedTag()
|
||||
*
|
||||
* Returns the serialized NBT of the Item
|
||||
* @return string
|
||||
*/
|
||||
|
@ -300,16 +300,16 @@ class ItemFactory{
|
||||
/**
|
||||
* Returns an instance of the Item with the specified id, meta, count and NBT.
|
||||
*
|
||||
* @param int $id
|
||||
* @param int $meta
|
||||
* @param int $count
|
||||
* @param CompoundTag|string $tags
|
||||
* @param int $id
|
||||
* @param int $meta
|
||||
* @param int $count
|
||||
* @param CompoundTag|string|null $tags
|
||||
*
|
||||
* @return Item
|
||||
* @throws \TypeError
|
||||
*/
|
||||
public static function get(int $id, int $meta = 0, int $count = 1, $tags = "") : Item{
|
||||
if(!is_string($tags) and !($tags instanceof CompoundTag)){
|
||||
public static function get(int $id, int $meta = 0, int $count = 1, $tags = null) : Item{
|
||||
if(!is_string($tags) and !($tags instanceof CompoundTag) and $tags !== null){
|
||||
throw new \TypeError("`tags` argument must be a string or CompoundTag instance, " . (is_object($tags) ? "instance of " . get_class($tags) : gettype($tags)) . " given");
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,8 @@ use pocketmine\entity\Entity;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\item\ItemFactory;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\nbt\NetworkLittleEndianNBTStream;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\network\mcpe\protocol\types\CommandOriginData;
|
||||
use pocketmine\network\mcpe\protocol\types\EntityLink;
|
||||
use pocketmine\utils\BinaryStream;
|
||||
@ -38,6 +40,8 @@ use function count;
|
||||
use function strlen;
|
||||
|
||||
class NetworkBinaryStream extends BinaryStream{
|
||||
/** @var NetworkLittleEndianNBTStream */
|
||||
private static $nbtSerializer = null;
|
||||
|
||||
public function getString() : string{
|
||||
return $this->get($this->getUnsignedVarInt());
|
||||
@ -79,10 +83,17 @@ class NetworkBinaryStream extends BinaryStream{
|
||||
$cnt = $auxValue & 0xff;
|
||||
|
||||
$nbtLen = $this->getLShort();
|
||||
$nbt = "";
|
||||
|
||||
if($nbtLen > 0){
|
||||
$nbt = $this->get($nbtLen);
|
||||
/** @var CompoundTag|string $nbt */
|
||||
$nbt = "";
|
||||
if($nbtLen === 0xffff){
|
||||
$c = $this->getByte();
|
||||
if($c !== 1){
|
||||
throw new \UnexpectedValueException("Unexpected NBT count $c");
|
||||
}
|
||||
$nbt = (new NetworkLittleEndianNBTStream())->read($this->buffer, false, $this->offset);
|
||||
}elseif($nbtLen !== 0){
|
||||
throw new \UnexpectedValueException("Unexpected fake NBT length $nbtLen");
|
||||
}
|
||||
|
||||
//TODO
|
||||
@ -110,25 +121,14 @@ class NetworkBinaryStream extends BinaryStream{
|
||||
$auxValue = (($item->getDamage() & 0x7fff) << 8) | $item->getCount();
|
||||
$this->putVarInt($auxValue);
|
||||
|
||||
$nbt = $item->getCompoundTag();
|
||||
$nbtLen = strlen($nbt);
|
||||
if($nbtLen > 32767){
|
||||
/*
|
||||
* TODO: Workaround bug in the protocol (overflow)
|
||||
* Encoded tags larger than 32KB overflow the length field, so we can't send these over network.
|
||||
* However, it's unreasonable to randomly throw this burden off onto users by crashing their servers, so the
|
||||
* next best solution is to just not send the NBT. This is also not an ideal solution (books and the like
|
||||
* with too-large tags won't work on the client side) but it's better than crashing the server or client due
|
||||
* to a protocol bug. Mojang have confirmed this will be resolved by a future MCPE release, so we'll just
|
||||
* work around this problem until then.
|
||||
*/
|
||||
$nbt = "";
|
||||
$nbtLen = 0;
|
||||
if($item->hasCompoundTag()){
|
||||
$this->putLShort(0xffff);
|
||||
$this->putByte(1); //TODO: some kind of count field? always 1 as of 1.9.0
|
||||
$this->put((new NetworkLittleEndianNBTStream())->write($item->getNamedTag()));
|
||||
}else{
|
||||
$this->putLShort(0);
|
||||
}
|
||||
|
||||
$this->putLShort($nbtLen);
|
||||
$this->put($nbt);
|
||||
|
||||
$this->putVarInt(0); //CanPlaceOn entry count (TODO)
|
||||
$this->putVarInt(0); //CanDestroy entry count (TODO)
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ namespace pocketmine\network\mcpe;
|
||||
|
||||
use pocketmine\network\mcpe\protocol\AddBehaviorTreePacket;
|
||||
use pocketmine\network\mcpe\protocol\AddEntityPacket;
|
||||
use pocketmine\network\mcpe\protocol\AddHangingEntityPacket;
|
||||
use pocketmine\network\mcpe\protocol\AddItemEntityPacket;
|
||||
use pocketmine\network\mcpe\protocol\AddPaintingPacket;
|
||||
use pocketmine\network\mcpe\protocol\AddPlayerPacket;
|
||||
@ -72,6 +71,7 @@ use pocketmine\network\mcpe\protocol\LabTablePacket;
|
||||
use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacketV1;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacketV2;
|
||||
use pocketmine\network\mcpe\protocol\LoginPacket;
|
||||
use pocketmine\network\mcpe\protocol\MapInfoRequestPacket;
|
||||
use pocketmine\network\mcpe\protocol\MobArmorEquipmentPacket;
|
||||
@ -210,10 +210,6 @@ abstract class NetworkSession{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function handleAddHangingEntity(AddHangingEntityPacket $packet) : bool{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function handleTakeItemEntity(TakeItemEntityPacket $packet) : bool{
|
||||
return false;
|
||||
}
|
||||
@ -622,7 +618,7 @@ abstract class NetworkSession{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function handleLevelSoundEvent(LevelSoundEventPacket $packet) : bool{
|
||||
public function handleLevelSoundEventPacketV2(LevelSoundEventPacketV2 $packet) : bool{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -634,4 +630,8 @@ abstract class NetworkSession{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function handleLevelSoundEvent(LevelSoundEventPacket $packet) : bool{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,19 +28,37 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
|
||||
class AddPaintingPacket extends AddHangingEntityPacket{
|
||||
class AddPaintingPacket extends DataPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::ADD_PAINTING_PACKET;
|
||||
|
||||
/** @var string */
|
||||
public $title;
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
/** @var int */
|
||||
public $x;
|
||||
/** @var int|null */
|
||||
public $entityUniqueId = null;
|
||||
/** @var int */
|
||||
public $y;
|
||||
/** @var int */
|
||||
public $z;
|
||||
/** @var int */
|
||||
public $direction;
|
||||
|
||||
protected function decodePayload(){
|
||||
parent::decodePayload();
|
||||
$this->entityUniqueId = $this->getEntityUniqueId();
|
||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||
$this->getBlockPosition($this->x, $this->y, $this->z);
|
||||
$this->direction = $this->getVarInt();
|
||||
$this->title = $this->getString();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
parent::encodePayload();
|
||||
$this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
|
||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$this->putBlockPosition($this->x, $this->y, $this->z);
|
||||
$this->putVarInt($this->direction);
|
||||
$this->putString($this->title);
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -299,7 +299,7 @@ class LevelSoundEventPacket extends DataPacket{
|
||||
public $disableRelativeVolume = false;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->sound = $this->getByte();
|
||||
$this->sound = $this->getUnsignedVarInt();
|
||||
$this->position = $this->getVector3();
|
||||
$this->extraData = $this->getVarInt();
|
||||
$this->entityType = $this->getString();
|
||||
@ -308,7 +308,7 @@ class LevelSoundEventPacket extends DataPacket{
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putByte($this->sound);
|
||||
$this->putUnsignedVarInt($this->sound);
|
||||
$this->putVector3($this->position);
|
||||
$this->putVarInt($this->extraData);
|
||||
$this->putString($this->entityType);
|
||||
|
@ -25,39 +25,47 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
|
||||
class AddHangingEntityPacket extends DataPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::ADD_HANGING_ENTITY_PACKET;
|
||||
/**
|
||||
* Useless leftover from a 1.9 refactor, does nothing
|
||||
*/
|
||||
class LevelSoundEventPacketV2 extends DataPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::LEVEL_SOUND_EVENT_PACKET_V2;
|
||||
|
||||
/** @var int|null */
|
||||
public $entityUniqueId = null;
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
public $sound;
|
||||
/** @var Vector3 */
|
||||
public $position;
|
||||
/** @var int */
|
||||
public $x;
|
||||
/** @var int */
|
||||
public $y;
|
||||
/** @var int */
|
||||
public $z;
|
||||
/** @var int */
|
||||
public $direction;
|
||||
public $extraData = -1;
|
||||
/** @var string */
|
||||
public $entityType = ":"; //???
|
||||
/** @var bool */
|
||||
public $isBabyMob = false; //...
|
||||
/** @var bool */
|
||||
public $disableRelativeVolume = false;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->entityUniqueId = $this->getEntityUniqueId();
|
||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||
$this->getBlockPosition($this->x, $this->y, $this->z);
|
||||
$this->direction = $this->getVarInt();
|
||||
$this->sound = $this->getByte();
|
||||
$this->position = $this->getVector3();
|
||||
$this->extraData = $this->getVarInt();
|
||||
$this->entityType = $this->getString();
|
||||
$this->isBabyMob = $this->getBool();
|
||||
$this->disableRelativeVolume = $this->getBool();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
|
||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$this->putBlockPosition($this->x, $this->y, $this->z);
|
||||
$this->putVarInt($this->direction);
|
||||
$this->putByte($this->sound);
|
||||
$this->putVector3($this->position);
|
||||
$this->putVarInt($this->extraData);
|
||||
$this->putString($this->entityType);
|
||||
$this->putBool($this->isBabyMob);
|
||||
$this->putBool($this->disableRelativeVolume);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
return $session->handleAddHangingEntity($this);
|
||||
return $session->handleLevelSoundEventPacketV2($this);
|
||||
}
|
||||
}
|
@ -32,13 +32,17 @@ class NetworkStackLatencyPacket extends DataPacket{
|
||||
|
||||
/** @var int */
|
||||
public $timestamp;
|
||||
/** @var bool */
|
||||
public $needResponse;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->timestamp = $this->getLLong();
|
||||
$this->needResponse = $this->getBool();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putLLong($this->timestamp);
|
||||
$this->putBool($this->needResponse);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -48,7 +48,6 @@ class PacketPool{
|
||||
static::registerPacket(new AddEntityPacket());
|
||||
static::registerPacket(new RemoveEntityPacket());
|
||||
static::registerPacket(new AddItemEntityPacket());
|
||||
static::registerPacket(new AddHangingEntityPacket());
|
||||
static::registerPacket(new TakeItemEntityPacket());
|
||||
static::registerPacket(new MoveEntityAbsolutePacket());
|
||||
static::registerPacket(new MovePlayerPacket());
|
||||
@ -151,9 +150,10 @@ class PacketPool{
|
||||
static::registerPacket(new ScriptCustomEventPacket());
|
||||
static::registerPacket(new SpawnParticleEffectPacket());
|
||||
static::registerPacket(new AvailableEntityIdentifiersPacket());
|
||||
static::registerPacket(new LevelSoundEventPacket());
|
||||
static::registerPacket(new LevelSoundEventPacketV2());
|
||||
static::registerPacket(new NetworkChunkPublisherUpdatePacket());
|
||||
static::registerPacket(new BiomeDefinitionListPacket());
|
||||
static::registerPacket(new LevelSoundEventPacket());
|
||||
|
||||
static::registerPacket(new BatchPacket());
|
||||
}
|
||||
|
@ -39,15 +39,15 @@ interface ProtocolInfo{
|
||||
/**
|
||||
* Actual Minecraft: PE protocol version
|
||||
*/
|
||||
public const CURRENT_PROTOCOL = 313;
|
||||
public const CURRENT_PROTOCOL = 332;
|
||||
/**
|
||||
* Current Minecraft PE version reported by the server. This is usually the earliest currently supported version.
|
||||
*/
|
||||
public const MINECRAFT_VERSION = 'v1.8.0';
|
||||
public const MINECRAFT_VERSION = 'v1.9.0';
|
||||
/**
|
||||
* Version number sent to clients in ping responses.
|
||||
*/
|
||||
public const MINECRAFT_VERSION_NETWORK = '1.8.0';
|
||||
public const MINECRAFT_VERSION_NETWORK = '1.9.0';
|
||||
|
||||
public const LOGIN_PACKET = 0x01;
|
||||
public const PLAY_STATUS_PACKET = 0x02;
|
||||
@ -64,7 +64,7 @@ interface ProtocolInfo{
|
||||
public const ADD_ENTITY_PACKET = 0x0d;
|
||||
public const REMOVE_ENTITY_PACKET = 0x0e;
|
||||
public const ADD_ITEM_ENTITY_PACKET = 0x0f;
|
||||
public const ADD_HANGING_ENTITY_PACKET = 0x10;
|
||||
|
||||
public const TAKE_ITEM_ENTITY_PACKET = 0x11;
|
||||
public const MOVE_ENTITY_ABSOLUTE_PACKET = 0x12;
|
||||
public const MOVE_PLAYER_PACKET = 0x13;
|
||||
@ -168,8 +168,9 @@ interface ProtocolInfo{
|
||||
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 LEVEL_SOUND_EVENT_PACKET_V2 = 0x78;
|
||||
public const NETWORK_CHUNK_PUBLISHER_UPDATE_PACKET = 0x79;
|
||||
public const BIOME_DEFINITION_LIST_PACKET = 0x7a;
|
||||
public const LEVEL_SOUND_EVENT_PACKET = 0x7b;
|
||||
|
||||
}
|
||||
|
@ -35,6 +35,8 @@ class ResourcePacksInfoPacket extends DataPacket{
|
||||
|
||||
/** @var bool */
|
||||
public $mustAccept = false; //if true, forces client to use selected resource packs
|
||||
/** @var bool */
|
||||
public $hasScripts = false; //if true, causes disconnect for any platform that doesn't support scripts yet
|
||||
/** @var ResourcePack[] */
|
||||
public $behaviorPackEntries = [];
|
||||
/** @var ResourcePack[] */
|
||||
@ -42,6 +44,7 @@ class ResourcePacksInfoPacket extends DataPacket{
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->mustAccept = $this->getBool();
|
||||
$this->hasScripts = $this->getBool();
|
||||
$behaviorPackCount = $this->getLShort();
|
||||
while($behaviorPackCount-- > 0){
|
||||
$this->getString();
|
||||
@ -50,6 +53,7 @@ class ResourcePacksInfoPacket extends DataPacket{
|
||||
$this->getString();
|
||||
$this->getString();
|
||||
$this->getString();
|
||||
$this->getBool();
|
||||
}
|
||||
|
||||
$resourcePackCount = $this->getLShort();
|
||||
@ -60,12 +64,13 @@ class ResourcePacksInfoPacket extends DataPacket{
|
||||
$this->getString();
|
||||
$this->getString();
|
||||
$this->getString();
|
||||
$this->getBool();
|
||||
}
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
|
||||
$this->putBool($this->mustAccept);
|
||||
$this->putBool($this->hasScripts);
|
||||
$this->putLShort(count($this->behaviorPackEntries));
|
||||
foreach($this->behaviorPackEntries as $entry){
|
||||
$this->putString($entry->getPackId());
|
||||
@ -74,6 +79,7 @@ class ResourcePacksInfoPacket extends DataPacket{
|
||||
$this->putString(""); //TODO: encryption key
|
||||
$this->putString(""); //TODO: subpack name
|
||||
$this->putString(""); //TODO: content identity
|
||||
$this->putBool(false); //TODO: has scripts (?)
|
||||
}
|
||||
$this->putLShort(count($this->resourcePackEntries));
|
||||
foreach($this->resourcePackEntries as $entry){
|
||||
@ -83,6 +89,7 @@ class ResourcePacksInfoPacket extends DataPacket{
|
||||
$this->putString(""); //TODO: encryption key
|
||||
$this->putString(""); //TODO: subpack name
|
||||
$this->putString(""); //TODO: content identity
|
||||
$this->putBool(false); //TODO: seems useless for resource packs
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,8 @@ class SpawnParticleEffectPacket extends DataPacket{
|
||||
|
||||
/** @var int */
|
||||
public $dimensionId = DimensionIds::OVERWORLD; //wtf mojang
|
||||
/** @var int */
|
||||
public $entityUniqueId = -1; //default none
|
||||
/** @var Vector3 */
|
||||
public $position;
|
||||
/** @var string */
|
||||
@ -41,12 +43,14 @@ class SpawnParticleEffectPacket extends DataPacket{
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->dimensionId = $this->getByte();
|
||||
$this->entityUniqueId = $this->getEntityUniqueId();
|
||||
$this->position = $this->getVector3();
|
||||
$this->particleName = $this->getString();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putByte($this->dimensionId);
|
||||
$this->putEntityUniqueId($this->entityUniqueId);
|
||||
$this->putVector3($this->position);
|
||||
$this->putString($this->particleName);
|
||||
}
|
||||
|
@ -84,11 +84,15 @@ class StartGamePacket extends DataPacket{
|
||||
/** @var float */
|
||||
public $lightningLevel;
|
||||
/** @var bool */
|
||||
public $hasConfirmedPlatformLockedContent = false;
|
||||
/** @var bool */
|
||||
public $isMultiplayerGame = true;
|
||||
/** @var bool */
|
||||
public $hasLANBroadcast = true;
|
||||
/** @var bool */
|
||||
public $hasXboxLiveBroadcast = false;
|
||||
/** @var int */
|
||||
public $xboxLiveBroadcastMode = 0; //TODO: find values
|
||||
/** @var int */
|
||||
public $platformBroadcastMode = 0;
|
||||
/** @var bool */
|
||||
public $commandsEnabled;
|
||||
/** @var bool */
|
||||
@ -101,20 +105,12 @@ class StartGamePacket extends DataPacket{
|
||||
public $hasBonusChestEnabled = false;
|
||||
/** @var bool */
|
||||
public $hasStartWithMapEnabled = false;
|
||||
/** @var bool */
|
||||
public $hasTrustPlayersEnabled = false;
|
||||
/** @var int */
|
||||
public $defaultPlayerPermission = PlayerPermissions::MEMBER; //TODO
|
||||
/** @var int */
|
||||
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 bool */
|
||||
public $hasLockedBehaviorPack = false;
|
||||
/** @var bool */
|
||||
@ -166,21 +162,18 @@ class StartGamePacket extends DataPacket{
|
||||
$this->hasEduFeaturesEnabled = $this->getBool();
|
||||
$this->rainLevel = $this->getLFloat();
|
||||
$this->lightningLevel = $this->getLFloat();
|
||||
$this->hasConfirmedPlatformLockedContent = $this->getBool();
|
||||
$this->isMultiplayerGame = $this->getBool();
|
||||
$this->hasLANBroadcast = $this->getBool();
|
||||
$this->hasXboxLiveBroadcast = $this->getBool();
|
||||
$this->xboxLiveBroadcastMode = $this->getVarInt();
|
||||
$this->platformBroadcastMode = $this->getVarInt();
|
||||
$this->commandsEnabled = $this->getBool();
|
||||
$this->isTexturePacksRequired = $this->getBool();
|
||||
$this->gameRules = $this->getGameRules();
|
||||
$this->hasBonusChestEnabled = $this->getBool();
|
||||
$this->hasStartWithMapEnabled = $this->getBool();
|
||||
$this->hasTrustPlayersEnabled = $this->getBool();
|
||||
$this->defaultPlayerPermission = $this->getVarInt();
|
||||
$this->xboxLiveBroadcastMode = $this->getVarInt();
|
||||
$this->serverChunkTickRadius = $this->getLInt();
|
||||
$this->hasPlatformBroadcast = $this->getBool();
|
||||
$this->platformBroadcastMode = $this->getVarInt();
|
||||
$this->xboxLiveBroadcastIntent = $this->getBool();
|
||||
$this->hasLockedBehaviorPack = $this->getBool();
|
||||
$this->hasLockedResourcePack = $this->getBool();
|
||||
$this->isFromLockedWorldTemplate = $this->getBool();
|
||||
@ -228,21 +221,18 @@ class StartGamePacket extends DataPacket{
|
||||
$this->putBool($this->hasEduFeaturesEnabled);
|
||||
$this->putLFloat($this->rainLevel);
|
||||
$this->putLFloat($this->lightningLevel);
|
||||
$this->putBool($this->hasConfirmedPlatformLockedContent);
|
||||
$this->putBool($this->isMultiplayerGame);
|
||||
$this->putBool($this->hasLANBroadcast);
|
||||
$this->putBool($this->hasXboxLiveBroadcast);
|
||||
$this->putVarInt($this->xboxLiveBroadcastMode);
|
||||
$this->putVarInt($this->platformBroadcastMode);
|
||||
$this->putBool($this->commandsEnabled);
|
||||
$this->putBool($this->isTexturePacksRequired);
|
||||
$this->putGameRules($this->gameRules);
|
||||
$this->putBool($this->hasBonusChestEnabled);
|
||||
$this->putBool($this->hasStartWithMapEnabled);
|
||||
$this->putBool($this->hasTrustPlayersEnabled);
|
||||
$this->putVarInt($this->defaultPlayerPermission);
|
||||
$this->putVarInt($this->xboxLiveBroadcastMode);
|
||||
$this->putLInt($this->serverChunkTickRadius);
|
||||
$this->putBool($this->hasPlatformBroadcast);
|
||||
$this->putVarInt($this->platformBroadcastMode);
|
||||
$this->putBool($this->xboxLiveBroadcastIntent);
|
||||
$this->putBool($this->hasLockedBehaviorPack);
|
||||
$this->putBool($this->hasLockedResourcePack);
|
||||
$this->putBool($this->isFromLockedWorldTemplate);
|
||||
|
@ -41,6 +41,7 @@ class TextPacket extends DataPacket{
|
||||
public const TYPE_SYSTEM = 6;
|
||||
public const TYPE_WHISPER = 7;
|
||||
public const TYPE_ANNOUNCEMENT = 8;
|
||||
public const TYPE_JSON = 9;
|
||||
|
||||
/** @var int */
|
||||
public $type;
|
||||
@ -69,6 +70,7 @@ class TextPacket extends DataPacket{
|
||||
case self::TYPE_RAW:
|
||||
case self::TYPE_TIP:
|
||||
case self::TYPE_SYSTEM:
|
||||
case self::TYPE_JSON:
|
||||
$this->message = $this->getString();
|
||||
break;
|
||||
|
||||
@ -99,6 +101,7 @@ class TextPacket extends DataPacket{
|
||||
case self::TYPE_RAW:
|
||||
case self::TYPE_TIP:
|
||||
case self::TYPE_SYSTEM:
|
||||
case self::TYPE_JSON:
|
||||
$this->putString($this->message);
|
||||
break;
|
||||
|
||||
|
251
src/pocketmine/resources/legacy_id_map.json
Normal file
251
src/pocketmine/resources/legacy_id_map.json
Normal file
@ -0,0 +1,251 @@
|
||||
{
|
||||
"minecraft:air": 0,
|
||||
"minecraft:stone": 1,
|
||||
"minecraft:grass": 2,
|
||||
"minecraft:dirt": 3,
|
||||
"minecraft:cobblestone": 4,
|
||||
"minecraft:planks": 5,
|
||||
"minecraft:sapling": 6,
|
||||
"minecraft:bedrock": 7,
|
||||
"minecraft:flowing_water": 8,
|
||||
"minecraft:water": 9,
|
||||
"minecraft:flowing_lava": 10,
|
||||
"minecraft:lava": 11,
|
||||
"minecraft:sand": 12,
|
||||
"minecraft:gravel": 13,
|
||||
"minecraft:gold_ore": 14,
|
||||
"minecraft:iron_ore": 15,
|
||||
"minecraft:coal_ore": 16,
|
||||
"minecraft:log": 17,
|
||||
"minecraft:leaves": 18,
|
||||
"minecraft:sponge": 19,
|
||||
"minecraft:glass": 20,
|
||||
"minecraft:lapis_ore": 21,
|
||||
"minecraft:lapis_block": 22,
|
||||
"minecraft:dispenser": 23,
|
||||
"minecraft:sandstone": 24,
|
||||
"minecraft:noteblock": 25,
|
||||
"minecraft:bed": 26,
|
||||
"minecraft:golden_rail": 27,
|
||||
"minecraft:detector_rail": 28,
|
||||
"minecraft:sticky_piston": 29,
|
||||
"minecraft:web": 30,
|
||||
"minecraft:tallgrass": 31,
|
||||
"minecraft:deadbush": 32,
|
||||
"minecraft:piston": 33,
|
||||
"minecraft:pistonArmCollision": 34,
|
||||
"minecraft:wool": 35,
|
||||
"minecraft:element_0": 36,
|
||||
"minecraft:yellow_flower": 37,
|
||||
"minecraft:red_flower": 38,
|
||||
"minecraft:brown_mushroom": 39,
|
||||
"minecraft:red_mushroom": 40,
|
||||
"minecraft:gold_block": 41,
|
||||
"minecraft:iron_block": 42,
|
||||
"minecraft:double_stone_slab": 43,
|
||||
"minecraft:stone_slab": 44,
|
||||
"minecraft:brick_block": 45,
|
||||
"minecraft:tnt": 46,
|
||||
"minecraft:bookshelf": 47,
|
||||
"minecraft:mossy_cobblestone": 48,
|
||||
"minecraft:obsidian": 49,
|
||||
"minecraft:torch": 50,
|
||||
"minecraft:fire": 51,
|
||||
"minecraft:mob_spawner": 52,
|
||||
"minecraft:oak_stairs": 53,
|
||||
"minecraft:chest": 54,
|
||||
"minecraft:redstone_wire": 55,
|
||||
"minecraft:diamond_ore": 56,
|
||||
"minecraft:diamond_block": 57,
|
||||
"minecraft:crafting_table": 58,
|
||||
"minecraft:wheat": 59,
|
||||
"minecraft:farmland": 60,
|
||||
"minecraft:furnace": 61,
|
||||
"minecraft:lit_furnace": 62,
|
||||
"minecraft:standing_sign": 63,
|
||||
"minecraft:wooden_door": 64,
|
||||
"minecraft:ladder": 65,
|
||||
"minecraft:rail": 66,
|
||||
"minecraft:stone_stairs": 67,
|
||||
"minecraft:wall_sign": 68,
|
||||
"minecraft:lever": 69,
|
||||
"minecraft:stone_pressure_plate": 70,
|
||||
"minecraft:iron_door": 71,
|
||||
"minecraft:wooden_pressure_plate": 72,
|
||||
"minecraft:redstone_ore": 73,
|
||||
"minecraft:lit_redstone_ore": 74,
|
||||
"minecraft:unlit_redstone_torch": 75,
|
||||
"minecraft:redstone_torch": 76,
|
||||
"minecraft:stone_button": 77,
|
||||
"minecraft:snow_layer": 78,
|
||||
"minecraft:ice": 79,
|
||||
"minecraft:snow": 80,
|
||||
"minecraft:cactus": 81,
|
||||
"minecraft:clay": 82,
|
||||
"minecraft:reeds": 83,
|
||||
"minecraft:jukebox": 84,
|
||||
"minecraft:fence": 85,
|
||||
"minecraft:pumpkin": 86,
|
||||
"minecraft:netherrack": 87,
|
||||
"minecraft:soul_sand": 88,
|
||||
"minecraft:glowstone": 89,
|
||||
"minecraft:portal": 90,
|
||||
"minecraft:lit_pumpkin": 91,
|
||||
"minecraft:cake": 92,
|
||||
"minecraft:unpowered_repeater": 93,
|
||||
"minecraft:powered_repeater": 94,
|
||||
"minecraft:invisibleBedrock": 95,
|
||||
"minecraft:trapdoor": 96,
|
||||
"minecraft:monster_egg": 97,
|
||||
"minecraft:stonebrick": 98,
|
||||
"minecraft:brown_mushroom_block": 99,
|
||||
"minecraft:red_mushroom_block": 100,
|
||||
"minecraft:iron_bars": 101,
|
||||
"minecraft:glass_pane": 102,
|
||||
"minecraft:melon_block": 103,
|
||||
"minecraft:pumpkin_stem": 104,
|
||||
"minecraft:melon_stem": 105,
|
||||
"minecraft:vine": 106,
|
||||
"minecraft:fence_gate": 107,
|
||||
"minecraft:brick_stairs": 108,
|
||||
"minecraft:stone_brick_stairs": 109,
|
||||
"minecraft:mycelium": 110,
|
||||
"minecraft:waterlily": 111,
|
||||
"minecraft:nether_brick": 112,
|
||||
"minecraft:nether_brick_fence": 113,
|
||||
"minecraft:nether_brick_stairs": 114,
|
||||
"minecraft:nether_wart": 115,
|
||||
"minecraft:enchanting_table": 116,
|
||||
"minecraft:brewing_stand": 117,
|
||||
"minecraft:cauldron": 118,
|
||||
"minecraft:end_portal": 119,
|
||||
"minecraft:end_portal_frame": 120,
|
||||
"minecraft:end_stone": 121,
|
||||
"minecraft:dragon_egg": 122,
|
||||
"minecraft:redstone_lamp": 123,
|
||||
"minecraft:lit_redstone_lamp": 124,
|
||||
"minecraft:dropper": 125,
|
||||
"minecraft:activator_rail": 126,
|
||||
"minecraft:cocoa": 127,
|
||||
"minecraft:sandstone_stairs": 128,
|
||||
"minecraft:emerald_ore": 129,
|
||||
"minecraft:ender_chest": 130,
|
||||
"minecraft:tripwire_hook": 131,
|
||||
"minecraft:tripWire": 132,
|
||||
"minecraft:emerald_block": 133,
|
||||
"minecraft:spruce_stairs": 134,
|
||||
"minecraft:birch_stairs": 135,
|
||||
"minecraft:jungle_stairs": 136,
|
||||
"minecraft:command_block": 137,
|
||||
"minecraft:beacon": 138,
|
||||
"minecraft:cobblestone_wall": 139,
|
||||
"minecraft:flower_pot": 140,
|
||||
"minecraft:carrots": 141,
|
||||
"minecraft:potatoes": 142,
|
||||
"minecraft:wooden_button": 143,
|
||||
"minecraft:skull": 144,
|
||||
"minecraft:anvil": 145,
|
||||
"minecraft:trapped_chest": 146,
|
||||
"minecraft:light_weighted_pressure_plate": 147,
|
||||
"minecraft:heavy_weighted_pressure_plate": 148,
|
||||
"minecraft:unpowered_comparator": 149,
|
||||
"minecraft:powered_comparator": 150,
|
||||
"minecraft:daylight_detector": 151,
|
||||
"minecraft:redstone_block": 152,
|
||||
"minecraft:quartz_ore": 153,
|
||||
"minecraft:hopper": 154,
|
||||
"minecraft:quartz_block": 155,
|
||||
"minecraft:quartz_stairs": 156,
|
||||
"minecraft:double_wooden_slab": 157,
|
||||
"minecraft:wooden_slab": 158,
|
||||
"minecraft:stained_hardened_clay": 159,
|
||||
"minecraft:stained_glass_pane": 160,
|
||||
"minecraft:leaves2": 161,
|
||||
"minecraft:log2": 162,
|
||||
"minecraft:acacia_stairs": 163,
|
||||
"minecraft:dark_oak_stairs": 164,
|
||||
"minecraft:slime": 165,
|
||||
"minecraft:iron_trapdoor": 167,
|
||||
"minecraft:prismarine": 168,
|
||||
"minecraft:seaLantern": 169,
|
||||
"minecraft:hay_block": 170,
|
||||
"minecraft:carpet": 171,
|
||||
"minecraft:hardened_clay": 172,
|
||||
"minecraft:coal_block": 173,
|
||||
"minecraft:packed_ice": 174,
|
||||
"minecraft:double_plant": 175,
|
||||
"minecraft:standing_banner": 176,
|
||||
"minecraft:wall_banner": 177,
|
||||
"minecraft:daylight_detector_inverted": 178,
|
||||
"minecraft:red_sandstone": 179,
|
||||
"minecraft:red_sandstone_stairs": 180,
|
||||
"minecraft:double_stone_slab2": 181,
|
||||
"minecraft:stone_slab2": 182,
|
||||
"minecraft:spruce_fence_gate": 183,
|
||||
"minecraft:birch_fence_gate": 184,
|
||||
"minecraft:jungle_fence_gate": 185,
|
||||
"minecraft:dark_oak_fence_gate": 186,
|
||||
"minecraft:acacia_fence_gate": 187,
|
||||
"minecraft:repeating_command_block": 188,
|
||||
"minecraft:chain_command_block": 189,
|
||||
"minecraft:hard_glass_pane": 190,
|
||||
"minecraft:hard_stained_glass_pane": 191,
|
||||
"minecraft:chemical_heat": 192,
|
||||
"minecraft:spruce_door": 193,
|
||||
"minecraft:birch_door": 194,
|
||||
"minecraft:jungle_door": 195,
|
||||
"minecraft:acacia_door": 196,
|
||||
"minecraft:dark_oak_door": 197,
|
||||
"minecraft:grass_path": 198,
|
||||
"minecraft:frame": 199,
|
||||
"minecraft:chorus_flower": 200,
|
||||
"minecraft:purpur_block": 201,
|
||||
"minecraft:colored_torch_rg": 202,
|
||||
"minecraft:purpur_stairs": 203,
|
||||
"minecraft:colored_torch_bp": 204,
|
||||
"minecraft:undyed_shulker_box": 205,
|
||||
"minecraft:end_bricks": 206,
|
||||
"minecraft:frosted_ice": 207,
|
||||
"minecraft:end_rod": 208,
|
||||
"minecraft:end_gateway": 209,
|
||||
"minecraft:magma": 213,
|
||||
"minecraft:nether_wart_block": 214,
|
||||
"minecraft:red_nether_brick": 215,
|
||||
"minecraft:bone_block": 216,
|
||||
"minecraft:shulker_box": 218,
|
||||
"minecraft:purple_glazed_terracotta": 219,
|
||||
"minecraft:white_glazed_terracotta": 220,
|
||||
"minecraft:orange_glazed_terracotta": 221,
|
||||
"minecraft:magenta_glazed_terracotta": 222,
|
||||
"minecraft:light_blue_glazed_terracotta": 223,
|
||||
"minecraft:yellow_glazed_terracotta": 224,
|
||||
"minecraft:lime_glazed_terracotta": 225,
|
||||
"minecraft:pink_glazed_terracotta": 226,
|
||||
"minecraft:gray_glazed_terracotta": 227,
|
||||
"minecraft:silver_glazed_terracotta": 228,
|
||||
"minecraft:cyan_glazed_terracotta": 229,
|
||||
"minecraft:blue_glazed_terracotta": 231,
|
||||
"minecraft:brown_glazed_terracotta": 232,
|
||||
"minecraft:green_glazed_terracotta": 233,
|
||||
"minecraft:red_glazed_terracotta": 234,
|
||||
"minecraft:black_glazed_terracotta": 235,
|
||||
"minecraft:concrete": 236,
|
||||
"minecraft:concretePowder": 237,
|
||||
"minecraft:chemistry_table": 238,
|
||||
"minecraft:underwater_torch": 239,
|
||||
"minecraft:chorus_plant": 240,
|
||||
"minecraft:stained_glass": 241,
|
||||
"minecraft:podzol": 243,
|
||||
"minecraft:beetroot": 244,
|
||||
"minecraft:stonecutter": 245,
|
||||
"minecraft:glowingobsidian": 246,
|
||||
"minecraft:netherreactor": 247,
|
||||
"minecraft:info_update": 248,
|
||||
"minecraft:info_update2": 249,
|
||||
"minecraft:movingBlock": 250,
|
||||
"minecraft:observer": 251,
|
||||
"minecraft:structure_block": 252,
|
||||
"minecraft:hard_glass": 253,
|
||||
"minecraft:hard_stained_glass": 254,
|
||||
"minecraft:reserved6": 255
|
||||
}
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user