diff --git a/src/entity/Entity.php b/src/entity/Entity.php index ed76aa8c..eba2d156 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -395,7 +395,13 @@ class Entity extends Position if($this->level->handleMaterialAcceleration($this->boundingBox->expand(0, -0.4, 0)->contract(0.001, 0.001, 0.001), 0, $this)){ $this->fallDistance = 0; $this->inWater = true; - $this->fire = 0; + if($this->fire > 0){ + $this->fire = 0; + $this->updateMetadata(); + }else{ + $this->fire = 0; + } + }else{ $this->inWater = false; } @@ -454,7 +460,6 @@ class Entity extends Position } $this->handleWaterMovement(); - if($this->fire > 0){ //TODO move somewhere if(!$this->isImmuneToFire){ if(($this->fire % 20) == 0){ diff --git a/src/entity/monster/Skeleton.php b/src/entity/monster/Skeleton.php index 712ca59d..0de4d329 100644 --- a/src/entity/monster/Skeleton.php +++ b/src/entity/monster/Skeleton.php @@ -20,11 +20,19 @@ class Skeleton extends Monster{ } public function updateBurning(){ - if($this->fire > 0 or !$this->level->isDay() || $this->inWater){ //TODO fix burning in water + if($this->fire > 0 || !$this->level->isDay() || $this->inWater){ return false; } + //bad fix for burning in water + [$block, $meta] = $this->level->level->getBlock((int)$this->x, (int)$this->y, (int)$this->z); + if($block == WATER || $block == STILL_WATER){ + $v16 = ((int)$this->y + 1) - LiquidBlock::getPercentAir($meta); + if($this->boundingBox->intersectsWith(new AxisAlignedBB((int)$this->x, (int)$this->y, (int)$this->z, (int)$this->x + 1, $v16, (int)$this->z + 1))){ + return false; + } + } - for($y = $this->y; $y < 129; $y++){ + for($y = (int)$this->y; $y < 129; $y++){ $block = $this->level->level->getBlockID($this->x, $y, $this->z); if(StaticBlock::getIsSolid($block)){ return false; @@ -42,9 +50,9 @@ class Skeleton extends Monster{ } } - public function update($now){ + public function updateEntityMovement(){ $this->updateBurning(); - parent::update($now); + return parent::updateEntityMovement(); } public function getDrops(){ diff --git a/src/entity/monster/Zombie.php b/src/entity/monster/Zombie.php index 8f871b05..bfb42d54 100644 --- a/src/entity/monster/Zombie.php +++ b/src/entity/monster/Zombie.php @@ -19,11 +19,19 @@ class Zombie extends Monster{ } public function updateBurning(){ - if($this->fire > 0 || !$this->level->isDay() || $this->inWater){ //TODO fix burning in water + if($this->fire > 0 || !$this->level->isDay() || $this->inWater){ return false; } + //bad fix for burning in water + [$block, $meta] = $this->level->level->getBlock((int)$this->x, (int)$this->y, (int)$this->z); + if($block == WATER || $block == STILL_WATER){ + $v16 = ((int)$this->y + 1) - LiquidBlock::getPercentAir($meta); + if($this->boundingBox->intersectsWith(new AxisAlignedBB((int)$this->x, (int)$this->y, (int)$this->z, (int)$this->x + 1, $v16, (int)$this->z + 1))){ + return false; + } + } - for($y = $this->y; $y < 129; $y++){ + for($y = (int)$this->y; $y < 129; $y++){ $block = $this->level->level->getBlockID($this->x, $y, $this->z); if(StaticBlock::getIsSolid($block)){ return false; @@ -44,10 +52,10 @@ class Zombie extends Monster{ public function getAttackDamage(){ return 4; } - - public function update($now){ + + public function updateEntityMovement(){ $this->updateBurning(); - parent::update($now); + return parent::updateEntityMovement(); } public function getDrops(){