From 24c0e2742aab6c96a98c848c6befadb9ec582707 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Tue, 14 May 2013 23:46:22 +0200 Subject: [PATCH] Fixes --- src/API/ServerAPI.php | 1 - src/API/TileEntityAPI.php | 4 ++-- src/material/block/misc/Air.php | 1 - src/material/block/misc/Bed.php | 4 ++-- src/material/block/plant/Sapling.php | 7 +------ src/material/block/solid/BurningFurnace.php | 3 --- src/material/block/solid/FenceGate.php | 21 +++++++++------------ src/network/Query.php | 5 ++--- 8 files changed, 16 insertions(+), 30 deletions(-) diff --git a/src/API/ServerAPI.php b/src/API/ServerAPI.php index 90965a2a0..193f3b1df 100644 --- a/src/API/ServerAPI.php +++ b/src/API/ServerAPI.php @@ -83,7 +83,6 @@ class ServerAPI{ "enable-query" => false, "enable-rcon" => false, "rcon.password" => substr(base64_encode(Utils::getRandomBytes(20, false)), 3, 10), - "upnp-forwarding" => false, "send-usage" => true, )); $this->parseProperties(); diff --git a/src/API/TileEntityAPI.php b/src/API/TileEntityAPI.php index 75f6e7330..38260e26f 100644 --- a/src/API/TileEntityAPI.php +++ b/src/API/TileEntityAPI.php @@ -84,8 +84,8 @@ class TileEntityAPI{ public function add(Level $level, $class, $x, $y, $z, $data = array()){ $id = $this->tCnt++; - $this->tileEntities[$id] = new TileEntity($id, $class, $x, $y, $z, $data); - $this->spawnToAll($id); + $this->tileEntities[$id] = new TileEntity($level, $id, $class, $x, $y, $z, $data); + $this->spawnToAll($level, $id); return $this->tileEntities[$id]; } diff --git a/src/material/block/misc/Air.php b/src/material/block/misc/Air.php index e874f0b83..fba707b3f 100644 --- a/src/material/block/misc/Air.php +++ b/src/material/block/misc/Air.php @@ -34,7 +34,6 @@ class AirBlock extends TransparentBlock{ $this->isTransparent = true; $this->isReplaceable = true; $this->isPlaceable = false; - $this->inWorld = false; $this->hasPhysics = false; } diff --git a/src/material/block/misc/Bed.php b/src/material/block/misc/Bed.php index c6d7f6a39..39cb3be6d 100644 --- a/src/material/block/misc/Bed.php +++ b/src/material/block/misc/Bed.php @@ -41,8 +41,8 @@ class BedBlock extends TransparentBlock{ 3 => 5, ); $d = $player->entity->getDirection(); - $next = $this->level->getBlockFace($block, $faces[(($d + 3) % 4)]); - $downNext = $this->level->getBlockFace($next, 0); + $next = $this->getSide($faces[(($d + 3) % 4)]); + $downNext = $this->getSide(0); if($next->isReplaceable === true and $downNext->isTransparent === false){ $meta = (($d + 3) % 4) & 0x03; $this->level->setBlock($block, BlockAPI::get($this->id, $meta)); diff --git a/src/material/block/plant/Sapling.php b/src/material/block/plant/Sapling.php index 917db46ab..4a767656d 100644 --- a/src/material/block/plant/Sapling.php +++ b/src/material/block/plant/Sapling.php @@ -45,13 +45,11 @@ class SaplingBlock extends TransparentBlock{ public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ console("SAPLING SAPLING SAPLING");return false; //Placeholder - if($block->inWorld === true){ - $down = $level->getBlockFace($block, 0); + $down = $this->getSide(0); if($down->getID() === GRASS or $down->getID() === DIRT or $down->getID() === FARMLAND){ $level->setBlock($block, $this->id, $this->getMetadata()); return true; } - } return false; } @@ -66,9 +64,6 @@ class SaplingBlock extends TransparentBlock{ public function onUpdate($type){ console("SAPLING SAPLING SAPLING");return false; //Placeholder - if($this->inWorld !== true){ - return false; - } if($type === BLOCK_UPDATE_RANDOM and mt_rand(0,2) === 0){ //Growth if(($this->meta & 0x08) === 0x08){ TreeObject::growTree($level, $this); diff --git a/src/material/block/solid/BurningFurnace.php b/src/material/block/solid/BurningFurnace.php index a322dcd8f..1747a8aa3 100644 --- a/src/material/block/solid/BurningFurnace.php +++ b/src/material/block/solid/BurningFurnace.php @@ -33,7 +33,6 @@ class BurningFurnaceBlock extends SolidBlock{ } public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ - if($block->inWorld === true){ $faces = array( 0 => 4, 1 => 2, @@ -43,8 +42,6 @@ class BurningFurnaceBlock extends SolidBlock{ $this->meta = $faces[$player->entity->getDirection()]; $this->level->setBlock($block, $this); return true; - } - return false; } public function onBreak(Item $item, Player $player){ diff --git a/src/material/block/solid/FenceGate.php b/src/material/block/solid/FenceGate.php index 96d68581f..55a2709ac 100644 --- a/src/material/block/solid/FenceGate.php +++ b/src/material/block/solid/FenceGate.php @@ -31,18 +31,15 @@ class FenceGateBlock extends TransparentBlock{ $this->isActivable = true; } public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ - if($block->inWorld === true){ - $faces = array( - 0 => 3, - 1 => 0, - 2 => 1, - 3 => 2, - ); - $this->meta = $faces[$player->entity->getDirection()] & 0x03; - $this->level->setBlock($block, $this); - return true; - } - return false; + $faces = array( + 0 => 3, + 1 => 0, + 2 => 1, + 3 => 2, + ); + $this->meta = $faces[$player->entity->getDirection()] & 0x03; + $this->level->setBlock($block, $this); + return true; } public function getDrops(Item $item, Player $player){ return array( diff --git a/src/network/Query.php b/src/network/Query.php index 9198faf08..374204a49 100644 --- a/src/network/Query.php +++ b/src/network/Query.php @@ -34,7 +34,6 @@ class Query{ private $socket, $server, $lastToken, $token, $longData, $timeout; public function __construct(){ - $this->password = (string) $password; console("[INFO] Starting GS4 status listener"); $this->server = ServerAPI::request(); $addr = $this->server->api->getProperty("server-ip", "0.0.0.0"); @@ -74,7 +73,7 @@ class Query{ "game_id" => "MINECRAFTPE", "version" => CURRENT_MINECRAFT_VERSION, "plugins" => $plist, - "map" => $this->server->mapName, + "map" => $this->server->api->level->getDefault()->getName(), "numplayers" => count($this->server->clients), "maxplayers" => $this->server->maxClients, "hostport" => $this->server->api->getProperty("server-port"), @@ -128,7 +127,7 @@ class Query{ } $this->server->send(0, chr(0).Utils::writeInt($sessionID).$this->longData, true, $packet["ip"], $packet["port"]); }else{ - $this->server->send(0, chr(0).Utils::writeInt($sessionID).$this->server->name."\x00SMP\x00".$this->server->mapName."\x00".count($this->server->clients)."\x00".$this->server->maxClients."\x00".Utils::writeLShort($this->server->api->getProperty("server-port")).$this->server->api->getProperty("server-ip", "0.0.0.0")."\x00", true, $packet["ip"], $packet["port"]); + $this->server->send(0, chr(0).Utils::writeInt($sessionID).$this->server->name."\x00SMP\x00".$this->server->api->level->getDefault()->getName()."\x00".count($this->server->clients)."\x00".$this->server->maxClients."\x00".Utils::writeLShort($this->server->api->getProperty("server-port")).$this->server->api->getProperty("server-ip", "0.0.0.0")."\x00", true, $packet["ip"], $packet["port"]); } break; }