mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 20:28:31 +00:00
Fix missing sound when a projectile strikes an amethyst block (#5382)
closes #5358
This commit is contained in:
parent
b3b8516661
commit
34839da757
@ -55,9 +55,13 @@ use pocketmine\block\tile\Skull as TileSkull;
|
|||||||
use pocketmine\block\tile\Smoker as TileSmoker;
|
use pocketmine\block\tile\Smoker as TileSmoker;
|
||||||
use pocketmine\block\utils\TreeType;
|
use pocketmine\block\utils\TreeType;
|
||||||
use pocketmine\block\utils\WoodType;
|
use pocketmine\block\utils\WoodType;
|
||||||
|
use pocketmine\entity\projectile\Projectile;
|
||||||
use pocketmine\item\Item;
|
use pocketmine\item\Item;
|
||||||
use pocketmine\item\ToolTier;
|
use pocketmine\item\ToolTier;
|
||||||
|
use pocketmine\math\RayTraceResult;
|
||||||
use pocketmine\utils\CloningRegistryTrait;
|
use pocketmine\utils\CloningRegistryTrait;
|
||||||
|
use pocketmine\world\sound\AmethystBlockChimeSound;
|
||||||
|
use pocketmine\world\sound\BlockPunchSound;
|
||||||
use function mb_strtolower;
|
use function mb_strtolower;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1466,7 +1470,12 @@ final class VanillaBlocks{
|
|||||||
|
|
||||||
private static function registerBlocksR17() : void{
|
private static function registerBlocksR17() : void{
|
||||||
//in java this can be acquired using any tool - seems to be a parity issue in bedrock
|
//in java this can be acquired using any tool - seems to be a parity issue in bedrock
|
||||||
self::register("amethyst", new Opaque(new BID(Ids::AMETHYST), "Amethyst", new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD()))));
|
self::register("amethyst", new class(new BID(Ids::AMETHYST), "Amethyst", new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD()))) extends Opaque{
|
||||||
|
public function onProjectileHit(Projectile $projectile, RayTraceResult $hitResult) : void{
|
||||||
|
$this->position->getWorld()->addSound($this->position, new AmethystBlockChimeSound());
|
||||||
|
$this->position->getWorld()->addSound($this->position, new BlockPunchSound($this));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
self::register("calcite", new Opaque(new BID(Ids::CALCITE), "Calcite", new Info(BreakInfo::pickaxe(0.75, ToolTier::WOOD()))));
|
self::register("calcite", new Opaque(new BID(Ids::CALCITE), "Calcite", new Info(BreakInfo::pickaxe(0.75, ToolTier::WOOD()))));
|
||||||
self::register("tuff", new Opaque(new BID(Ids::TUFF), "Tuff", new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD(), 30.0))));
|
self::register("tuff", new Opaque(new BID(Ids::TUFF), "Tuff", new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD(), 30.0))));
|
||||||
|
35
src/world/sound/AmethystBlockChimeSound.php
Normal file
35
src/world/sound/AmethystBlockChimeSound.php
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ____ _ _ __ __ _ __ __ ____
|
||||||
|
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||||
|
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||||
|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||||
|
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* @author PocketMine Team
|
||||||
|
* @link http://www.pocketmine.net/
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace pocketmine\world\sound;
|
||||||
|
|
||||||
|
use pocketmine\math\Vector3;
|
||||||
|
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||||
|
use pocketmine\network\mcpe\protocol\types\LevelSoundEvent;
|
||||||
|
|
||||||
|
class AmethystBlockChimeSound implements Sound{
|
||||||
|
|
||||||
|
public function encode(Vector3 $pos) : array{
|
||||||
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::AMETHYST_BLOCK_CHIME, $pos, false)];
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user