diff options
author | peterbell10 <peterbell10@live.co.uk> | 2018-07-24 23:30:49 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@outlook.com> | 2018-07-24 23:30:49 +0200 |
commit | c94d7184ebaf7e8540f717c70c1e03ae62e5a7bd (patch) | |
tree | 3a373f8ea6f06dc9b117d2d103bfaee5705040b8 /src/Chunk.cpp | |
parent | Stop cFunctionRef constructor from disabling default copy constructor. (#4173) (diff) | |
download | cuberite-c94d7184ebaf7e8540f717c70c1e03ae62e5a7bd.tar cuberite-c94d7184ebaf7e8540f717c70c1e03ae62e5a7bd.tar.gz cuberite-c94d7184ebaf7e8540f717c70c1e03ae62e5a7bd.tar.bz2 cuberite-c94d7184ebaf7e8540f717c70c1e03ae62e5a7bd.tar.lz cuberite-c94d7184ebaf7e8540f717c70c1e03ae62e5a7bd.tar.xz cuberite-c94d7184ebaf7e8540f717c70c1e03ae62e5a7bd.tar.zst cuberite-c94d7184ebaf7e8540f717c70c1e03ae62e5a7bd.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Chunk.cpp | 402 |
1 files changed, 1 insertions, 401 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp index 03415b348..b980ab3ed 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -484,7 +484,7 @@ void cChunk::WriteBlockArea(cBlockArea & a_Area, int a_MinBlockX, int a_MinBlock auto clone = be->Clone(posX, posY, posZ); clone->SetWorld(m_World); AddBlockEntityClean(clone); - BroadcastBlockEntity({posX, posY, posZ}); + m_World->BroadcastBlockEntity({posX, posY, posZ}); } } } @@ -2636,406 +2636,6 @@ cChunk * cChunk::GetRelNeighborChunkAdjustCoords(int & a_RelX, int & a_RelZ) con -void cChunk::BroadcastAttachEntity(const cEntity & a_Entity, const cEntity & a_Vehicle) -{ - for (auto ClientHandle : m_LoadedByClient) - { - ClientHandle->SendAttachEntity(a_Entity, a_Vehicle); - } // for itr - LoadedByClient[] -} - - - - -void cChunk::BroadcastLeashEntity(const cEntity & a_Entity, const cEntity & a_EntityLeashedTo) -{ - for (auto ClientHandle : m_LoadedByClient) - { - ClientHandle->SendLeashEntity(a_Entity, a_EntityLeashedTo); - } -} - - - - -void cChunk::BroadcastUnleashEntity(const cEntity & a_Entity) -{ - for (auto ClientHandle : m_LoadedByClient) - { - ClientHandle->SendUnleashEntity(a_Entity); - } -} - - - - - -void cChunk::BroadcastBlockAction(Vector3i a_BlockPos, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude) -{ - for (auto itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendBlockAction(a_BlockPos.x, a_BlockPos.y, a_BlockPos.z, a_Byte1, a_Byte2, a_BlockType); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastBlockBreakAnimation(UInt32 a_EntityID, Vector3i a_BlockPos, char a_Stage, const cClientHandle * a_Exclude) -{ - for (auto itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendBlockBreakAnim(a_EntityID, a_BlockPos.x, a_BlockPos.y, a_BlockPos.z, a_Stage); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastBlockEntity(Vector3i a_BlockPos, const cClientHandle * a_Exclude) -{ - // We can operate on entity pointers, we're inside the ChunkMap's CS lock which guards the list - cBlockEntity * Entity = GetBlockEntity(a_BlockPos); - if (Entity == nullptr) - { - return; - } - for (auto itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) - { - if (*itr == a_Exclude) - { - continue; - } - Entity->SendTo(*(*itr)); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastCollectEntity(const cEntity & a_Entity, const cPlayer & a_Player, int a_Count, const cClientHandle * a_Exclude) -{ - for (auto itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendCollectEntity(a_Entity, a_Player, a_Count); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastDestroyEntity(const cEntity & a_Entity, const cClientHandle * a_Exclude) -{ - for (auto itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendDestroyEntity(a_Entity); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastDetachEntity(const cEntity & a_Entity, const cEntity & a_PreviousVehicle) -{ - for (auto ClientHandle : m_LoadedByClient) - { - ClientHandle->SendDetachEntity(a_Entity, a_PreviousVehicle); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastEntityEffect(const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration, const cClientHandle * a_Exclude) -{ - for (auto itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendEntityEffect(a_Entity, a_EffectID, a_Amplifier, a_Duration); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item, const cClientHandle * a_Exclude) -{ - for (auto itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendEntityEquipment(a_Entity, a_SlotNum, a_Item); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastEntityHeadLook(const cEntity & a_Entity, const cClientHandle * a_Exclude) -{ - for (auto itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendEntityHeadLook(a_Entity); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastEntityLook(const cEntity & a_Entity, const cClientHandle * a_Exclude) -{ - for (auto itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendEntityLook(a_Entity); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastEntityMetadata(const cEntity & a_Entity, const cClientHandle * a_Exclude) -{ - for (auto itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendEntityMetadata(a_Entity); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastEntityRelMove(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude) -{ - for (auto itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendEntityRelMove(a_Entity, a_RelX, a_RelY, a_RelZ); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastEntityRelMoveLook(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude) -{ - for (auto itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendEntityRelMoveLook(a_Entity, a_RelX, a_RelY, a_RelZ); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastEntityStatus(const cEntity & a_Entity, char a_Status, const cClientHandle * a_Exclude) -{ - for (auto itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendEntityStatus(a_Entity, a_Status); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastEntityVelocity(const cEntity & a_Entity, const cClientHandle * a_Exclude) -{ - for (auto itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendEntityVelocity(a_Entity); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude) -{ - for (auto itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendEntityAnimation(a_Entity, a_Animation); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount, cClientHandle * a_Exclude) -{ - for (auto itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendParticleEffect(a_ParticleName, a_SrcX, a_SrcY, a_SrcZ, a_OffsetX, a_OffsetY, a_OffsetZ, a_ParticleData, a_ParticleAmount); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastRemoveEntityEffect(const cEntity & a_Entity, int a_EffectID, const cClientHandle * a_Exclude) -{ - for (auto itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendRemoveEntityEffect(a_Entity, a_EffectID); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastSoundEffect(const AString & a_SoundName, Vector3d a_Position, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude) -{ - for (auto itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendSoundEffect(a_SoundName, a_Position, a_Volume, a_Pitch); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastSoundParticleEffect(const EffectID a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude) -{ - for (auto itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendSoundParticleEffect(a_EffectID, a_SrcX, a_SrcY, a_SrcZ, a_Data); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastSpawnEntity(cEntity & a_Entity, const cClientHandle * a_Exclude) -{ - for (auto itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) - { - if (*itr == a_Exclude) - { - continue; - } - a_Entity.SpawnOn(*(*itr)); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastThunderbolt(Vector3i a_BlockPos, const cClientHandle * a_Exclude) -{ - for (auto itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendThunderbolt(a_BlockPos.x, a_BlockPos.y, a_BlockPos.z); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastUseBed(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ) -{ - for (auto itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) - { - (*itr)->SendUseBed(a_Entity, a_BlockX, a_BlockY, a_BlockZ); - } // for itr - LoadedByClient[] -} - - - - - void cChunk::SendBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cClientHandle & a_Client) { cBlockEntity * Entity = GetBlockEntity(a_BlockX, a_BlockY, a_BlockZ); |