From 70b86061f6f87d0e7c81dc36a12ec0ed75d981b8 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Tue, 19 Mar 2013 19:05:46 +0100 Subject: [PATCH] Drowing is only checked once per check --- src/world/Entity.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/world/Entity.php b/src/world/Entity.php index 337369302..68816a15d 100644 --- a/src/world/Entity.php +++ b/src/world/Entity.php @@ -238,6 +238,7 @@ class Entity extends stdClass{ $endX = $startX + 2; $endY = $startY + 2; $endZ = $startZ + 2; + $waterDone = false; for($y = $startY; $y <= $endY; ++$y){ for($x = $startX; $x <= $endX; ++$x){ for($z = $startZ; $z <= $endZ; ++$z){ @@ -251,8 +252,9 @@ class Entity extends stdClass{ } if($this->air <= 0){ $this->harm(2, "water"); - }elseif($x == ($endX - 1) and $y == $endY and $z == ($endZ - 1) and ($this->class === ENTITY_MOB or $this->class === ENTITY_PLAYER)){ + }elseif($x == ($endX - 1) and $y == $endY and $z == ($endZ - 1) and ($this->class === ENTITY_MOB or $this->class === ENTITY_PLAYER) and $waterDone === false){ $this->air -= 10; + $waterDone = true; $this->updateMetadata(); } break;