mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 16:51:42 +00:00
Clean up LevelSoundEvent handling
This commit is contained in:
parent
e1504c668e
commit
0aebb3f4fb
@ -25,9 +25,10 @@ namespace pocketmine\block;
|
||||
|
||||
use pocketmine\block\utils\BlockDataValidator;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\level\sound\RedstonePowerOffSound;
|
||||
use pocketmine\level\sound\RedstonePowerOnSound;
|
||||
use pocketmine\math\Facing;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
use pocketmine\Player;
|
||||
|
||||
abstract class Button extends Flowable{
|
||||
@ -64,7 +65,7 @@ abstract class Button extends Flowable{
|
||||
$this->powered = true;
|
||||
$this->level->setBlock($this, $this);
|
||||
$this->level->scheduleDelayedBlockUpdate($this, $this->getActivationTime());
|
||||
$this->level->broadcastLevelSoundEvent($this->add(0.5, 0.5, 0.5), LevelSoundEventPacket::SOUND_POWER_ON);
|
||||
$this->level->addSound($this->add(0.5, 0.5, 0.5), new RedstonePowerOnSound());
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -74,7 +75,7 @@ abstract class Button extends Flowable{
|
||||
if($this->powered){
|
||||
$this->powered = false;
|
||||
$this->level->setBlock($this, $this);
|
||||
$this->level->broadcastLevelSoundEvent($this->add(0.5, 0.5, 0.5), LevelSoundEventPacket::SOUND_POWER_OFF);
|
||||
$this->level->addSound($this->add(0.5, 0.5, 0.5), new RedstonePowerOffSound());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,8 +27,10 @@ use pocketmine\entity\Entity;
|
||||
use pocketmine\event\entity\EntityCombustByBlockEvent;
|
||||
use pocketmine\event\entity\EntityDamageByBlockEvent;
|
||||
use pocketmine\event\entity\EntityDamageEvent;
|
||||
use pocketmine\level\sound\BucketEmptyLavaSound;
|
||||
use pocketmine\level\sound\BucketFillLavaSound;
|
||||
use pocketmine\level\sound\Sound;
|
||||
use pocketmine\math\Facing;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class Lava extends Liquid{
|
||||
|
||||
@ -36,12 +38,12 @@ class Lava extends Liquid{
|
||||
return 15;
|
||||
}
|
||||
|
||||
public function getBucketFillSound() : int{
|
||||
return LevelSoundEventPacket::SOUND_BUCKET_FILL_LAVA;
|
||||
public function getBucketFillSound() : Sound{
|
||||
return new BucketFillLavaSound();
|
||||
}
|
||||
|
||||
public function getBucketEmptySound() : int{
|
||||
return LevelSoundEventPacket::SOUND_BUCKET_EMPTY_LAVA;
|
||||
public function getBucketEmptySound() : Sound{
|
||||
return new BucketEmptyLavaSound();
|
||||
}
|
||||
|
||||
public function tickRate() : int{
|
||||
|
@ -25,9 +25,10 @@ namespace pocketmine\block;
|
||||
|
||||
use pocketmine\block\utils\BlockDataValidator;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\level\sound\RedstonePowerOffSound;
|
||||
use pocketmine\level\sound\RedstonePowerOnSound;
|
||||
use pocketmine\math\Facing;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
use pocketmine\Player;
|
||||
|
||||
class Lever extends Flowable{
|
||||
@ -112,9 +113,9 @@ class Lever extends Flowable{
|
||||
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
|
||||
$this->powered = !$this->powered;
|
||||
$this->level->setBlock($this, $this);
|
||||
$this->level->broadcastLevelSoundEvent(
|
||||
$this->level->addSound(
|
||||
$this->add(0.5, 0.5, 0.5),
|
||||
$this->powered ? LevelSoundEventPacket::SOUND_POWER_ON : LevelSoundEventPacket::SOUND_POWER_OFF
|
||||
$this->powered ? new RedstonePowerOnSound() : new RedstonePowerOffSound()
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ use pocketmine\event\block\BlockSpreadEvent;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\level\sound\FizzSound;
|
||||
use pocketmine\level\sound\Sound;
|
||||
use pocketmine\math\AxisAlignedBB;
|
||||
use pocketmine\math\Vector3;
|
||||
use function array_fill;
|
||||
@ -125,9 +126,9 @@ abstract class Liquid extends Transparent{
|
||||
return $b;
|
||||
}
|
||||
|
||||
abstract public function getBucketFillSound() : int;
|
||||
abstract public function getBucketFillSound() : Sound;
|
||||
|
||||
abstract public function getBucketEmptySound() : int;
|
||||
abstract public function getBucketEmptySound() : Sound;
|
||||
|
||||
public function isSource() : bool{
|
||||
return !$this->falling and $this->decay === 0;
|
||||
|
@ -24,7 +24,9 @@ declare(strict_types=1);
|
||||
namespace pocketmine\block;
|
||||
|
||||
use pocketmine\entity\Entity;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
use pocketmine\level\sound\BucketEmptyWaterSound;
|
||||
use pocketmine\level\sound\BucketFillWaterSound;
|
||||
use pocketmine\level\sound\Sound;
|
||||
|
||||
class Water extends Liquid{
|
||||
|
||||
@ -32,12 +34,12 @@ class Water extends Liquid{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public function getBucketFillSound() : int{
|
||||
return LevelSoundEventPacket::SOUND_BUCKET_FILL_WATER;
|
||||
public function getBucketFillSound() : Sound{
|
||||
return new BucketFillWaterSound();
|
||||
}
|
||||
|
||||
public function getBucketEmptySound() : int{
|
||||
return LevelSoundEventPacket::SOUND_BUCKET_EMPTY_WATER;
|
||||
public function getBucketEmptySound() : Sound{
|
||||
return new BucketEmptyWaterSound();
|
||||
}
|
||||
|
||||
public function tickRate() : int{
|
||||
|
@ -45,6 +45,7 @@ use pocketmine\item\Totem;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\level\sound\TotemUseSound;
|
||||
use pocketmine\level\sound\XpCollectSound;
|
||||
use pocketmine\level\sound\XpLevelUpSound;
|
||||
use pocketmine\nbt\NBT;
|
||||
use pocketmine\nbt\tag\ByteArrayTag;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
@ -53,7 +54,6 @@ use pocketmine\nbt\tag\ListTag;
|
||||
use pocketmine\nbt\tag\StringTag;
|
||||
use pocketmine\network\mcpe\protocol\AddPlayerPacket;
|
||||
use pocketmine\network\mcpe\protocol\EntityEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\PlayerListPacket;
|
||||
use pocketmine\network\mcpe\protocol\PlayerSkinPacket;
|
||||
use pocketmine\network\mcpe\protocol\types\PlayerListEntry;
|
||||
@ -354,7 +354,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
if($playSound){
|
||||
$newLevel = $this->getXpLevel();
|
||||
if((int) ($newLevel / 5) > (int) ($oldLevel / 5)){
|
||||
$this->playLevelUpSound($newLevel);
|
||||
$this->level->addSound($this, new XpLevelUpSound($newLevel));
|
||||
}
|
||||
}
|
||||
|
||||
@ -446,7 +446,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
if($playSound){
|
||||
$newLevel = $this->getXpLevel();
|
||||
if((int) ($newLevel / 5) > (int) ($oldLevel / 5)){
|
||||
$this->playLevelUpSound($newLevel);
|
||||
$this->level->addSound($this, new XpLevelUpSound($newLevel));
|
||||
}elseif($this->getCurrentTotalXp() > $oldTotal){
|
||||
$this->level->addSound($this, new XpCollectSound());
|
||||
}
|
||||
@ -458,11 +458,6 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
return false;
|
||||
}
|
||||
|
||||
private function playLevelUpSound(int $newLevel) : void{
|
||||
$volume = 0x10000000 * (min(30, $newLevel) / 5); //No idea why such odd numbers, but this works...
|
||||
$this->level->broadcastLevelSoundEvent($this, LevelSoundEventPacket::SOUND_LEVELUP, (int) $volume);
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes an amount of XP from the player, recalculating their XP level and progress.
|
||||
*
|
||||
|
@ -40,13 +40,13 @@ use pocketmine\item\Consumable;
|
||||
use pocketmine\item\Durable;
|
||||
use pocketmine\item\enchantment\Enchantment;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\level\sound\ItemBreakSound;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\math\VoxelRayTrace;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\nbt\tag\FloatTag;
|
||||
use pocketmine\nbt\tag\ListTag;
|
||||
use pocketmine\network\mcpe\protocol\EntityEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\MobEffectPacket;
|
||||
use pocketmine\Player;
|
||||
use pocketmine\timings\Timings;
|
||||
@ -544,7 +544,7 @@ abstract class Living extends Entity implements Damageable{
|
||||
private function damageItem(Durable $item, int $durabilityRemoved) : void{
|
||||
$item->applyDamage($durabilityRemoved);
|
||||
if($item->isBroken()){
|
||||
$this->level->broadcastLevelSoundEvent($this, LevelSoundEventPacket::SOUND_BREAK);
|
||||
$this->level->addSound($this, new ItemBreakSound());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,10 +30,10 @@ use pocketmine\event\inventory\InventoryPickupArrowEvent;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\item\ItemFactory;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\level\sound\ArrowHitSound;
|
||||
use pocketmine\math\RayTraceResult;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\network\mcpe\protocol\EntityEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\TakeItemEntityPacket;
|
||||
use pocketmine\Player;
|
||||
use function mt_rand;
|
||||
@ -138,7 +138,7 @@ class Arrow extends Projectile{
|
||||
|
||||
protected function onHit(ProjectileHitEvent $event) : void{
|
||||
$this->setCritical(false);
|
||||
$this->level->broadcastLevelSoundEvent($this, LevelSoundEventPacket::SOUND_BOW_HIT);
|
||||
$this->level->addSound($this, new ArrowHitSound());
|
||||
}
|
||||
|
||||
protected function onHitBlock(Block $blockHit, RayTraceResult $hitResult) : void{
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\entity\projectile;
|
||||
|
||||
use pocketmine\event\entity\ProjectileHitEvent;
|
||||
use pocketmine\level\particle\PotionSplashParticle;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
use pocketmine\level\sound\PotionSplashSound;
|
||||
use function mt_rand;
|
||||
|
||||
class ExperienceBottle extends Throwable{
|
||||
@ -39,7 +39,7 @@ class ExperienceBottle extends Throwable{
|
||||
|
||||
public function onHit(ProjectileHitEvent $event) : void{
|
||||
$this->level->addParticle($this, new PotionSplashParticle(PotionSplashParticle::DEFAULT_COLOR()));
|
||||
$this->level->broadcastLevelSoundEvent($this, LevelSoundEventPacket::SOUND_GLASS);
|
||||
$this->level->addSound($this, new PotionSplashSound());
|
||||
|
||||
$this->level->dropExperience($this, mt_rand(3, 11));
|
||||
}
|
||||
|
@ -33,8 +33,8 @@ use pocketmine\event\entity\ProjectileHitEntityEvent;
|
||||
use pocketmine\event\entity\ProjectileHitEvent;
|
||||
use pocketmine\item\Potion;
|
||||
use pocketmine\level\particle\PotionSplashParticle;
|
||||
use pocketmine\level\sound\PotionSplashSound;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
use pocketmine\utils\Color;
|
||||
use function round;
|
||||
use function sqrt;
|
||||
@ -82,7 +82,7 @@ class SplashPotion extends Throwable{
|
||||
}
|
||||
|
||||
$this->level->addParticle($this, $particle);
|
||||
$this->level->broadcastLevelSoundEvent($this, LevelSoundEventPacket::SOUND_GLASS);
|
||||
$this->level->addSound($this, new PotionSplashSound());
|
||||
|
||||
if($hasEffects){
|
||||
if(!$this->willLinger()){
|
||||
|
@ -23,8 +23,10 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\inventory;
|
||||
|
||||
use pocketmine\level\sound\ChestCloseSound;
|
||||
use pocketmine\level\sound\ChestOpenSound;
|
||||
use pocketmine\level\sound\Sound;
|
||||
use pocketmine\network\mcpe\protocol\BlockEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\types\WindowTypes;
|
||||
use pocketmine\Player;
|
||||
use pocketmine\tile\Chest;
|
||||
@ -54,12 +56,12 @@ class ChestInventory extends ContainerInventory{
|
||||
return $this->holder;
|
||||
}
|
||||
|
||||
protected function getOpenSound() : int{
|
||||
return LevelSoundEventPacket::SOUND_CHEST_OPEN;
|
||||
protected function getOpenSound() : Sound{
|
||||
return new ChestOpenSound();
|
||||
}
|
||||
|
||||
protected function getCloseSound() : int{
|
||||
return LevelSoundEventPacket::SOUND_CHEST_CLOSED;
|
||||
protected function getCloseSound() : Sound{
|
||||
return new ChestCloseSound();
|
||||
}
|
||||
|
||||
protected function onOpen(Player $who) : void{
|
||||
@ -68,7 +70,7 @@ class ChestInventory extends ContainerInventory{
|
||||
if(count($this->getViewers()) === 1 and $this->getHolder()->isValid()){
|
||||
//TODO: this crap really shouldn't be managed by the inventory
|
||||
$this->broadcastBlockEventPacket(true);
|
||||
$this->getHolder()->getLevel()->broadcastLevelSoundEvent($this->getHolder()->add(0.5, 0.5, 0.5), $this->getOpenSound());
|
||||
$this->getHolder()->getLevel()->addSound($this->getHolder()->add(0.5, 0.5, 0.5), $this->getOpenSound());
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,7 +78,7 @@ class ChestInventory extends ContainerInventory{
|
||||
if(count($this->getViewers()) === 1 and $this->getHolder()->isValid()){
|
||||
//TODO: this crap really shouldn't be managed by the inventory
|
||||
$this->broadcastBlockEventPacket(false);
|
||||
$this->getHolder()->getLevel()->broadcastLevelSoundEvent($this->getHolder()->add(0.5, 0.5, 0.5), $this->getCloseSound());
|
||||
$this->getHolder()->getLevel()->addSound($this->getHolder()->add(0.5, 0.5, 0.5), $this->getCloseSound());
|
||||
}
|
||||
parent::onClose($who);
|
||||
}
|
||||
|
@ -24,7 +24,9 @@ declare(strict_types=1);
|
||||
namespace pocketmine\inventory;
|
||||
|
||||
use pocketmine\level\Position;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
use pocketmine\level\sound\EnderChestCloseSound;
|
||||
use pocketmine\level\sound\EnderChestOpenSound;
|
||||
use pocketmine\level\sound\Sound;
|
||||
use pocketmine\network\mcpe\protocol\types\WindowTypes;
|
||||
use pocketmine\tile\EnderChest;
|
||||
|
||||
@ -51,12 +53,12 @@ class EnderChestInventory extends ChestInventory{
|
||||
$this->holder->setLevel($enderChest->getLevel());
|
||||
}
|
||||
|
||||
protected function getOpenSound() : int{
|
||||
return LevelSoundEventPacket::SOUND_ENDERCHEST_OPEN;
|
||||
protected function getOpenSound() : Sound{
|
||||
return new EnderChestOpenSound();
|
||||
}
|
||||
|
||||
protected function getCloseSound() : int{
|
||||
return LevelSoundEventPacket::SOUND_ENDERCHEST_CLOSED;
|
||||
protected function getCloseSound() : Sound{
|
||||
return new EnderChestCloseSound();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,7 +29,7 @@ use pocketmine\entity\projectile\Projectile;
|
||||
use pocketmine\event\entity\EntityShootBowEvent;
|
||||
use pocketmine\event\entity\ProjectileLaunchEvent;
|
||||
use pocketmine\item\enchantment\Enchantment;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
use pocketmine\level\sound\BowShootSound;
|
||||
use pocketmine\Player;
|
||||
use function intdiv;
|
||||
use function min;
|
||||
@ -106,7 +106,7 @@ class Bow extends Tool{
|
||||
}
|
||||
|
||||
$ev->getProjectile()->spawnToAll();
|
||||
$player->getLevel()->broadcastLevelSoundEvent($player, LevelSoundEventPacket::SOUND_BOW);
|
||||
$player->getLevel()->addSound($player, new BowShootSound());
|
||||
}else{
|
||||
$entity->spawnToAll();
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class Bucket extends Item{
|
||||
$ev->call();
|
||||
if(!$ev->isCancelled()){
|
||||
$player->getLevel()->setBlock($blockClicked, BlockFactory::get(BlockLegacyIds::AIR));
|
||||
$player->getLevel()->broadcastLevelSoundEvent($blockClicked->add(0.5, 0.5, 0.5), $blockClicked->getBucketFillSound());
|
||||
$player->getLevel()->addSound($blockClicked->add(0.5, 0.5, 0.5), $blockClicked->getBucketFillSound());
|
||||
if($player->isSurvival()){
|
||||
if($stack->getCount() === 0){
|
||||
$player->getInventory()->setItemInHand($ev->getItem());
|
||||
|
@ -26,8 +26,8 @@ namespace pocketmine\item;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\BlockFactory;
|
||||
use pocketmine\block\BlockLegacyIds;
|
||||
use pocketmine\level\sound\FlintSteelSound;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
use pocketmine\Player;
|
||||
use function assert;
|
||||
|
||||
@ -41,7 +41,7 @@ class FlintSteel extends Tool{
|
||||
$level = $player->getLevel();
|
||||
assert($level !== null);
|
||||
$level->setBlock($blockReplace, BlockFactory::get(BlockLegacyIds::FIRE));
|
||||
$level->broadcastLevelSoundEvent($blockReplace->add(0.5, 0.5, 0.5), LevelSoundEventPacket::SOUND_IGNITE);
|
||||
$level->addSound($blockReplace->add(0.5, 0.5, 0.5), new FlintSteelSound());
|
||||
|
||||
$this->applyDamage(1);
|
||||
|
||||
|
@ -64,7 +64,7 @@ class LiquidBucket extends Item{
|
||||
$ev->call();
|
||||
if(!$ev->isCancelled()){
|
||||
$player->getLevel()->setBlock($blockReplace, $resultBlock->getFlowingForm());
|
||||
$player->getLevel()->broadcastLevelSoundEvent($blockClicked->add(0.5, 0.5, 0.5), $resultBlock->getBucketEmptySound());
|
||||
$player->getLevel()->addSound($blockClicked->add(0.5, 0.5, 0.5), $resultBlock->getBucketEmptySound());
|
||||
|
||||
if($player->isSurvival()){
|
||||
$player->getInventory()->setItemInHand($ev->getItem());
|
||||
|
@ -24,12 +24,11 @@ declare(strict_types=1);
|
||||
namespace pocketmine\item;
|
||||
|
||||
use pocketmine\entity\EntityFactory;
|
||||
use pocketmine\entity\EntityIds;
|
||||
use pocketmine\entity\projectile\Throwable;
|
||||
use pocketmine\event\entity\ProjectileLaunchEvent;
|
||||
use pocketmine\level\sound\ThrowSound;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
use pocketmine\Player;
|
||||
use pocketmine\utils\Utils;
|
||||
|
||||
@ -73,7 +72,7 @@ abstract class ProjectileItem extends Item{
|
||||
|
||||
$projectile->spawnToAll();
|
||||
|
||||
$player->getLevel()->broadcastLevelSoundEvent($player, LevelSoundEventPacket::SOUND_THROW, 0, EntityIds::PLAYER);
|
||||
$player->getLevel()->addSound($player, new ThrowSound());
|
||||
|
||||
$this->pop();
|
||||
|
||||
|
@ -35,12 +35,12 @@ use pocketmine\event\entity\EntityDamageEvent;
|
||||
use pocketmine\event\entity\EntityExplodeEvent;
|
||||
use pocketmine\item\ItemFactory;
|
||||
use pocketmine\level\particle\HugeExplodeSeedParticle;
|
||||
use pocketmine\level\sound\ExplodeSound;
|
||||
use pocketmine\level\utils\SubChunkIteratorManager;
|
||||
use pocketmine\math\AxisAlignedBB;
|
||||
use pocketmine\math\Facing;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\ExplodePacket;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
use function ceil;
|
||||
use function floor;
|
||||
use function mt_rand;
|
||||
@ -247,7 +247,7 @@ class Explosion{
|
||||
$this->level->broadcastPacketToViewers($source, $pk);
|
||||
|
||||
$this->level->addParticle($source, new HugeExplodeSeedParticle());
|
||||
$this->level->broadcastLevelSoundEvent($source, LevelSoundEventPacket::SOUND_EXPLODE);
|
||||
$this->level->addSound($source, new ExplodeSound());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ use pocketmine\level\light\LightPopulationTask;
|
||||
use pocketmine\level\light\SkyLightUpdate;
|
||||
use pocketmine\level\particle\DestroyBlockParticle;
|
||||
use pocketmine\level\particle\Particle;
|
||||
use pocketmine\level\sound\BlockPlaceSound;
|
||||
use pocketmine\level\sound\Sound;
|
||||
use pocketmine\math\AxisAlignedBB;
|
||||
use pocketmine\math\Vector3;
|
||||
@ -73,11 +74,9 @@ use pocketmine\nbt\tag\ListTag;
|
||||
use pocketmine\nbt\tag\StringTag;
|
||||
use pocketmine\network\mcpe\ChunkRequestTask;
|
||||
use pocketmine\network\mcpe\CompressBatchPromise;
|
||||
use pocketmine\network\mcpe\protocol\AddEntityPacket;
|
||||
use pocketmine\network\mcpe\protocol\BlockEntityDataPacket;
|
||||
use pocketmine\network\mcpe\protocol\ClientboundPacket;
|
||||
use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\SetDifficultyPacket;
|
||||
use pocketmine\network\mcpe\protocol\SetTimePacket;
|
||||
use pocketmine\network\mcpe\protocol\UpdateBlockPacket;
|
||||
@ -515,30 +514,6 @@ class Level implements ChunkManager, Metadatable{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcasts a LevelSoundEvent to players in the area.
|
||||
*
|
||||
* @param Vector3 $pos
|
||||
* @param int $soundId
|
||||
* @param int $extraData
|
||||
* @param int $entityTypeId
|
||||
* @param bool $isBabyMob
|
||||
*/
|
||||
public function broadcastLevelSoundEvent(?Vector3 $pos, int $soundId, int $extraData = -1, int $entityTypeId = -1, bool $isBabyMob = false){
|
||||
$pk = LevelSoundEventPacket::create(
|
||||
$soundId,
|
||||
$extraData,
|
||||
$pos,
|
||||
AddEntityPacket::LEGACY_ID_MAP_BC[$entityTypeId] ?? ":",
|
||||
$isBabyMob
|
||||
);
|
||||
if($pos !== null){
|
||||
$this->broadcastPacketToViewers($pos, $pk);
|
||||
}else{
|
||||
$this->broadcastGlobalPacket($pk);
|
||||
}
|
||||
}
|
||||
|
||||
public function getAutoSave() : bool{
|
||||
return $this->autoSave;
|
||||
}
|
||||
@ -1895,7 +1870,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
}
|
||||
|
||||
if($playSound){
|
||||
$this->broadcastLevelSoundEvent($hand, LevelSoundEventPacket::SOUND_PLACE, $hand->getRuntimeId());
|
||||
$this->addSound($hand, new BlockPlaceSound($hand));
|
||||
}
|
||||
|
||||
$item->pop();
|
||||
|
34
src/pocketmine/level/sound/ArrowHitSound.php
Normal file
34
src/pocketmine/level/sound/ArrowHitSound.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?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\level\sound;
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class ArrowHitSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BOW_HIT, $pos);
|
||||
}
|
||||
}
|
42
src/pocketmine/level/sound/BlockBreakSound.php
Normal file
42
src/pocketmine/level/sound/BlockBreakSound.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?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\level\sound;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class BlockBreakSound implements Sound{
|
||||
|
||||
/** @var Block */
|
||||
private $block;
|
||||
|
||||
public function __construct(Block $block){
|
||||
$this->block = $block;
|
||||
}
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BREAK, $pos, $this->block->getRuntimeId());
|
||||
}
|
||||
}
|
42
src/pocketmine/level/sound/BlockPlaceSound.php
Normal file
42
src/pocketmine/level/sound/BlockPlaceSound.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?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\level\sound;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class BlockPlaceSound implements Sound{
|
||||
|
||||
/** @var Block */
|
||||
private $block;
|
||||
|
||||
public function __construct(Block $block){
|
||||
$this->block = $block;
|
||||
}
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_PLACE, $pos, $this->block->getRuntimeId());
|
||||
}
|
||||
}
|
34
src/pocketmine/level/sound/BowShootSound.php
Normal file
34
src/pocketmine/level/sound/BowShootSound.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?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\level\sound;
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class BowShootSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BOW, $pos);
|
||||
}
|
||||
}
|
34
src/pocketmine/level/sound/BucketEmptyLavaSound.php
Normal file
34
src/pocketmine/level/sound/BucketEmptyLavaSound.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?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\level\sound;
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class BucketEmptyLavaSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BUCKET_EMPTY_LAVA, $pos);
|
||||
}
|
||||
}
|
34
src/pocketmine/level/sound/BucketEmptyWaterSound.php
Normal file
34
src/pocketmine/level/sound/BucketEmptyWaterSound.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?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\level\sound;
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class BucketEmptyWaterSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BUCKET_EMPTY_WATER, $pos);
|
||||
}
|
||||
}
|
34
src/pocketmine/level/sound/BucketFillLavaSound.php
Normal file
34
src/pocketmine/level/sound/BucketFillLavaSound.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?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\level\sound;
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class BucketFillLavaSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BUCKET_FILL_LAVA, $pos);
|
||||
}
|
||||
}
|
34
src/pocketmine/level/sound/BucketFillWaterSound.php
Normal file
34
src/pocketmine/level/sound/BucketFillWaterSound.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?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\level\sound;
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class BucketFillWaterSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BUCKET_FILL_WATER, $pos);
|
||||
}
|
||||
}
|
34
src/pocketmine/level/sound/ChestCloseSound.php
Normal file
34
src/pocketmine/level/sound/ChestCloseSound.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?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\level\sound;
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class ChestCloseSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_CHEST_CLOSED, $pos);
|
||||
}
|
||||
}
|
34
src/pocketmine/level/sound/ChestOpenSound.php
Normal file
34
src/pocketmine/level/sound/ChestOpenSound.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?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\level\sound;
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class ChestOpenSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_CHEST_OPEN, $pos);
|
||||
}
|
||||
}
|
34
src/pocketmine/level/sound/EnderChestCloseSound.php
Normal file
34
src/pocketmine/level/sound/EnderChestCloseSound.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?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\level\sound;
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class EnderChestCloseSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_ENDERCHEST_CLOSED, $pos);
|
||||
}
|
||||
}
|
34
src/pocketmine/level/sound/EnderChestOpenSound.php
Normal file
34
src/pocketmine/level/sound/EnderChestOpenSound.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?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\level\sound;
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class EnderChestOpenSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_ENDERCHEST_OPEN, $pos);
|
||||
}
|
||||
}
|
34
src/pocketmine/level/sound/ExplodeSound.php
Normal file
34
src/pocketmine/level/sound/ExplodeSound.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?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\level\sound;
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class ExplodeSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_EXPLODE, $pos);
|
||||
}
|
||||
}
|
34
src/pocketmine/level/sound/FlintSteelSound.php
Normal file
34
src/pocketmine/level/sound/FlintSteelSound.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?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\level\sound;
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class FlintSteelSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_IGNITE, $pos);
|
||||
}
|
||||
}
|
34
src/pocketmine/level/sound/PotionSplashSound.php
Normal file
34
src/pocketmine/level/sound/PotionSplashSound.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?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\level\sound;
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class PotionSplashSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_GLASS, $pos);
|
||||
}
|
||||
}
|
34
src/pocketmine/level/sound/RedstonePowerOffSound.php
Normal file
34
src/pocketmine/level/sound/RedstonePowerOffSound.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?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\level\sound;
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class RedstonePowerOffSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_POWER_OFF, $pos);
|
||||
}
|
||||
}
|
34
src/pocketmine/level/sound/RedstonePowerOnSound.php
Normal file
34
src/pocketmine/level/sound/RedstonePowerOnSound.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?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\level\sound;
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class RedstonePowerOnSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_POWER_ON, $pos);
|
||||
}
|
||||
}
|
34
src/pocketmine/level/sound/ThrowSound.php
Normal file
34
src/pocketmine/level/sound/ThrowSound.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?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\level\sound;
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class ThrowSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_THROW, $pos, -1, "minecraft:player");
|
||||
}
|
||||
}
|
@ -285,7 +285,7 @@ class LevelSoundEventPacket extends DataPacket implements ClientboundPacket, Ser
|
||||
public const SOUND_CANT_BREED = 254;
|
||||
public const SOUND_UNDEFINED = 255;
|
||||
|
||||
public static function create(int $sound, int $extraData, ?Vector3 $pos, string $entityType = ":", bool $isBabyMob = false) : self{
|
||||
public static function create(int $sound, ?Vector3 $pos, int $extraData = -1, string $entityType = ":", bool $isBabyMob = false) : self{
|
||||
$result = new self;
|
||||
$result->sound = $sound;
|
||||
$result->extraData = $extraData;
|
||||
|
Loading…
x
Reference in New Issue
Block a user