It works. (Inventory, windows, block placement)

This commit is contained in:
Shoghi Cervantes 2014-05-24 00:32:29 +02:00
parent 5460ccf41c
commit f9103772c3
3 changed files with 9 additions and 10 deletions

View File

@ -153,10 +153,11 @@ class PlayerInventory extends BaseInventory{
if($index >= $this->getSize()){ if($index >= $this->getSize()){
$this->sendArmorContents($this->getHolder()->getViewers()); $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());
} }
} }

View File

@ -553,7 +553,7 @@ class Level{
* @return bool * @return bool
*/ */
public function setBlock(Vector3 $pos, Block $block, $update = true, $tiles = false, $direct = false){ 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; return false;
} }
@ -708,7 +708,6 @@ class Level{
$hand->position($block); $hand->position($block);
}elseif($block->getID() === Item::FIRE){ }elseif($block->getID() === Item::FIRE){
$this->setBlock($block, new Air(), true, false, true); $this->setBlock($block, new Air(), true, false, true);
return false; return false;
}else{ }else{
return false; return false;
@ -768,7 +767,6 @@ class Level{
if($item->getCount() <= 0){ if($item->getCount() <= 0){
$item = Item::get(Item::AIR, 0, 0); $item = Item::get(Item::AIR, 0, 0);
} }
return true; return true;
} }

View File

@ -85,9 +85,9 @@ abstract class Tile extends Position{
$this->lastUpdate = microtime(true); $this->lastUpdate = microtime(true);
$this->id = Tile::$tileCount++; $this->id = Tile::$tileCount++;
Tile::$list[$this->id] = $this; Tile::$list[$this->id] = $this;
$this->x = (int) $this->namedtag->x; $this->x = (int) $this->namedtag["x"];
$this->y = (int) $this->namedtag->y; $this->y = (int) $this->namedtag["y"];
$this->z = (int) $this->namedtag->z; $this->z = (int) $this->namedtag["z"];
$index = LevelFormat::getIndex($this->x >> 4, $this->z >> 4); $index = LevelFormat::getIndex($this->x >> 4, $this->z >> 4);
$this->chunkIndex = $index; $this->chunkIndex = $index;