Moved dimension id constants to their own interface (PHP needs enums)

This commit is contained in:
Dylan K. Taylor 2017-07-31 16:38:01 +01:00
parent 0b47324fe3
commit 306bf7be5f
3 changed files with 39 additions and 4 deletions

View File

@ -155,6 +155,7 @@ use pocketmine\network\mcpe\protocol\TakeItemEntityPacket;
use pocketmine\network\mcpe\protocol\TextPacket;
use pocketmine\network\mcpe\protocol\TransferPacket;
use pocketmine\network\mcpe\protocol\types\ContainerIds;
use pocketmine\network\mcpe\protocol\types\DimensionIds;
use pocketmine\network\mcpe\protocol\UpdateAttributesPacket;
use pocketmine\network\mcpe\protocol\UpdateBlockPacket;
use pocketmine\network\mcpe\protocol\UseItemPacket;
@ -1856,7 +1857,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$pk->pitch = $this->pitch;
$pk->yaw = $this->yaw;
$pk->seed = -1;
$pk->dimension = 0; //TODO: implement this properly
$pk->dimension = DimensionIds::OVERWORLD; //TODO: implement this properly
$pk->worldGamemode = Player::getClientFriendlyGamemode($this->server->getGamemode());
$pk->difficulty = $this->server->getDifficulty();
$pk->spawnX = $spawnPosition->getFloorX();

View File

@ -31,13 +31,15 @@ use pocketmine\network\mcpe\NetworkSession;
class ChangeDimensionPacket extends DataPacket{
const NETWORK_ID = ProtocolInfo::CHANGE_DIMENSION_PACKET;
const DIMENSION_OVERWORLD = 0;
const DIMENSION_NETHER = 1;
/** @var int */
public $dimension;
/** @var float */
public $x;
/** @var float */
public $y;
/** @var float */
public $z;
/** @var bool */
public $respawn = false;
public function decodePayload(){

View File

@ -0,0 +1,32 @@
<?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\types;
interface DimensionIds{
const OVERWORLD = 0;
const NETHER = 1;
const THE_END = 2;
}