diff --git a/src/pocketmine/item/Bucket.php b/src/pocketmine/item/Bucket.php index 0cd99f5a8..af516e8d1 100644 --- a/src/pocketmine/item/Bucket.php +++ b/src/pocketmine/item/Bucket.php @@ -50,6 +50,14 @@ class Bucket extends Item implements MaybeConsumable{ return 0; } + public function getFuelResidue() : Item{ + if($this->meta === Block::LAVA or $this->meta === Block::FLOWING_LAVA){ + return ItemFactory::get(Item::BUCKET); + } + + return parent::getFuelResidue(); + } + public function onActivate(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : bool{ $resultBlock = BlockFactory::get($this->meta); diff --git a/src/pocketmine/item/Item.php b/src/pocketmine/item/Item.php index 5d49dd848..b062d6bb2 100644 --- a/src/pocketmine/item/Item.php +++ b/src/pocketmine/item/Item.php @@ -655,6 +655,16 @@ class Item implements ItemIds, \JsonSerializable{ return 0; } + /** + * Returns an item after burning fuel + */ + public function getFuelResidue() : Item{ + $item = clone $this; + $item->pop(); + + return $item; + } + /** * Returns how many points of damage this item will deal to an entity when used as a weapon. */ diff --git a/src/pocketmine/tile/Furnace.php b/src/pocketmine/tile/Furnace.php index 920b93249..22ab6adf6 100644 --- a/src/pocketmine/tile/Furnace.php +++ b/src/pocketmine/tile/Furnace.php @@ -152,8 +152,7 @@ class Furnace extends Spawnable implements InventoryHolder, Container, Nameable{ } if($this->burnTime > 0 and $ev->isBurning()){ - $fuel->pop(); - $this->inventory->setFuel($fuel); + $this->inventory->setFuel($fuel->getFuelResidue()); } }