mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-18 20:14:31 +00:00
Fixed #1642
This commit is contained in:
@@ -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();
|
||||
|
Reference in New Issue
Block a user