Merge branch 'stable'

This commit is contained in:
Dylan K. Taylor
2019-07-07 18:10:19 +01:00
4 changed files with 14 additions and 3 deletions

View File

@@ -34,6 +34,7 @@ use pocketmine\world\sound\FizzSound;
use pocketmine\world\sound\Sound;
use pocketmine\world\World;
use function array_fill;
use function intdiv;
use function lcg_value;
use function min;
@@ -405,7 +406,7 @@ abstract class Liquid extends Transparent{
*/
private function getOptimalFlowDirections() : array{
$flowCost = array_fill(0, 4, 1000);
$maxCost = 4 / $this->getFlowDecayPerBlock();
$maxCost = intdiv(4, $this->getFlowDecayPerBlock());
for($j = 0; $j < 4; ++$j){
$x = $this->x;
$y = $this->y;

View File

@@ -389,7 +389,9 @@ abstract class Living extends Entity{
}
public function attack(EntityDamageEvent $source) : void{
if($this->attackTime > 0 or $this->noDamageTicks > 0){
if($this->noDamageTicks > 0){
$source->setCancelled();
}elseif($this->attackTime > 0){
$lastCause = $this->getLastDamageCause();
if($lastCause !== null and $lastCause->getBaseDamage() >= $source->getBaseDamage()){
$source->setCancelled();