-
Notifications
You must be signed in to change notification settings - Fork 4
/
Entity.php
54 lines (44 loc) · 1.02 KB
/
Entity.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
namespace Aternos\Hawk;
use Aternos\Nbt\Tag\CompoundTag;
class Entity
{
protected string $name;
protected McCoordinatesFloat $coordinates;
protected CompoundTag $tag;
public function __construct(CompoundTag $tag)
{
$this->tag = $tag;
$pos = $tag->getList("Pos");
$this->name = $tag->getString("id")->getValue();
$this->coordinates = new McCoordinatesFloat($pos[0]->getValue(), $pos[1]->getValue(), $pos[2]->getValue());
}
/**
* @return string
*/
public function getName(): string
{
return $this->name;
}
/**
* @return McCoordinatesFloat
*/
public function getCoordinates(): McCoordinatesFloat
{
return $this->coordinates;
}
/**
* @return CompoundTag
*/
public function createTag(): CompoundTag
{
return $this->tag;
}
/**
* @return string
*/
public function __toString(): string
{
return $this->name . " at: " . $this->coordinates;
}
}