From 735d9a5bf4891a23d65d0c765275d361178bdb67 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 9 Aug 2023 12:04:02 +0100 Subject: [PATCH] CandleTrait: allow candle to be lit by fire charges --- src/block/utils/CandleTrait.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/block/utils/CandleTrait.php b/src/block/utils/CandleTrait.php index 99e164a84..58a7443a3 100644 --- a/src/block/utils/CandleTrait.php +++ b/src/block/utils/CandleTrait.php @@ -33,6 +33,7 @@ use pocketmine\item\ItemTypeIds; use pocketmine\math\RayTraceResult; use pocketmine\math\Vector3; use pocketmine\player\Player; +use pocketmine\world\sound\BlazeShootSound; use pocketmine\world\sound\FireExtinguishSound; use pocketmine\world\sound\FlintSteelSound; @@ -57,12 +58,16 @@ trait CandleTrait{ /** @see Block::onInteract() */ public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null, array &$returnedItems = []) : bool{ - if($item->getTypeId() === ItemTypeIds::FLINT_AND_STEEL || $item->hasEnchantment(VanillaEnchantments::FIRE_ASPECT())){ + if($item->getTypeId() === ItemTypeIds::FIRE_CHARGE || $item->getTypeId() === ItemTypeIds::FLINT_AND_STEEL || $item->hasEnchantment(VanillaEnchantments::FIRE_ASPECT())){ if($this->lit){ return true; } if($item instanceof Durable){ $item->applyDamage(1); + }elseif($item->getTypeId() === ItemTypeIds::FIRE_CHARGE){ + $item->pop(); + //TODO: not sure if this is intentional, but it's what Bedrock currently does as of 1.20.10 + $this->position->getWorld()->addSound($this->position, new BlazeShootSound()); } $this->position->getWorld()->addSound($this->position, new FlintSteelSound()); $this->position->getWorld()->setBlock($this->position, $this->setLit(true));