This commit is contained in:
Shoghi Cervantes 2014-07-13 01:04:10 +02:00
parent d2ed0aa9f0
commit e29ddadd2f
4 changed files with 65 additions and 52 deletions

View File

@ -505,9 +505,10 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$this->dataPacket($pk);
$this->getLevel()->freeChunk($x, $z, $this);
unset($this->usedChunks[$index]);
$this->orderChunks();
}
unset($this->loadQueue[$index]);
$this->orderChunks();
}
/**

View File

@ -1479,6 +1479,7 @@ class Server{
PluginManager::$pluginParentTimer = new TimingsHandler("** Plugins");
Timings::init();
$this->pluginManager = new PluginManager($this, $this->commandMap);
$this->pluginManager->subscribeToPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE, $this->consoleSender);
$this->pluginManager->setUseTimings($this->getProperty("settings.enable-profiling", false));

View File

@ -43,6 +43,8 @@ use pocketmine\metadata\Metadatable;
use pocketmine\metadata\MetadataValue;
use pocketmine\nbt\tag\Byte;
use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\Double;
use pocketmine\nbt\tag\Enum;
use pocketmine\nbt\tag\Float;
use pocketmine\nbt\tag\Short;
use pocketmine\network\protocol\MoveEntityPacket;
@ -202,22 +204,28 @@ abstract class Entity extends Position implements Metadatable{
}
public function saveNBT(){
$this->namedtag["Pos"][0] = $this->x;
$this->namedtag["Pos"][1] = $this->y;
$this->namedtag["Pos"][2] = $this->z;
$this->namedtag->Pos = new Enum("Pos", [
new Double(0, $this->x),
new Double(1, $this->y),
new Double(2, $this->z)
]);
$this->namedtag["Motion"][0] = $this->motionX;
$this->namedtag["Motion"][1] = $this->motionY;
$this->namedtag["Motion"][2] = $this->motionZ;
$this->namedtag->Motion = new Enum("Motion", [
new Double(0, $this->motionX),
new Double(1, $this->motionY),
new Double(2, $this->motionZ)
]);
$this->namedtag["Rotation"][0] = $this->yaw;
$this->namedtag["Rotation"][1] = $this->pitch;
$this->namedtag->Rotation = new Enum("Rotation", [
new Float(0, $this->yaw),
new Float(1, $this->pitch)
]);
$this->namedtag["FallDistance"] = $this->fallDistance;
$this->namedtag["Fire"] = $this->fireTicks;
$this->namedtag["Air"] = $this->airTicks;
$this->namedtag["OnGround"] = $this->onGround == true ? 1 : 0;
$this->namedtag["Invulnerable"] = $this->invulnerable == true ? 1 : 0;
$this->namedtag->FallDistance = new Float("FallDistance", $this->fallDistance);
$this->namedtag->Fire = new Short("Fire", $this->fireTicks);
$this->namedtag->Air = new Short("Air", $this->airTicks);
$this->namedtag->OnGround = new Byte("OnGround", $this->onGround == true ? 1 : 0);
$this->namedtag->Invulnerable = new Byte("Invulnerable", $this->invulnerable == true ? 1 : 0);
}
protected abstract function initEntity();

View File

@ -21,6 +21,7 @@
namespace pocketmine\entity;
use pocketmine\inventory\Inventory;
use pocketmine\inventory\InventoryHolder;
use pocketmine\inventory\PlayerInventory;
use pocketmine\item\Item;
@ -83,6 +84,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
parent::saveNBT();
$this->namedtag->Inventory = new Enum("Inventory", []);
$this->namedtag->Inventory->setTagType(NBT::TAG_Compound);
if($this->inventory instanceof PlayerInventory){
for($slot = 0; $slot < 9; ++$slot){
$hotbarSlot = $this->inventory->getHotbarSlotIndex($slot);
if($hotbarSlot !== -1){
@ -133,6 +135,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
}
}
}
}
public function spawnTo(Player $player){
if($player !== $this and !isset($this->hasSpawned[$player->getID()])){