mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
Fixed #39 placing blocks inside an entity
This commit is contained in:
parent
4bda101ab8
commit
e4d71949e3
3 changed files with 21 additions and 4 deletions
|
|
@ -229,6 +229,16 @@ class Entity extends stdClass{
|
|||
$this->server->api->dhandle("entity.move", $this);
|
||||
}
|
||||
|
||||
public function inBlock($x, $y, $z){
|
||||
$block = new Vector3($x + 0.5, $y, $z + 0.5);
|
||||
$me = new Vector3($this->x, $this->y, $this->z);
|
||||
$up = new Vector3($this->x, $this->y + 1, $this->z);
|
||||
if($block->distance($me) < 0.8 or $block->distance($up) < 0.8){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function updateVelocity(){
|
||||
$diffTime = microtime(true) - $this->last[3];
|
||||
$this->last[3] = microtime(true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue