Merge changes from master

This commit is contained in:
Dylan K. Taylor
2017-08-22 14:13:31 +01:00
131 changed files with 690 additions and 505 deletions

View File

@ -890,11 +890,9 @@ abstract class Entity extends Location implements Metadatable{
}
/**
* @param float $damage
* @param EntityDamageEvent $source
*
*/
public function attack($damage, EntityDamageEvent $source){
public function attack(EntityDamageEvent $source){
$this->server->getPluginManager()->callEvent($source);
if($source->isCancelled()){
return;
@ -920,11 +918,9 @@ abstract class Entity extends Location implements Metadatable{
}
/**
* @param float $amount
* @param EntityRegainHealthEvent $source
*
*/
public function heal($amount, EntityRegainHealthEvent $source){
public function heal(EntityRegainHealthEvent $source){
$this->server->getPluginManager()->callEvent($source);
if($source->isCancelled()){
return;
@ -1108,7 +1104,6 @@ abstract class Entity extends Location implements Metadatable{
public function entityBaseTick(int $tickDiff = 1) : bool{
//TODO: check vehicles
$this->blocksAround = null;
$this->justCreated = false;
if(!$this->isAlive()){
@ -1132,7 +1127,7 @@ abstract class Entity extends Location implements Metadatable{
if($this->y <= -16 and $this->isAlive()){
$ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_VOID, 10);
$this->attack($ev->getFinalDamage(), $ev);
$this->attack($ev);
$hasUpdate = true;
}
@ -1180,7 +1175,7 @@ abstract class Entity extends Location implements Metadatable{
*/
protected function dealFireDamage(){
$ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_FIRE_TICK, 1);
$this->attack($ev->getFinalDamage(), $ev);
$this->attack($ev);
}
protected function updateMovement(){
@ -1347,6 +1342,8 @@ abstract class Entity extends Location implements Metadatable{
final public function setForceMovementUpdate(bool $value = true){
$this->forceMovementUpdate = $value;
$this->onGround = false;
$this->blocksAround = null;
}
/**
@ -1507,6 +1504,8 @@ abstract class Entity extends Location implements Metadatable{
}
public function fastMove(float $dx, float $dy, float $dz) : bool{
$this->blocksAround = null;
if($dx == 0 and $dz == 0 and $dy == 0){
return true;
}
@ -1546,13 +1545,12 @@ abstract class Entity extends Location implements Metadatable{
}
public function move(float $dx, float $dy, float $dz) : bool{
$this->blocksAround = null;
if($dx == 0 and $dz == 0 and $dy == 0){
return true;
}
$this->blocksAround = null;
if($this->keepMovement){
$this->boundingBox->offset($dx, $dy, $dz);
$this->setPosition($this->temporalVector->setComponents(($this->boundingBox->minX + $this->boundingBox->maxX) / 2, $this->boundingBox->minY, ($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2));