From f9103772c37b698f55ab6db3c251ffa8cc261aed Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Sat, 24 May 2014 00:32:29 +0200 Subject: [PATCH] It works. (Inventory, windows, block placement) --- src/pocketmine/inventory/PlayerInventory.php | 9 +++++---- src/pocketmine/level/Level.php | 4 +--- src/pocketmine/tile/Tile.php | 6 +++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/pocketmine/inventory/PlayerInventory.php b/src/pocketmine/inventory/PlayerInventory.php index f2068e581..56df20047 100644 --- a/src/pocketmine/inventory/PlayerInventory.php +++ b/src/pocketmine/inventory/PlayerInventory.php @@ -153,10 +153,11 @@ class PlayerInventory extends BaseInventory{ if($index >= $this->getSize()){ $this->sendArmorContents($this->getHolder()->getViewers()); - } - - if($this->getHolder() instanceof Player){ - $this->sendArmorContents($this->getHolder()); + if($this->getHolder() instanceof Player){ + $this->sendArmorContents($this->getHolder()); + } + }elseif($this->getHolder() instanceof Player){ + $this->sendSlot($index, $this->getHolder()); } } diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 618053864..e9d9a09d7 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -553,7 +553,7 @@ class Level{ * @return bool */ public function setBlock(Vector3 $pos, Block $block, $update = true, $tiles = false, $direct = false){ - if((($pos instanceof Position) and $pos->level !== $this) or $pos->x < 0 or $pos->y < 0 or $pos->z < 0){ + if((($pos instanceof Position) and $pos->getLevel() !== $this) or $pos->x < 0 or $pos->y < 0 or $pos->z < 0){ return false; } @@ -708,7 +708,6 @@ class Level{ $hand->position($block); }elseif($block->getID() === Item::FIRE){ $this->setBlock($block, new Air(), true, false, true); - return false; }else{ return false; @@ -768,7 +767,6 @@ class Level{ if($item->getCount() <= 0){ $item = Item::get(Item::AIR, 0, 0); } - return true; } diff --git a/src/pocketmine/tile/Tile.php b/src/pocketmine/tile/Tile.php index 2d453fbc3..cb0b51d5a 100644 --- a/src/pocketmine/tile/Tile.php +++ b/src/pocketmine/tile/Tile.php @@ -85,9 +85,9 @@ abstract class Tile extends Position{ $this->lastUpdate = microtime(true); $this->id = Tile::$tileCount++; Tile::$list[$this->id] = $this; - $this->x = (int) $this->namedtag->x; - $this->y = (int) $this->namedtag->y; - $this->z = (int) $this->namedtag->z; + $this->x = (int) $this->namedtag["x"]; + $this->y = (int) $this->namedtag["y"]; + $this->z = (int) $this->namedtag["z"]; $index = LevelFormat::getIndex($this->x >> 4, $this->z >> 4); $this->chunkIndex = $index;