Fix missing sound when a projectile strikes an amethyst block (#5382)

closes #5358
This commit is contained in:
zSALLAZAR
2022-11-15 15:50:05 +01:00
committed by GitHub
parent b3b8516661
commit 34839da757
2 changed files with 45 additions and 1 deletions

View File

@ -55,9 +55,13 @@ use pocketmine\block\tile\Skull as TileSkull;
use pocketmine\block\tile\Smoker as TileSmoker;
use pocketmine\block\utils\TreeType;
use pocketmine\block\utils\WoodType;
use pocketmine\entity\projectile\Projectile;
use pocketmine\item\Item;
use pocketmine\item\ToolTier;
use pocketmine\math\RayTraceResult;
use pocketmine\utils\CloningRegistryTrait;
use pocketmine\world\sound\AmethystBlockChimeSound;
use pocketmine\world\sound\BlockPunchSound;
use function mb_strtolower;
/**
@ -1466,7 +1470,12 @@ final class VanillaBlocks{
private static function registerBlocksR17() : void{
//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("tuff", new Opaque(new BID(Ids::TUFF), "Tuff", new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD(), 30.0))));