mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
pathfinder was changed, 102 bug fixed
This commit is contained in:
parent
2ea5fcd034
commit
7b66cd0250
10 changed files with 424 additions and 160 deletions
|
|
@ -3,6 +3,7 @@ class Pig extends Animal{
|
|||
const TYPE = MOB_PIG;
|
||||
public $pathFinder, $path, $server;
|
||||
public function __construct(Level $level, $eid, $class, $type = 0, $data = array()){
|
||||
$this->pathFinder = new AStar($this); //make it before everything else as entity class constructor sends update
|
||||
parent::__construct($level, $eid, $class, $type, $data);
|
||||
$this->setHealth(isset($this->data["Health"]) ? $this->data["Health"]:10, "generic");
|
||||
$this->server = ServerAPI::request();
|
||||
|
|
@ -19,4 +20,12 @@ class Pig extends Animal{
|
|||
array(($this->fire > 0 ? COOKED_PORKCHOP:RAW_PORKCHOP), 0, mt_rand(0,2)),
|
||||
);
|
||||
}
|
||||
|
||||
public function update(){
|
||||
//$start = new MinecraftNode(round($this->x), round($this->y), round($this->z));
|
||||
//$stop = $start->add(5,0,5);
|
||||
//$path = $this->pathFinder->findPath($start, $stop); //allows diagonals, path should be ~5 blocks
|
||||
//var_dump($path);
|
||||
parent::update();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue