diff --git a/composer.lock b/composer.lock index 89bd8e43b..883984a57 100644 --- a/composer.lock +++ b/composer.lock @@ -253,12 +253,12 @@ "source": { "type": "git", "url": "https://github.com/pmmp/BedrockProtocol.git", - "reference": "97fa88e9eff2c9bd5408fa964515504a4d9230bf" + "reference": "5285dde125b529e070db7eeb0d3774208e1652ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/97fa88e9eff2c9bd5408fa964515504a4d9230bf", - "reference": "97fa88e9eff2c9bd5408fa964515504a4d9230bf", + "url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/5285dde125b529e070db7eeb0d3774208e1652ef", + "reference": "5285dde125b529e070db7eeb0d3774208e1652ef", "shasum": "" }, "require": { @@ -293,7 +293,7 @@ "issues": "https://github.com/pmmp/BedrockProtocol/issues", "source": "https://github.com/pmmp/BedrockProtocol/tree/master" }, - "time": "2021-10-23T00:06:46+00:00" + "time": "2021-10-23T15:18:49+00:00" }, { "name": "pocketmine/binaryutils", diff --git a/src/block/utils/RecordType.php b/src/block/utils/RecordType.php index 093663d0b..967cdc034 100644 --- a/src/block/utils/RecordType.php +++ b/src/block/utils/RecordType.php @@ -26,6 +26,7 @@ namespace pocketmine\block\utils; use pocketmine\lang\KnownTranslationFactory; use pocketmine\lang\Translatable; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; use pocketmine\utils\EnumTrait; /** @@ -54,18 +55,18 @@ final class RecordType{ protected static function setup() : void{ self::registerAll( - new RecordType("disk_13", "C418 - 13", LevelSoundEventPacket::SOUND_RECORD_13, KnownTranslationFactory::item_record_13_desc()), - new RecordType("disk_cat", "C418 - cat", LevelSoundEventPacket::SOUND_RECORD_CAT, KnownTranslationFactory::item_record_cat_desc()), - new RecordType("disk_blocks", "C418 - blocks", LevelSoundEventPacket::SOUND_RECORD_BLOCKS, KnownTranslationFactory::item_record_blocks_desc()), - new RecordType("disk_chirp", "C418 - chirp", LevelSoundEventPacket::SOUND_RECORD_CHIRP, KnownTranslationFactory::item_record_chirp_desc()), - new RecordType("disk_far", "C418 - far", LevelSoundEventPacket::SOUND_RECORD_FAR, KnownTranslationFactory::item_record_far_desc()), - new RecordType("disk_mall", "C418 - mall", LevelSoundEventPacket::SOUND_RECORD_MALL, KnownTranslationFactory::item_record_mall_desc()), - new RecordType("disk_mellohi", "C418 - mellohi", LevelSoundEventPacket::SOUND_RECORD_MELLOHI, KnownTranslationFactory::item_record_mellohi_desc()), - new RecordType("disk_stal", "C418 - stal", LevelSoundEventPacket::SOUND_RECORD_STAL, KnownTranslationFactory::item_record_stal_desc()), - new RecordType("disk_strad", "C418 - strad", LevelSoundEventPacket::SOUND_RECORD_STRAD, KnownTranslationFactory::item_record_strad_desc()), - new RecordType("disk_ward", "C418 - ward", LevelSoundEventPacket::SOUND_RECORD_WARD, KnownTranslationFactory::item_record_ward_desc()), - new RecordType("disk_11", "C418 - 11", LevelSoundEventPacket::SOUND_RECORD_11, KnownTranslationFactory::item_record_11_desc()), - new RecordType("disk_wait", "C418 - wait", LevelSoundEventPacket::SOUND_RECORD_WAIT, KnownTranslationFactory::item_record_wait_desc()) + new RecordType("disk_13", "C418 - 13", LevelSoundEvent::RECORD_13, KnownTranslationFactory::item_record_13_desc()), + new RecordType("disk_cat", "C418 - cat", LevelSoundEvent::RECORD_CAT, KnownTranslationFactory::item_record_cat_desc()), + new RecordType("disk_blocks", "C418 - blocks", LevelSoundEvent::RECORD_BLOCKS, KnownTranslationFactory::item_record_blocks_desc()), + new RecordType("disk_chirp", "C418 - chirp", LevelSoundEvent::RECORD_CHIRP, KnownTranslationFactory::item_record_chirp_desc()), + new RecordType("disk_far", "C418 - far", LevelSoundEvent::RECORD_FAR, KnownTranslationFactory::item_record_far_desc()), + new RecordType("disk_mall", "C418 - mall", LevelSoundEvent::RECORD_MALL, KnownTranslationFactory::item_record_mall_desc()), + new RecordType("disk_mellohi", "C418 - mellohi", LevelSoundEvent::RECORD_MELLOHI, KnownTranslationFactory::item_record_mellohi_desc()), + new RecordType("disk_stal", "C418 - stal", LevelSoundEvent::RECORD_STAL, KnownTranslationFactory::item_record_stal_desc()), + new RecordType("disk_strad", "C418 - strad", LevelSoundEvent::RECORD_STRAD, KnownTranslationFactory::item_record_strad_desc()), + new RecordType("disk_ward", "C418 - ward", LevelSoundEvent::RECORD_WARD, KnownTranslationFactory::item_record_ward_desc()), + new RecordType("disk_11", "C418 - 11", LevelSoundEvent::RECORD_11, KnownTranslationFactory::item_record_11_desc()), + new RecordType("disk_wait", "C418 - wait", LevelSoundEvent::RECORD_WAIT, KnownTranslationFactory::item_record_wait_desc()) //TODO: Lena Raine - Pigstep ); } diff --git a/src/entity/animation/ArmSwingAnimation.php b/src/entity/animation/ArmSwingAnimation.php index c309472bf..8871415a2 100644 --- a/src/entity/animation/ArmSwingAnimation.php +++ b/src/entity/animation/ArmSwingAnimation.php @@ -25,6 +25,7 @@ namespace pocketmine\entity\animation; use pocketmine\entity\Living; use pocketmine\network\mcpe\protocol\ActorEventPacket; +use pocketmine\network\mcpe\protocol\types\ActorEvent; final class ArmSwingAnimation implements Animation{ @@ -37,7 +38,7 @@ final class ArmSwingAnimation implements Animation{ public function encode() : array{ return [ - ActorEventPacket::create($this->entity->getId(), ActorEventPacket::ARM_SWING, 0) + ActorEventPacket::create($this->entity->getId(), ActorEvent::ARM_SWING, 0) ]; } } diff --git a/src/entity/animation/ArrowShakeAnimation.php b/src/entity/animation/ArrowShakeAnimation.php index 925b93d3a..256c6142b 100644 --- a/src/entity/animation/ArrowShakeAnimation.php +++ b/src/entity/animation/ArrowShakeAnimation.php @@ -25,6 +25,7 @@ namespace pocketmine\entity\animation; use pocketmine\entity\projectile\Arrow; use pocketmine\network\mcpe\protocol\ActorEventPacket; +use pocketmine\network\mcpe\protocol\types\ActorEvent; class ArrowShakeAnimation implements Animation{ @@ -40,7 +41,7 @@ class ArrowShakeAnimation implements Animation{ public function encode() : array{ return [ - ActorEventPacket::create($this->arrow->getId(), ActorEventPacket::ARROW_SHAKE, $this->durationInTicks) + ActorEventPacket::create($this->arrow->getId(), ActorEvent::ARROW_SHAKE, $this->durationInTicks) ]; } } diff --git a/src/entity/animation/ConsumingItemAnimation.php b/src/entity/animation/ConsumingItemAnimation.php index 4f3e34ba4..b32f118bb 100644 --- a/src/entity/animation/ConsumingItemAnimation.php +++ b/src/entity/animation/ConsumingItemAnimation.php @@ -27,6 +27,7 @@ use pocketmine\entity\Human; use pocketmine\item\Item; use pocketmine\network\mcpe\convert\ItemTranslator; use pocketmine\network\mcpe\protocol\ActorEventPacket; +use pocketmine\network\mcpe\protocol\types\ActorEvent; final class ConsumingItemAnimation implements Animation{ @@ -45,7 +46,7 @@ final class ConsumingItemAnimation implements Animation{ [$netId, $netData] = ItemTranslator::getInstance()->toNetworkId($this->item->getId(), $this->item->getMeta()); return [ //TODO: need to check the data values - ActorEventPacket::create($this->human->getId(), ActorEventPacket::EATING_ITEM, ($netId << 16) | $netData) + ActorEventPacket::create($this->human->getId(), ActorEvent::EATING_ITEM, ($netId << 16) | $netData) ]; } } diff --git a/src/entity/animation/DeathAnimation.php b/src/entity/animation/DeathAnimation.php index 35dab4597..a3a924413 100644 --- a/src/entity/animation/DeathAnimation.php +++ b/src/entity/animation/DeathAnimation.php @@ -25,6 +25,7 @@ namespace pocketmine\entity\animation; use pocketmine\entity\Living; use pocketmine\network\mcpe\protocol\ActorEventPacket; +use pocketmine\network\mcpe\protocol\types\ActorEvent; final class DeathAnimation implements Animation{ @@ -37,7 +38,7 @@ final class DeathAnimation implements Animation{ public function encode() : array{ return [ - ActorEventPacket::create($this->entity->getId(), ActorEventPacket::DEATH_ANIMATION, 0) + ActorEventPacket::create($this->entity->getId(), ActorEvent::DEATH_ANIMATION, 0) ]; } } diff --git a/src/entity/animation/HurtAnimation.php b/src/entity/animation/HurtAnimation.php index 3ba5ebb8c..355b49d47 100644 --- a/src/entity/animation/HurtAnimation.php +++ b/src/entity/animation/HurtAnimation.php @@ -25,6 +25,7 @@ namespace pocketmine\entity\animation; use pocketmine\entity\Living; use pocketmine\network\mcpe\protocol\ActorEventPacket; +use pocketmine\network\mcpe\protocol\types\ActorEvent; final class HurtAnimation implements Animation{ @@ -37,7 +38,7 @@ final class HurtAnimation implements Animation{ public function encode() : array{ return [ - ActorEventPacket::create($this->entity->getId(), ActorEventPacket::HURT_ANIMATION, 0) + ActorEventPacket::create($this->entity->getId(), ActorEvent::HURT_ANIMATION, 0) ]; } } diff --git a/src/entity/animation/RespawnAnimation.php b/src/entity/animation/RespawnAnimation.php index defb26cf7..e8466e26e 100644 --- a/src/entity/animation/RespawnAnimation.php +++ b/src/entity/animation/RespawnAnimation.php @@ -25,6 +25,7 @@ namespace pocketmine\entity\animation; use pocketmine\entity\Living; use pocketmine\network\mcpe\protocol\ActorEventPacket; +use pocketmine\network\mcpe\protocol\types\ActorEvent; final class RespawnAnimation implements Animation{ @@ -37,7 +38,7 @@ final class RespawnAnimation implements Animation{ public function encode() : array{ return [ - ActorEventPacket::create($this->entity->getId(), ActorEventPacket::RESPAWN, 0) + ActorEventPacket::create($this->entity->getId(), ActorEvent::RESPAWN, 0) ]; } } diff --git a/src/entity/animation/SquidInkCloudAnimation.php b/src/entity/animation/SquidInkCloudAnimation.php index fa3a9fd6b..6ae728a79 100644 --- a/src/entity/animation/SquidInkCloudAnimation.php +++ b/src/entity/animation/SquidInkCloudAnimation.php @@ -25,6 +25,7 @@ namespace pocketmine\entity\animation; use pocketmine\entity\Squid; use pocketmine\network\mcpe\protocol\ActorEventPacket; +use pocketmine\network\mcpe\protocol\types\ActorEvent; final class SquidInkCloudAnimation implements Animation{ @@ -37,7 +38,7 @@ final class SquidInkCloudAnimation implements Animation{ public function encode() : array{ return [ - ActorEventPacket::create($this->squid->getId(), ActorEventPacket::SQUID_INK_CLOUD, 0) + ActorEventPacket::create($this->squid->getId(), ActorEvent::SQUID_INK_CLOUD, 0) ]; } } diff --git a/src/entity/animation/TotemUseAnimation.php b/src/entity/animation/TotemUseAnimation.php index 11eb68e46..ec0d3b12c 100644 --- a/src/entity/animation/TotemUseAnimation.php +++ b/src/entity/animation/TotemUseAnimation.php @@ -25,6 +25,7 @@ namespace pocketmine\entity\animation; use pocketmine\entity\Human; use pocketmine\network\mcpe\protocol\ActorEventPacket; +use pocketmine\network\mcpe\protocol\types\ActorEvent; final class TotemUseAnimation implements Animation{ @@ -38,7 +39,7 @@ final class TotemUseAnimation implements Animation{ public function encode() : array{ return [ - ActorEventPacket::create($this->human->getId(), ActorEventPacket::CONSUME_TOTEM, 0) + ActorEventPacket::create($this->human->getId(), ActorEvent::CONSUME_TOTEM, 0) ]; } } diff --git a/src/network/mcpe/handler/DeathPacketHandler.php b/src/network/mcpe/handler/DeathPacketHandler.php index db4cbaa7d..c3421f1a5 100644 --- a/src/network/mcpe/handler/DeathPacketHandler.php +++ b/src/network/mcpe/handler/DeathPacketHandler.php @@ -26,6 +26,7 @@ namespace pocketmine\network\mcpe\handler; use pocketmine\network\mcpe\NetworkSession; use pocketmine\network\mcpe\protocol\PlayerActionPacket; use pocketmine\network\mcpe\protocol\RespawnPacket; +use pocketmine\network\mcpe\protocol\types\PlayerAction; use pocketmine\player\Player; class DeathPacketHandler extends PacketHandler{ @@ -49,7 +50,7 @@ class DeathPacketHandler extends PacketHandler{ } public function handlePlayerAction(PlayerActionPacket $packet) : bool{ - if($packet->action === PlayerActionPacket::ACTION_RESPAWN){ + if($packet->action === PlayerAction::RESPAWN){ $this->player->respawn(); return true; } diff --git a/src/network/mcpe/handler/InGamePacketHandler.php b/src/network/mcpe/handler/InGamePacketHandler.php index a8e784ced..ef49cb355 100644 --- a/src/network/mcpe/handler/InGamePacketHandler.php +++ b/src/network/mcpe/handler/InGamePacketHandler.php @@ -83,6 +83,7 @@ use pocketmine\network\mcpe\protocol\ShowCreditsPacket; use pocketmine\network\mcpe\protocol\SpawnExperienceOrbPacket; use pocketmine\network\mcpe\protocol\SubClientLoginPacket; use pocketmine\network\mcpe\protocol\TextPacket; +use pocketmine\network\mcpe\protocol\types\ActorEvent; use pocketmine\network\mcpe\protocol\types\inventory\ContainerIds; use pocketmine\network\mcpe\protocol\types\inventory\MismatchTransactionData; use pocketmine\network\mcpe\protocol\types\inventory\NetworkInventoryAction; @@ -92,6 +93,7 @@ use pocketmine\network\mcpe\protocol\types\inventory\UIInventorySlotOffset; use pocketmine\network\mcpe\protocol\types\inventory\UseItemOnEntityTransactionData; use pocketmine\network\mcpe\protocol\types\inventory\UseItemTransactionData; use pocketmine\network\mcpe\protocol\types\inventory\WindowTypes; +use pocketmine\network\mcpe\protocol\types\PlayerAction; use pocketmine\network\PacketHandlingException; use pocketmine\player\Player; use pocketmine\utils\AssumptionFailedError; @@ -201,12 +203,12 @@ class InGamePacketHandler extends PacketHandler{ public function handleActorEvent(ActorEventPacket $packet) : bool{ if($packet->actorRuntimeId !== $this->player->getId()){ //TODO HACK: EATING_ITEM is sent back to the server when the server sends it for other players (1.14 bug, maybe earlier) - return $packet->actorRuntimeId === ActorEventPacket::EATING_ITEM; + return $packet->actorRuntimeId === ActorEvent::EATING_ITEM; } $this->player->doCloseInventory(); switch($packet->eventId){ - case ActorEventPacket::EATING_ITEM: //TODO: ignore this and handle it server-side + case ActorEvent::EATING_ITEM: //TODO: ignore this and handle it server-side $item = $this->player->getInventory()->getItemInHand(); if($item->isNull()){ return false; @@ -534,60 +536,60 @@ class InGamePacketHandler extends PacketHandler{ $pos = new Vector3($packet->blockPosition->getX(), $packet->blockPosition->getY(), $packet->blockPosition->getZ()); switch($packet->action){ - case PlayerActionPacket::ACTION_START_BREAK: + case PlayerAction::START_BREAK: if(!$this->player->attackBlock($pos, $packet->face)){ $this->onFailedBlockAction($pos, $packet->face); } break; - case PlayerActionPacket::ACTION_ABORT_BREAK: - case PlayerActionPacket::ACTION_STOP_BREAK: + case PlayerAction::ABORT_BREAK: + case PlayerAction::STOP_BREAK: $this->player->stopBreakBlock($pos); break; - case PlayerActionPacket::ACTION_START_SLEEPING: + case PlayerAction::START_SLEEPING: //unused break; - case PlayerActionPacket::ACTION_STOP_SLEEPING: + case PlayerAction::STOP_SLEEPING: $this->player->stopSleep(); break; - case PlayerActionPacket::ACTION_JUMP: + case PlayerAction::JUMP: $this->player->jump(); return true; - case PlayerActionPacket::ACTION_START_SPRINT: + case PlayerAction::START_SPRINT: if(!$this->player->toggleSprint(true)){ $this->player->sendData([$this->player]); } return true; - case PlayerActionPacket::ACTION_STOP_SPRINT: + case PlayerAction::STOP_SPRINT: if(!$this->player->toggleSprint(false)){ $this->player->sendData([$this->player]); } return true; - case PlayerActionPacket::ACTION_START_SNEAK: + case PlayerAction::START_SNEAK: if(!$this->player->toggleSneak(true)){ $this->player->sendData([$this->player]); } return true; - case PlayerActionPacket::ACTION_STOP_SNEAK: + case PlayerAction::STOP_SNEAK: if(!$this->player->toggleSneak(false)){ $this->player->sendData([$this->player]); } return true; - case PlayerActionPacket::ACTION_START_GLIDE: - case PlayerActionPacket::ACTION_STOP_GLIDE: + case PlayerAction::START_GLIDE: + case PlayerAction::STOP_GLIDE: break; //TODO - case PlayerActionPacket::ACTION_CRACK_BREAK: + case PlayerAction::CRACK_BREAK: $this->player->continueBreakBlock($pos, $packet->face); break; - case PlayerActionPacket::ACTION_START_SWIMMING: + case PlayerAction::START_SWIMMING: break; //TODO - case PlayerActionPacket::ACTION_STOP_SWIMMING: + case PlayerAction::STOP_SWIMMING: //TODO: handle this when it doesn't spam every damn tick (yet another spam bug!!) break; - case PlayerActionPacket::ACTION_INTERACT_BLOCK: //TODO: ignored (for now) + case PlayerAction::INTERACT_BLOCK: //TODO: ignored (for now) break; - case PlayerActionPacket::ACTION_CREATIVE_PLAYER_DESTROY_BLOCK: + case PlayerAction::CREATIVE_PLAYER_DESTROY_BLOCK: //TODO: do we need to handle this? break; default: diff --git a/src/player/SurvivalBlockBreakHandler.php b/src/player/SurvivalBlockBreakHandler.php index 3992e8fa5..ee9ff4df9 100644 --- a/src/player/SurvivalBlockBreakHandler.php +++ b/src/player/SurvivalBlockBreakHandler.php @@ -28,6 +28,7 @@ use pocketmine\entity\animation\ArmSwingAnimation; use pocketmine\math\Facing; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelEvent; use pocketmine\world\particle\BlockPunchParticle; use pocketmine\world\sound\BlockPunchSound; use function abs; @@ -70,7 +71,7 @@ final class SurvivalBlockBreakHandler{ if($this->breakSpeed > 0){ $this->player->getWorld()->broadcastPacketToViewers( $this->blockPos, - LevelEventPacket::create(LevelEventPacket::EVENT_BLOCK_START_BREAK, (int) (65535 * $this->breakSpeed), $this->blockPos) + LevelEventPacket::create(LevelEvent::BLOCK_START_BREAK, (int) (65535 * $this->breakSpeed), $this->blockPos) ); } } @@ -147,7 +148,7 @@ final class SurvivalBlockBreakHandler{ if($this->player->getWorld()->isInLoadedTerrain($this->blockPos)){ $this->player->getWorld()->broadcastPacketToViewers( $this->blockPos, - LevelEventPacket::create(LevelEventPacket::EVENT_BLOCK_STOP_BREAK, 0, $this->blockPos) + LevelEventPacket::create(LevelEvent::BLOCK_STOP_BREAK, 0, $this->blockPos) ); } } diff --git a/src/world/particle/BlockBreakParticle.php b/src/world/particle/BlockBreakParticle.php index bf3c23511..40e8d8bea 100644 --- a/src/world/particle/BlockBreakParticle.php +++ b/src/world/particle/BlockBreakParticle.php @@ -27,6 +27,7 @@ use pocketmine\block\Block; use pocketmine\math\Vector3; use pocketmine\network\mcpe\convert\RuntimeBlockMapping; use pocketmine\network\mcpe\protocol\LevelEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelEvent; class BlockBreakParticle implements Particle{ @@ -38,6 +39,6 @@ class BlockBreakParticle implements Particle{ } public function encode(Vector3 $pos) : array{ - return [LevelEventPacket::create(LevelEventPacket::EVENT_PARTICLE_DESTROY, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()), $pos)]; + return [LevelEventPacket::create(LevelEvent::PARTICLE_DESTROY, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()), $pos)]; } } diff --git a/src/world/particle/BlockPunchParticle.php b/src/world/particle/BlockPunchParticle.php index e0a7eaaf8..5ee0c3352 100644 --- a/src/world/particle/BlockPunchParticle.php +++ b/src/world/particle/BlockPunchParticle.php @@ -27,6 +27,7 @@ use pocketmine\block\Block; use pocketmine\math\Vector3; use pocketmine\network\mcpe\convert\RuntimeBlockMapping; use pocketmine\network\mcpe\protocol\LevelEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelEvent; /** * This particle appears when a player is attacking a block face in survival mode attempting to break it. @@ -44,6 +45,6 @@ class BlockPunchParticle implements Particle{ } public function encode(Vector3 $pos) : array{ - return [LevelEventPacket::create(LevelEventPacket::EVENT_PARTICLE_PUNCH_BLOCK, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()) | ($this->face << 24), $pos)]; + return [LevelEventPacket::create(LevelEvent::PARTICLE_PUNCH_BLOCK, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()) | ($this->face << 24), $pos)]; } } diff --git a/src/world/particle/DragonEggTeleportParticle.php b/src/world/particle/DragonEggTeleportParticle.php index 5c17650da..a2f2ae3ac 100644 --- a/src/world/particle/DragonEggTeleportParticle.php +++ b/src/world/particle/DragonEggTeleportParticle.php @@ -25,6 +25,7 @@ namespace pocketmine\world\particle; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelEvent; use function abs; class DragonEggTeleportParticle implements Particle{ @@ -57,6 +58,6 @@ class DragonEggTeleportParticle implements Particle{ (abs($this->yDiff) << 8) | abs($this->zDiff); - return [LevelEventPacket::create(LevelEventPacket::EVENT_PARTICLE_DRAGON_EGG_TELEPORT, $data, $pos)]; + return [LevelEventPacket::create(LevelEvent::PARTICLE_DRAGON_EGG_TELEPORT, $data, $pos)]; } } diff --git a/src/world/particle/EndermanTeleportParticle.php b/src/world/particle/EndermanTeleportParticle.php index 274d1540e..f370e4487 100644 --- a/src/world/particle/EndermanTeleportParticle.php +++ b/src/world/particle/EndermanTeleportParticle.php @@ -25,10 +25,11 @@ namespace pocketmine\world\particle; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelEvent; class EndermanTeleportParticle implements Particle{ public function encode(Vector3 $pos) : array{ - return [LevelEventPacket::create(LevelEventPacket::EVENT_PARTICLE_ENDERMAN_TELEPORT, 0, $pos)]; + return [LevelEventPacket::create(LevelEvent::PARTICLE_ENDERMAN_TELEPORT, 0, $pos)]; } } diff --git a/src/world/particle/MobSpawnParticle.php b/src/world/particle/MobSpawnParticle.php index bdc2f0144..07706888e 100644 --- a/src/world/particle/MobSpawnParticle.php +++ b/src/world/particle/MobSpawnParticle.php @@ -25,6 +25,7 @@ namespace pocketmine\world\particle; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelEvent; class MobSpawnParticle implements Particle{ /** @var int */ @@ -39,6 +40,6 @@ class MobSpawnParticle implements Particle{ } public function encode(Vector3 $pos) : array{ - return [LevelEventPacket::create(LevelEventPacket::EVENT_PARTICLE_SPAWN, ($this->width & 0xff) | (($this->height & 0xff) << 8), $pos)]; + return [LevelEventPacket::create(LevelEvent::PARTICLE_SPAWN, ($this->width & 0xff) | (($this->height & 0xff) << 8), $pos)]; } } diff --git a/src/world/particle/PotionSplashParticle.php b/src/world/particle/PotionSplashParticle.php index 83ad8c699..1175e9518 100644 --- a/src/world/particle/PotionSplashParticle.php +++ b/src/world/particle/PotionSplashParticle.php @@ -26,6 +26,7 @@ namespace pocketmine\world\particle; use pocketmine\color\Color; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelEvent; class PotionSplashParticle implements Particle{ @@ -50,6 +51,6 @@ class PotionSplashParticle implements Particle{ } public function encode(Vector3 $pos) : array{ - return [LevelEventPacket::create(LevelEventPacket::EVENT_PARTICLE_SPLASH, $this->color->toARGB(), $pos)]; + return [LevelEventPacket::create(LevelEvent::PARTICLE_SPLASH, $this->color->toARGB(), $pos)]; } } diff --git a/src/world/sound/AnvilBreakSound.php b/src/world/sound/AnvilBreakSound.php index cde91af4c..e57c0e02b 100644 --- a/src/world/sound/AnvilBreakSound.php +++ b/src/world/sound/AnvilBreakSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelEvent; class AnvilBreakSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ANVIL_BREAK, 0, $pos)]; + return [LevelEventPacket::create(LevelEvent::SOUND_ANVIL_BREAK, 0, $pos)]; } } diff --git a/src/world/sound/AnvilFallSound.php b/src/world/sound/AnvilFallSound.php index 3ef6cc61e..fd6efc7fe 100644 --- a/src/world/sound/AnvilFallSound.php +++ b/src/world/sound/AnvilFallSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelEvent; class AnvilFallSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ANVIL_FALL, 0, $pos)]; + return [LevelEventPacket::create(LevelEvent::SOUND_ANVIL_FALL, 0, $pos)]; } } diff --git a/src/world/sound/AnvilUseSound.php b/src/world/sound/AnvilUseSound.php index 99beb8b0e..b384c8624 100644 --- a/src/world/sound/AnvilUseSound.php +++ b/src/world/sound/AnvilUseSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelEvent; class AnvilUseSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ANVIL_USE, 0, $pos)]; + return [LevelEventPacket::create(LevelEvent::SOUND_ANVIL_USE, 0, $pos)]; } } diff --git a/src/world/sound/ArrowHitSound.php b/src/world/sound/ArrowHitSound.php index 4b1d9da58..abfdfc4a4 100644 --- a/src/world/sound/ArrowHitSound.php +++ b/src/world/sound/ArrowHitSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; class ArrowHitSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BOW_HIT, $pos, false)]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::BOW_HIT, $pos, false)]; } } diff --git a/src/world/sound/BarrelCloseSound.php b/src/world/sound/BarrelCloseSound.php index fa673a938..be2bdaf79 100644 --- a/src/world/sound/BarrelCloseSound.php +++ b/src/world/sound/BarrelCloseSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; class BarrelCloseSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BLOCK_BARREL_CLOSE, $pos, false)]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::BLOCK_BARREL_CLOSE, $pos, false)]; } } diff --git a/src/world/sound/BarrelOpenSound.php b/src/world/sound/BarrelOpenSound.php index ed8a1a4df..ee695060c 100644 --- a/src/world/sound/BarrelOpenSound.php +++ b/src/world/sound/BarrelOpenSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; class BarrelOpenSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BLOCK_BARREL_OPEN, $pos, false)]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::BLOCK_BARREL_OPEN, $pos, false)]; } } diff --git a/src/world/sound/BellRingSound.php b/src/world/sound/BellRingSound.php index c14b63d68..c2a45a561 100644 --- a/src/world/sound/BellRingSound.php +++ b/src/world/sound/BellRingSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; final class BellRingSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BLOCK_BELL_HIT, $pos, false)]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::BLOCK_BELL_HIT, $pos, false)]; } } diff --git a/src/world/sound/BlazeShootSound.php b/src/world/sound/BlazeShootSound.php index 00f772bbe..a86c09344 100644 --- a/src/world/sound/BlazeShootSound.php +++ b/src/world/sound/BlazeShootSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelEvent; class BlazeShootSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_BLAZE_SHOOT, 0, $pos)]; + return [LevelEventPacket::create(LevelEvent::SOUND_BLAZE_SHOOT, 0, $pos)]; } } diff --git a/src/world/sound/BlockBreakSound.php b/src/world/sound/BlockBreakSound.php index 99cac4c7b..39323259d 100644 --- a/src/world/sound/BlockBreakSound.php +++ b/src/world/sound/BlockBreakSound.php @@ -27,6 +27,7 @@ use pocketmine\block\Block; use pocketmine\math\Vector3; use pocketmine\network\mcpe\convert\RuntimeBlockMapping; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; class BlockBreakSound implements Sound{ @@ -38,6 +39,6 @@ class BlockBreakSound implements Sound{ } public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BREAK, $pos, false, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()))]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::BREAK, $pos, false, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()))]; } } diff --git a/src/world/sound/BlockPlaceSound.php b/src/world/sound/BlockPlaceSound.php index 7a95b2222..831c879a1 100644 --- a/src/world/sound/BlockPlaceSound.php +++ b/src/world/sound/BlockPlaceSound.php @@ -27,6 +27,7 @@ use pocketmine\block\Block; use pocketmine\math\Vector3; use pocketmine\network\mcpe\convert\RuntimeBlockMapping; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; class BlockPlaceSound implements Sound{ @@ -38,6 +39,6 @@ class BlockPlaceSound implements Sound{ } public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_PLACE, $pos, false, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()))]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::PLACE, $pos, false, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()))]; } } diff --git a/src/world/sound/BlockPunchSound.php b/src/world/sound/BlockPunchSound.php index 51093522e..03d3ded64 100644 --- a/src/world/sound/BlockPunchSound.php +++ b/src/world/sound/BlockPunchSound.php @@ -27,6 +27,7 @@ use pocketmine\block\Block; use pocketmine\math\Vector3; use pocketmine\network\mcpe\convert\RuntimeBlockMapping; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; /** * Played when a player attacks a block in survival, attempting to break it. @@ -42,7 +43,7 @@ class BlockPunchSound implements Sound{ public function encode(Vector3 $pos) : array{ return [LevelSoundEventPacket::nonActorSound( - LevelSoundEventPacket::SOUND_HIT, + LevelSoundEvent::HIT, $pos, false, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()) diff --git a/src/world/sound/BowShootSound.php b/src/world/sound/BowShootSound.php index abdb8169c..2b595972f 100644 --- a/src/world/sound/BowShootSound.php +++ b/src/world/sound/BowShootSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; class BowShootSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BOW, $pos, false)]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::BOW, $pos, false)]; } } diff --git a/src/world/sound/BucketEmptyLavaSound.php b/src/world/sound/BucketEmptyLavaSound.php index 99241daf1..e3e991597 100644 --- a/src/world/sound/BucketEmptyLavaSound.php +++ b/src/world/sound/BucketEmptyLavaSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; class BucketEmptyLavaSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BUCKET_EMPTY_LAVA, $pos, false)]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::BUCKET_EMPTY_LAVA, $pos, false)]; } } diff --git a/src/world/sound/BucketEmptyWaterSound.php b/src/world/sound/BucketEmptyWaterSound.php index 087675aa9..b80b90311 100644 --- a/src/world/sound/BucketEmptyWaterSound.php +++ b/src/world/sound/BucketEmptyWaterSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; class BucketEmptyWaterSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BUCKET_EMPTY_WATER, $pos, false)]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::BUCKET_EMPTY_WATER, $pos, false)]; } } diff --git a/src/world/sound/BucketFillLavaSound.php b/src/world/sound/BucketFillLavaSound.php index d4df3ef67..0315c8a8e 100644 --- a/src/world/sound/BucketFillLavaSound.php +++ b/src/world/sound/BucketFillLavaSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; class BucketFillLavaSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BUCKET_FILL_LAVA, $pos, false)]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::BUCKET_FILL_LAVA, $pos, false)]; } } diff --git a/src/world/sound/BucketFillWaterSound.php b/src/world/sound/BucketFillWaterSound.php index 638922413..431435788 100644 --- a/src/world/sound/BucketFillWaterSound.php +++ b/src/world/sound/BucketFillWaterSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; class BucketFillWaterSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BUCKET_FILL_WATER, $pos, false)]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::BUCKET_FILL_WATER, $pos, false)]; } } diff --git a/src/world/sound/ChestCloseSound.php b/src/world/sound/ChestCloseSound.php index 2ccaaa035..e1c15e523 100644 --- a/src/world/sound/ChestCloseSound.php +++ b/src/world/sound/ChestCloseSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; class ChestCloseSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_CHEST_CLOSED, $pos, false)]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::CHEST_CLOSED, $pos, false)]; } } diff --git a/src/world/sound/ChestOpenSound.php b/src/world/sound/ChestOpenSound.php index ee8c9313b..0e835d5fa 100644 --- a/src/world/sound/ChestOpenSound.php +++ b/src/world/sound/ChestOpenSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; class ChestOpenSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_CHEST_OPEN, $pos, false)]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::CHEST_OPEN, $pos, false)]; } } diff --git a/src/world/sound/ClickSound.php b/src/world/sound/ClickSound.php index db472b292..c02471f87 100644 --- a/src/world/sound/ClickSound.php +++ b/src/world/sound/ClickSound.php @@ -25,6 +25,7 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelEvent; class ClickSound implements Sound{ @@ -40,6 +41,6 @@ class ClickSound implements Sound{ } public function encode(Vector3 $pos) : array{ - return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_CLICK, (int) ($this->pitch * 1000), $pos)]; + return [LevelEventPacket::create(LevelEvent::SOUND_CLICK, (int) ($this->pitch * 1000), $pos)]; } } diff --git a/src/world/sound/DoorBumpSound.php b/src/world/sound/DoorBumpSound.php index 239401637..86ed0f339 100644 --- a/src/world/sound/DoorBumpSound.php +++ b/src/world/sound/DoorBumpSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelEvent; class DoorBumpSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_DOOR_BUMP, 0, $pos)]; + return [LevelEventPacket::create(LevelEvent::SOUND_DOOR_BUMP, 0, $pos)]; } } diff --git a/src/world/sound/DoorCrashSound.php b/src/world/sound/DoorCrashSound.php index 6f3a6cbe0..3259c4889 100644 --- a/src/world/sound/DoorCrashSound.php +++ b/src/world/sound/DoorCrashSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelEvent; class DoorCrashSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_DOOR_CRASH, 0, $pos)]; + return [LevelEventPacket::create(LevelEvent::SOUND_DOOR_CRASH, 0, $pos)]; } } diff --git a/src/world/sound/DoorSound.php b/src/world/sound/DoorSound.php index b3e4addf9..368136c91 100644 --- a/src/world/sound/DoorSound.php +++ b/src/world/sound/DoorSound.php @@ -25,6 +25,7 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelEvent; class DoorSound implements Sound{ @@ -40,6 +41,6 @@ class DoorSound implements Sound{ } public function encode(Vector3 $pos) : array{ - return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_DOOR, (int) ($this->pitch * 1000), $pos)]; + return [LevelEventPacket::create(LevelEvent::SOUND_DOOR, (int) ($this->pitch * 1000), $pos)]; } } diff --git a/src/world/sound/EnderChestCloseSound.php b/src/world/sound/EnderChestCloseSound.php index 4292dec35..3b7269821 100644 --- a/src/world/sound/EnderChestCloseSound.php +++ b/src/world/sound/EnderChestCloseSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; class EnderChestCloseSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_ENDERCHEST_CLOSED, $pos, false)]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::ENDERCHEST_CLOSED, $pos, false)]; } } diff --git a/src/world/sound/EnderChestOpenSound.php b/src/world/sound/EnderChestOpenSound.php index ab1894450..6d88ac1f5 100644 --- a/src/world/sound/EnderChestOpenSound.php +++ b/src/world/sound/EnderChestOpenSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; class EnderChestOpenSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_ENDERCHEST_OPEN, $pos, false)]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::ENDERCHEST_OPEN, $pos, false)]; } } diff --git a/src/world/sound/EndermanTeleportSound.php b/src/world/sound/EndermanTeleportSound.php index e2f3f03e8..a5857aab2 100644 --- a/src/world/sound/EndermanTeleportSound.php +++ b/src/world/sound/EndermanTeleportSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelEvent; class EndermanTeleportSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ENDERMAN_TELEPORT, 0, $pos)]; + return [LevelEventPacket::create(LevelEvent::SOUND_ENDERMAN_TELEPORT, 0, $pos)]; } } diff --git a/src/world/sound/EntityAttackNoDamageSound.php b/src/world/sound/EntityAttackNoDamageSound.php index 2ab77a241..d329147f6 100644 --- a/src/world/sound/EntityAttackNoDamageSound.php +++ b/src/world/sound/EntityAttackNoDamageSound.php @@ -25,6 +25,7 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; /** * Played when a player attacks a mob, but fails to deal damage (e.g. cancelled or attack cooldown). @@ -33,7 +34,7 @@ class EntityAttackNoDamageSound implements Sound{ public function encode(Vector3 $pos) : array{ return [LevelSoundEventPacket::create( - LevelSoundEventPacket::SOUND_ATTACK_NODAMAGE, + LevelSoundEvent::ATTACK_NODAMAGE, $pos, -1, "minecraft:player", diff --git a/src/world/sound/EntityAttackSound.php b/src/world/sound/EntityAttackSound.php index ecf39a888..289f2d597 100644 --- a/src/world/sound/EntityAttackSound.php +++ b/src/world/sound/EntityAttackSound.php @@ -25,6 +25,7 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; /** * Played when a player attacks a mob, dealing damage. @@ -33,7 +34,7 @@ class EntityAttackSound implements Sound{ public function encode(Vector3 $pos) : array{ return [LevelSoundEventPacket::create( - LevelSoundEventPacket::SOUND_ATTACK_STRONG, //TODO: seems like ATTACK is dysfunctional + LevelSoundEvent::ATTACK_STRONG, //TODO: seems like ATTACK is dysfunctional $pos, -1, "minecraft:player", diff --git a/src/world/sound/EntityLandSound.php b/src/world/sound/EntityLandSound.php index 38ba283fc..a973e3ba5 100644 --- a/src/world/sound/EntityLandSound.php +++ b/src/world/sound/EntityLandSound.php @@ -28,6 +28,7 @@ use pocketmine\entity\Entity; use pocketmine\math\Vector3; use pocketmine\network\mcpe\convert\RuntimeBlockMapping; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; /** * Played when an entity hits the ground after falling a distance that doesn't cause damage, e.g. due to jumping. @@ -46,7 +47,7 @@ class EntityLandSound implements Sound{ public function encode(Vector3 $pos) : array{ return [LevelSoundEventPacket::create( - LevelSoundEventPacket::SOUND_LAND, + LevelSoundEvent::LAND, $pos, RuntimeBlockMapping::getInstance()->toRuntimeId($this->blockLandedOn->getFullId()), $this->entity::getNetworkTypeId(), diff --git a/src/world/sound/EntityLongFallSound.php b/src/world/sound/EntityLongFallSound.php index 1d0a07f40..c6cd2a33a 100644 --- a/src/world/sound/EntityLongFallSound.php +++ b/src/world/sound/EntityLongFallSound.php @@ -26,6 +26,7 @@ namespace pocketmine\world\sound; use pocketmine\entity\Entity; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; /** * Played when an entity hits ground after falling a long distance (damage). @@ -42,7 +43,7 @@ class EntityLongFallSound implements Sound{ public function encode(Vector3 $pos) : array{ return [LevelSoundEventPacket::create( - LevelSoundEventPacket::SOUND_FALL_BIG, + LevelSoundEvent::FALL_BIG, $pos, -1, $this->entity::getNetworkTypeId(), diff --git a/src/world/sound/EntityShortFallSound.php b/src/world/sound/EntityShortFallSound.php index 2f64cc269..722a3c1a3 100644 --- a/src/world/sound/EntityShortFallSound.php +++ b/src/world/sound/EntityShortFallSound.php @@ -26,6 +26,7 @@ namespace pocketmine\world\sound; use pocketmine\entity\Entity; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; /** * Played when an entity hits the ground after falling a short distance. @@ -41,7 +42,7 @@ class EntityShortFallSound implements Sound{ public function encode(Vector3 $pos) : array{ return [LevelSoundEventPacket::create( - LevelSoundEventPacket::SOUND_FALL_SMALL, + LevelSoundEvent::FALL_SMALL, $pos, -1, $this->entity::getNetworkTypeId(), diff --git a/src/world/sound/ExplodeSound.php b/src/world/sound/ExplodeSound.php index 1f2db9c89..b20f5a359 100644 --- a/src/world/sound/ExplodeSound.php +++ b/src/world/sound/ExplodeSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; class ExplodeSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_EXPLODE, $pos, false)]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::EXPLODE, $pos, false)]; } } diff --git a/src/world/sound/FireExtinguishSound.php b/src/world/sound/FireExtinguishSound.php index 255e821f9..a4f02fb03 100644 --- a/src/world/sound/FireExtinguishSound.php +++ b/src/world/sound/FireExtinguishSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; final class FireExtinguishSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_EXTINGUISH_FIRE, $pos, false)]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::EXTINGUISH_FIRE, $pos, false)]; } } diff --git a/src/world/sound/FizzSound.php b/src/world/sound/FizzSound.php index 67be8db44..62b54ee16 100644 --- a/src/world/sound/FizzSound.php +++ b/src/world/sound/FizzSound.php @@ -25,6 +25,7 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelEvent; class FizzSound implements Sound{ @@ -40,6 +41,6 @@ class FizzSound implements Sound{ } public function encode(Vector3 $pos) : array{ - return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_FIZZ, (int) ($this->pitch * 1000), $pos)]; + return [LevelEventPacket::create(LevelEvent::SOUND_FIZZ, (int) ($this->pitch * 1000), $pos)]; } } diff --git a/src/world/sound/FlintSteelSound.php b/src/world/sound/FlintSteelSound.php index 4569ed510..7edd564cf 100644 --- a/src/world/sound/FlintSteelSound.php +++ b/src/world/sound/FlintSteelSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; class FlintSteelSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_IGNITE, $pos, false)]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::IGNITE, $pos, false)]; } } diff --git a/src/world/sound/GhastShootSound.php b/src/world/sound/GhastShootSound.php index e7cb550ff..3dae9758f 100644 --- a/src/world/sound/GhastShootSound.php +++ b/src/world/sound/GhastShootSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelEvent; class GhastShootSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_GHAST_SHOOT, 0, $pos)]; + return [LevelEventPacket::create(LevelEvent::SOUND_GHAST_SHOOT, 0, $pos)]; } } diff --git a/src/world/sound/GhastSound.php b/src/world/sound/GhastSound.php index 2e707d3db..d62413dac 100644 --- a/src/world/sound/GhastSound.php +++ b/src/world/sound/GhastSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelEvent; class GhastSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_GHAST, 0, $pos)]; + return [LevelEventPacket::create(LevelEvent::SOUND_GHAST, 0, $pos)]; } } diff --git a/src/world/sound/IgniteSound.php b/src/world/sound/IgniteSound.php index 1f1e88703..05f443123 100644 --- a/src/world/sound/IgniteSound.php +++ b/src/world/sound/IgniteSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelEvent; class IgniteSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_IGNITE, 0, $pos)]; + return [LevelEventPacket::create(LevelEvent::SOUND_IGNITE, 0, $pos)]; } } diff --git a/src/world/sound/ItemBreakSound.php b/src/world/sound/ItemBreakSound.php index c2329ce12..98ee24c8b 100644 --- a/src/world/sound/ItemBreakSound.php +++ b/src/world/sound/ItemBreakSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; class ItemBreakSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BREAK, $pos, false)]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::BREAK, $pos, false)]; } } diff --git a/src/world/sound/LaunchSound.php b/src/world/sound/LaunchSound.php index af8b02041..11ef5ad1d 100644 --- a/src/world/sound/LaunchSound.php +++ b/src/world/sound/LaunchSound.php @@ -25,6 +25,7 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelEvent; class LaunchSound implements Sound{ @@ -40,6 +41,6 @@ class LaunchSound implements Sound{ } public function encode(Vector3 $pos) : array{ - return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_SHOOT, (int) ($this->pitch * 1000), $pos)]; + return [LevelEventPacket::create(LevelEvent::SOUND_SHOOT, (int) ($this->pitch * 1000), $pos)]; } } diff --git a/src/world/sound/NoteSound.php b/src/world/sound/NoteSound.php index 7d2bdef42..00101b8d7 100644 --- a/src/world/sound/NoteSound.php +++ b/src/world/sound/NoteSound.php @@ -25,6 +25,7 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; class NoteSound implements Sound{ @@ -42,6 +43,6 @@ class NoteSound implements Sound{ } public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_NOTE, $pos, false, ($this->instrument->getMagicNumber() << 8) | $this->note)]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::NOTE, $pos, false, ($this->instrument->getMagicNumber() << 8) | $this->note)]; } } diff --git a/src/world/sound/PaintingPlaceSound.php b/src/world/sound/PaintingPlaceSound.php index 6d9a7ebe3..2363299f3 100644 --- a/src/world/sound/PaintingPlaceSound.php +++ b/src/world/sound/PaintingPlaceSound.php @@ -25,11 +25,12 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelEvent; class PaintingPlaceSound implements Sound{ public function encode(Vector3 $pos) : array{ //item frame and painting have the same sound - return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ITEMFRAME_PLACE, 0, $pos)]; + return [LevelEventPacket::create(LevelEvent::SOUND_ITEMFRAME_PLACE, 0, $pos)]; } } diff --git a/src/world/sound/PopSound.php b/src/world/sound/PopSound.php index 421018333..a706e6d03 100644 --- a/src/world/sound/PopSound.php +++ b/src/world/sound/PopSound.php @@ -25,6 +25,7 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelEvent; class PopSound implements Sound{ @@ -40,6 +41,6 @@ class PopSound implements Sound{ } public function encode(Vector3 $pos) : array{ - return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_POP, (int) ($this->pitch * 1000), $pos)]; + return [LevelEventPacket::create(LevelEvent::SOUND_POP, (int) ($this->pitch * 1000), $pos)]; } } diff --git a/src/world/sound/PotionSplashSound.php b/src/world/sound/PotionSplashSound.php index 2547f2aee..083e8e021 100644 --- a/src/world/sound/PotionSplashSound.php +++ b/src/world/sound/PotionSplashSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; class PotionSplashSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_GLASS, $pos, false)]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::GLASS, $pos, false)]; } } diff --git a/src/world/sound/RecordStopSound.php b/src/world/sound/RecordStopSound.php index 9e331a9ff..0f2b7dcc9 100644 --- a/src/world/sound/RecordStopSound.php +++ b/src/world/sound/RecordStopSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; class RecordStopSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_STOP_RECORD, $pos, false)]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::STOP_RECORD, $pos, false)]; } } diff --git a/src/world/sound/RedstonePowerOffSound.php b/src/world/sound/RedstonePowerOffSound.php index b07c723b4..d32ef391e 100644 --- a/src/world/sound/RedstonePowerOffSound.php +++ b/src/world/sound/RedstonePowerOffSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; class RedstonePowerOffSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_POWER_OFF, $pos, false)]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::POWER_OFF, $pos, false)]; } } diff --git a/src/world/sound/RedstonePowerOnSound.php b/src/world/sound/RedstonePowerOnSound.php index d71f6b998..3c98832ee 100644 --- a/src/world/sound/RedstonePowerOnSound.php +++ b/src/world/sound/RedstonePowerOnSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; class RedstonePowerOnSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_POWER_ON, $pos, false)]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::POWER_ON, $pos, false)]; } } diff --git a/src/world/sound/ShulkerBoxCloseSound.php b/src/world/sound/ShulkerBoxCloseSound.php index ea7a630c3..6c8ace783 100644 --- a/src/world/sound/ShulkerBoxCloseSound.php +++ b/src/world/sound/ShulkerBoxCloseSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; class ShulkerBoxCloseSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_SHULKERBOX_CLOSED, $pos, false)]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::SHULKERBOX_CLOSED, $pos, false)]; } } diff --git a/src/world/sound/ShulkerBoxOpenSound.php b/src/world/sound/ShulkerBoxOpenSound.php index 491b5dace..9aafb95ce 100644 --- a/src/world/sound/ShulkerBoxOpenSound.php +++ b/src/world/sound/ShulkerBoxOpenSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; class ShulkerBoxOpenSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_SHULKERBOX_OPEN, $pos, false)]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::SHULKERBOX_OPEN, $pos, false)]; } } diff --git a/src/world/sound/ThrowSound.php b/src/world/sound/ThrowSound.php index b24474e5f..5ac34cbe6 100644 --- a/src/world/sound/ThrowSound.php +++ b/src/world/sound/ThrowSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; class ThrowSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_THROW, $pos, -1, "minecraft:player", false, false)]; + return [LevelSoundEventPacket::create(LevelSoundEvent::THROW, $pos, -1, "minecraft:player", false, false)]; } } diff --git a/src/world/sound/TotemUseSound.php b/src/world/sound/TotemUseSound.php index 561d9c41a..7d82c3110 100644 --- a/src/world/sound/TotemUseSound.php +++ b/src/world/sound/TotemUseSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelEvent; class TotemUseSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_TOTEM, 0, $pos)]; + return [LevelEventPacket::create(LevelEvent::SOUND_TOTEM, 0, $pos)]; } } diff --git a/src/world/sound/XpCollectSound.php b/src/world/sound/XpCollectSound.php index 655835069..bbf60041b 100644 --- a/src/world/sound/XpCollectSound.php +++ b/src/world/sound/XpCollectSound.php @@ -25,10 +25,11 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelEvent; class XpCollectSound implements Sound{ public function encode(Vector3 $pos) : array{ - return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ORB, 0, $pos)]; + return [LevelEventPacket::create(LevelEvent::SOUND_ORB, 0, $pos)]; } } diff --git a/src/world/sound/XpLevelUpSound.php b/src/world/sound/XpLevelUpSound.php index 8334b7bea..b9e2737b2 100644 --- a/src/world/sound/XpLevelUpSound.php +++ b/src/world/sound/XpLevelUpSound.php @@ -25,6 +25,7 @@ namespace pocketmine\world\sound; use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; +use pocketmine\network\mcpe\protocol\types\LevelSoundEvent; use function intdiv; use function min; @@ -44,6 +45,6 @@ class XpLevelUpSound implements Sound{ public function encode(Vector3 $pos) : array{ //No idea why such odd numbers, but this works... //TODO: check arbitrary volume - return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_LEVELUP, $pos, false, 0x10000000 * intdiv(min(30, $this->xpLevel), 5))]; + return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::LEVELUP, $pos, false, 0x10000000 * intdiv(min(30, $this->xpLevel), 5))]; } }