From 643866c08dc4d78c6f24016ea7863270f5b51976 Mon Sep 17 00:00:00 2001 From: ZloyNick Date: Mon, 4 May 2020 18:20:35 +0300 Subject: [PATCH 1/2] Getter and setter addition for saturation. Enchanted golden apple works This commit adds 2 get|set methods: Player::getSaturation(); Player::setSaturation($val); and makes Enchanted Golden Apples are workable. --- src/pocketmine/Player.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 725997b5b..2d9776afd 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -1607,6 +1607,7 @@ public function doFood() } } + //TODO: Rewriting food system protected static $foodData = [ Item::APPLE => ['food' => 4, 'saturation' => 2.4], Item::BAKED_POTATO => ['food' => 5, 'saturation' => 6], @@ -1624,6 +1625,7 @@ public function doFood() Item::COOKED_SALMON => ['food' => 6, 'saturation' => 9.6], Item::COOKIE => ['food' => 2, 'saturation' => 0.4], Item::GOLDEN_APPLE => ['food' => 4, 'saturation' => 9.6], + Item::ENCHANTNED_GOLDEN_APPLE => ['food' => 4, 'saturation' => 9.6], Item::GOLDEN_CARROT => ['food' => 6, 'saturation' => 14.4], Item::MELON => ['food' => 2, 'saturation' => 1.2], Item::MUSHROOM_STEW => ['food' => 6, 'saturation' => 7.2], @@ -2882,6 +2884,16 @@ public function setFood($amount){ public function getFood() { return $this->foodLevel; } + + public functon getSaturation() + { + return $this->satuartion; + } + + public function setSaturation($sat) + { + $this->saturation = $sat; + } public function subtractFood($amount){ if (!$this->getFoodEnabled()) { From 2d0035e486090fb3faf8437fd29b24abefefce01 Mon Sep 17 00:00:00 2001 From: ZloyNick Date: Tue, 5 May 2020 12:01:47 +0300 Subject: [PATCH 2/2] Update Player.php --- src/pocketmine/Player.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 2d9776afd..38100297e 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -2885,7 +2885,7 @@ public function getFood() { return $this->foodLevel; } - public functon getSaturation() + public function getSaturation() { return $this->satuartion; }