diff --git a/src/block/Furnace.php b/src/block/Furnace.php index d4b74ea7c..60352585b 100644 --- a/src/block/Furnace.php +++ b/src/block/Furnace.php @@ -26,9 +26,15 @@ namespace pocketmine\block; use pocketmine\block\tile\Furnace as TileFurnace; use pocketmine\block\utils\FacesOppositePlacingPlayerTrait; use pocketmine\block\utils\NormalHorizontalFacingInMetadataTrait; +use pocketmine\crafting\FurnaceType; use pocketmine\item\Item; use pocketmine\math\Vector3; use pocketmine\player\Player; +use pocketmine\utils\AssumptionFailedError; +use pocketmine\world\sound\BlastFurnaceSound; +use pocketmine\world\sound\FurnaceSound; +use pocketmine\world\sound\SmokerSound; +use function mt_rand; class Furnace extends Opaque{ use FacesOppositePlacingPlayerTrait; @@ -84,6 +90,14 @@ class Furnace extends Opaque{ public function onScheduledUpdate() : void{ $furnace = $this->position->getWorld()->getTile($this->position); if($furnace instanceof TileFurnace && $furnace->onUpdate()){ + if(mt_rand(1, 60) === 1){ //in vanilla this is between 1 and 5 seconds; try to average about 3 + $this->position->getWorld()->addSound($this->position, match($furnace->getFurnaceType()->id()){ + FurnaceType::FURNACE()->id() => new FurnaceSound(), + FurnaceType::BLAST_FURNACE()->id() => new BlastFurnaceSound(), + FurnaceType::SMOKER()->id() => new SmokerSound(), + default => throw new AssumptionFailedError("Unreachable") + }); + } $this->position->getWorld()->scheduleDelayedBlockUpdate($this->position, 1); //TODO: check this } } diff --git a/src/world/sound/BlastFurnaceSound.php b/src/world/sound/BlastFurnaceSound.php new file mode 100644 index 000000000..c7846e6c5 --- /dev/null +++ b/src/world/sound/BlastFurnaceSound.php @@ -0,0 +1,35 @@ +