mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 11:57:10 +00:00
CandleTrait: allow candle to be lit by fire charges
This commit is contained in:
parent
f4a06605b1
commit
735d9a5bf4
@ -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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user