Dylan K. Taylor c21197ef17 Removed entanglement between chunks and providers. WARNING: BREAKING API CHANGES.
- All entity and tile constructors now require a \pocketmine\level\Level instead of a \pocketmine\level\format\Chunk.
- Chunk->getProvider() and Chunk->setProvider() have been removed.
- Chunk::__construct() has had the $provider parameter removed.
- Chunk->unload() has had the unused $save parameter removed.
- ChunkEvents now take a Level parameter instead of going through the Chunk

API bump to 3.0.0-ALPHA4
2017-02-21 17:08:45 +00:00

67 lines
1.8 KiB
PHP

<?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/
*
*
*/
namespace pocketmine\tile;
use pocketmine\level\Level;
use pocketmine\nbt\tag\ByteTag;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\IntTag;
use pocketmine\nbt\tag\StringTag;
class Skull extends Spawnable{
const TYPE_SKELETON = 0;
const TYPE_WITHER = 1;
const TYPE_ZOMBIE = 2;
const TYPE_HUMAN = 3;
const TYPE_CREEPER = 4;
const TYPE_DRAGON = 5;
public function __construct(Level $level, CompoundTag $nbt){
if(!isset($nbt->SkullType)){
$nbt->SkullType = new ByteTag("SkullType", 0);
}
if(!isset($nbt->Rot)){
$nbt->Rot = new ByteTag("Rot", 0);
}
parent::__construct($level, $nbt);
}
public function setType(int $type){
$this->namedtag->SkullType = new ByteTag("SkullType", $type);
$this->onChanged();
}
public function getType(){
return $this->namedtag["SkullType"];
}
public function getSpawnCompound(){
return new CompoundTag("", [
new StringTag("id", Tile::SKULL),
$this->namedtag->SkullType,
$this->namedtag->Rot,
new IntTag("x", (int) $this->x),
new IntTag("y", (int) $this->y),
new IntTag("z", (int) $this->z)
]);
}
}