diff options
author | Bond-009 <bond.009@outlook.com> | 2017-09-25 18:17:45 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2017-09-25 18:17:45 +0200 |
commit | 10c5c1227e5a663b3a53c336cfa6a0a98f874265 (patch) | |
tree | b45f06fd4d7ceaca6807113d58d4aba7166d9aa5 /src | |
parent | cBlockArea: Fix performance regression (#4045) (diff) | |
download | cuberite-10c5c1227e5a663b3a53c336cfa6a0a98f874265.tar cuberite-10c5c1227e5a663b3a53c336cfa6a0a98f874265.tar.gz cuberite-10c5c1227e5a663b3a53c336cfa6a0a98f874265.tar.bz2 cuberite-10c5c1227e5a663b3a53c336cfa6a0a98f874265.tar.lz cuberite-10c5c1227e5a663b3a53c336cfa6a0a98f874265.tar.xz cuberite-10c5c1227e5a663b3a53c336cfa6a0a98f874265.tar.zst cuberite-10c5c1227e5a663b3a53c336cfa6a0a98f874265.zip |
Diffstat (limited to '')
-rw-r--r-- | src/BlockEntities/BedEntity.cpp | 8 | ||||
-rw-r--r-- | src/BlockEntities/CommandBlockEntity.cpp | 4 | ||||
-rw-r--r-- | src/BlockEntities/FlowerPotEntity.cpp | 2 | ||||
-rw-r--r-- | src/BlockEntities/MobHeadEntity.cpp | 10 | ||||
-rw-r--r-- | src/BlockEntities/MobSpawnerEntity.cpp | 2 | ||||
-rw-r--r-- | src/Chunk.cpp | 12 | ||||
-rw-r--r-- | src/Chunk.h | 6 | ||||
-rw-r--r-- | src/ChunkMap.cpp | 19 | ||||
-rw-r--r-- | src/ChunkMap.h | 4 | ||||
-rw-r--r-- | src/ClientHandle.cpp | 6 | ||||
-rw-r--r-- | src/Items/ItemMobHead.h | 44 | ||||
-rw-r--r-- | src/World.cpp | 8 | ||||
-rw-r--r-- | src/World.h | 4 |
13 files changed, 62 insertions, 67 deletions
diff --git a/src/BlockEntities/BedEntity.cpp b/src/BlockEntities/BedEntity.cpp index b8f61c049..c74448661 100644 --- a/src/BlockEntities/BedEntity.cpp +++ b/src/BlockEntities/BedEntity.cpp @@ -43,14 +43,12 @@ void cBedEntity::SendTo(cClientHandle & a_Client) void cBedEntity::SetColor(short a_Color) { m_Color = a_Color; - int posX = m_PosX; - int posY = m_PosY; - int posZ = m_PosZ; + auto Pos = GetPos(); // If the bed entity is send immediately, the client (maybe) still has not the bed. // Fix that by delaying the broadcast of the bed entity by a tick: - m_World->ScheduleTask(1, [posX, posY, posZ](cWorld & a_World) + m_World->ScheduleTask(1, [Pos](cWorld & a_World) { - a_World.BroadcastBlockEntity(posX, posY, posZ); + a_World.BroadcastBlockEntity(Pos); }); } diff --git a/src/BlockEntities/CommandBlockEntity.cpp b/src/BlockEntities/CommandBlockEntity.cpp index 43e9316c5..d8f358028 100644 --- a/src/BlockEntities/CommandBlockEntity.cpp +++ b/src/BlockEntities/CommandBlockEntity.cpp @@ -52,7 +52,7 @@ void cCommandBlockEntity::SetCommand(const AString & a_Cmd) Just documenting my experience in getting this to work :P */ - m_World->BroadcastBlockEntity(GetPosX(), GetPosY(), GetPosZ()); + m_World->BroadcastBlockEntity(GetPos()); } @@ -61,7 +61,7 @@ void cCommandBlockEntity::SetCommand(const AString & a_Cmd) void cCommandBlockEntity::SetLastOutput(const AString & a_LastOut) { - m_World->BroadcastBlockEntity(GetPosX(), GetPosY(), GetPosZ()); + m_World->BroadcastBlockEntity(GetPos()); m_LastOutput = a_LastOut; } diff --git a/src/BlockEntities/FlowerPotEntity.cpp b/src/BlockEntities/FlowerPotEntity.cpp index dbbbefff2..486553c50 100644 --- a/src/BlockEntities/FlowerPotEntity.cpp +++ b/src/BlockEntities/FlowerPotEntity.cpp @@ -67,7 +67,7 @@ bool cFlowerPotEntity::UsedBy(cPlayer * a_Player) { a_Player->GetInventory().RemoveOneEquippedItem(); } - m_World->BroadcastBlockEntity(m_PosX, m_PosY, m_PosZ, a_Player->GetClientHandle()); + m_World->BroadcastBlockEntity(GetPos(), a_Player->GetClientHandle()); } return true; } diff --git a/src/BlockEntities/MobHeadEntity.cpp b/src/BlockEntities/MobHeadEntity.cpp index 28e9febed..3a2ef9e72 100644 --- a/src/BlockEntities/MobHeadEntity.cpp +++ b/src/BlockEntities/MobHeadEntity.cpp @@ -58,7 +58,7 @@ void cMobHeadEntity::SetType(const eMobHeadType & a_Type) m_OwnerUUID = cUUID{}; } m_Type = a_Type; - m_World->BroadcastBlockEntity(m_PosX, m_PosY, m_PosZ); + m_World->BroadcastBlockEntity(GetPos()); } @@ -68,7 +68,7 @@ void cMobHeadEntity::SetType(const eMobHeadType & a_Type) void cMobHeadEntity::SetRotation(eMobHeadRotation a_Rotation) { m_Rotation = a_Rotation; - m_World->BroadcastBlockEntity(m_PosX, m_PosY, m_PosZ); + m_World->BroadcastBlockEntity(GetPos()); } @@ -96,7 +96,7 @@ void cMobHeadEntity::SetOwner(const cPlayer & a_Owner) } } - m_World->BroadcastBlockEntity(m_PosX, m_PosY, m_PosZ); + m_World->BroadcastBlockEntity(GetPos()); } @@ -114,7 +114,7 @@ void cMobHeadEntity::SetOwner(const cUUID & a_OwnerUUID, const AString & a_Owner m_OwnerName = a_OwnerName; m_OwnerTexture = a_OwnerTexture; m_OwnerTextureSignature = a_OwnerTextureSignature; - m_World->BroadcastBlockEntity(m_PosX, m_PosY, m_PosZ); + m_World->BroadcastBlockEntity(GetPos()); } @@ -124,7 +124,7 @@ void cMobHeadEntity::SetOwner(const cUUID & a_OwnerUUID, const AString & a_Owner void cMobHeadEntity::SendTo(cClientHandle & a_Client) { cWorld * World = a_Client.GetPlayer()->GetWorld(); - a_Client.SendBlockChange(m_PosX, m_PosY, m_PosZ, m_BlockType, World->GetBlockMeta(m_PosX, m_PosY, m_PosZ)); + a_Client.SendBlockChange(m_PosX, m_PosY, m_PosZ, m_BlockType, World->GetBlockMeta(GetPos())); a_Client.SendUpdateBlockEntity(*this); } diff --git a/src/BlockEntities/MobSpawnerEntity.cpp b/src/BlockEntities/MobSpawnerEntity.cpp index 90534216a..83293765f 100644 --- a/src/BlockEntities/MobSpawnerEntity.cpp +++ b/src/BlockEntities/MobSpawnerEntity.cpp @@ -122,7 +122,7 @@ bool cMobSpawnerEntity::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) void cMobSpawnerEntity::ResetTimer(void) { m_SpawnDelay = GetRandomProvider().RandInt<short>(200, 800); - m_World->BroadcastBlockEntity(m_PosX, m_PosY, m_PosZ); + m_World->BroadcastBlockEntity(GetPos()); } diff --git a/src/Chunk.cpp b/src/Chunk.cpp index c29d9917e..0ce18c45e 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -494,7 +494,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); + BroadcastBlockEntity({posX, posY, posZ}); } } } @@ -1942,7 +1942,7 @@ bool cChunk::SetSignLines(int a_PosX, int a_PosY, int a_PosZ, const AString & a_ MarkDirty(); auto Sign = static_cast<cSignEntity *>(Entity); Sign->SetLines(a_Line1, a_Line2, a_Line3, a_Line4); - m_World->BroadcastBlockEntity(a_PosX, a_PosY, a_PosZ); + m_World->BroadcastBlockEntity({a_PosX, a_PosY, a_PosZ}); return true; } @@ -2713,7 +2713,7 @@ void cChunk::BroadcastBlockAction(Vector3i a_BlockPos, char a_Byte1, char a_Byte -void cChunk::BroadcastBlockBreakAnimation(UInt32 a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage, const cClientHandle * a_Exclude) +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) { @@ -2721,7 +2721,7 @@ void cChunk::BroadcastBlockBreakAnimation(UInt32 a_EntityID, int a_BlockX, int a { continue; } - (*itr)->SendBlockBreakAnim(a_EntityID, a_BlockX, a_BlockY, a_BlockZ, a_Stage); + (*itr)->SendBlockBreakAnim(a_EntityID, a_BlockPos.x, a_BlockPos.y, a_BlockPos.z, a_Stage); } // for itr - LoadedByClient[] } @@ -2729,10 +2729,10 @@ void cChunk::BroadcastBlockBreakAnimation(UInt32 a_EntityID, int a_BlockX, int a -void cChunk::BroadcastBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude) +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_BlockX, a_BlockY, a_BlockZ); + cBlockEntity * Entity = GetBlockEntity(a_BlockPos); if (Entity == nullptr) { return; diff --git a/src/Chunk.h b/src/Chunk.h index da5acffe7..d6856f911 100644 --- a/src/Chunk.h +++ b/src/Chunk.h @@ -341,8 +341,8 @@ public: // (Please keep these alpha-sorted) void BroadcastAttachEntity (const cEntity & a_Entity, const cEntity & a_Vehicle); void BroadcastBlockAction (Vector3i a_BlockPos, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude = nullptr); - void BroadcastBlockBreakAnimation(UInt32 a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage, const cClientHandle * a_Exclude = nullptr); - void BroadcastBlockEntity (int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude = nullptr); + void BroadcastBlockBreakAnimation(UInt32 a_EntityID, Vector3i a_BlockPos, char a_Stage, const cClientHandle * a_Exclude = nullptr); + void BroadcastBlockEntity (Vector3i a_BlockPos, const cClientHandle * a_Exclude = nullptr); void BroadcastCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player, int a_Count, const cClientHandle * a_Exclude = nullptr); void BroadcastDestroyEntity (const cEntity & a_Entity, const cClientHandle * a_Exclude = nullptr); void BroadcastDetachEntity (const cEntity & a_Entity, const cEntity & a_PreviousVehicle); @@ -368,7 +368,7 @@ public: void SendBlockEntity (int a_BlockX, int a_BlockY, int a_BlockZ, cClientHandle & a_Client); - Vector3i PositionToWorldPosition(const Vector3i & a_RelPos) + Vector3i PositionToWorldPosition(Vector3i a_RelPos) { return PositionToWorldPosition(a_RelPos.x, a_RelPos.y, a_RelPos.z); } diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp index dff62f69d..30bab923d 100644 --- a/src/ChunkMap.cpp +++ b/src/ChunkMap.cpp @@ -325,36 +325,33 @@ void cChunkMap::BroadcastBlockAction(Vector3i a_BlockPos, char a_Byte1, char a_B -void cChunkMap::BroadcastBlockBreakAnimation(UInt32 a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage, const cClientHandle * a_Exclude) +void cChunkMap::BroadcastBlockBreakAnimation(UInt32 a_EntityID, Vector3i a_BlockPos, char a_Stage, const cClientHandle * a_Exclude) { cCSLock Lock(m_CSChunks); - int ChunkX, ChunkZ; - - cChunkDef::BlockToChunk(a_BlockX, a_BlockZ, ChunkX, ChunkZ); - cChunkPtr Chunk = GetChunkNoGen(ChunkX, ChunkZ); + cChunkCoords ChunkPos = cChunkDef::BlockToChunk(a_BlockPos); + cChunkPtr Chunk = GetChunkNoGen(ChunkPos); if (Chunk == nullptr) { return; } // It's perfectly legal to broadcast packets even to invalid chunks! - Chunk->BroadcastBlockBreakAnimation(a_EntityID, a_BlockX, a_BlockY, a_BlockZ, a_Stage, a_Exclude); + Chunk->BroadcastBlockBreakAnimation(a_EntityID, a_BlockPos, a_Stage, a_Exclude); } -void cChunkMap::BroadcastBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude) +void cChunkMap::BroadcastBlockEntity(Vector3i a_BlockPos, const cClientHandle * a_Exclude) { cCSLock Lock(m_CSChunks); - int ChunkX, ChunkZ; - cChunkDef::BlockToChunk(a_BlockX, a_BlockZ, ChunkX, ChunkZ); - cChunkPtr Chunk = GetChunkNoGen(ChunkX, ChunkZ); + cChunkCoords ChunkPos = cChunkDef::BlockToChunk(a_BlockPos); + cChunkPtr Chunk = GetChunkNoGen(ChunkPos); if ((Chunk == nullptr) || !Chunk->IsValid()) { return; } - Chunk->BroadcastBlockEntity(a_BlockX, a_BlockY, a_BlockZ, a_Exclude); + Chunk->BroadcastBlockEntity(a_BlockPos, a_Exclude); } diff --git a/src/ChunkMap.h b/src/ChunkMap.h index 122e26ac1..2bd8e8302 100644 --- a/src/ChunkMap.h +++ b/src/ChunkMap.h @@ -72,8 +72,8 @@ public: // (Please keep these alpha-sorted) void BroadcastAttachEntity(const cEntity & a_Entity, const cEntity & a_Vehicle); void BroadcastBlockAction(Vector3i a_BlockPos, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude = nullptr); - void BroadcastBlockBreakAnimation(UInt32 a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage, const cClientHandle * a_Exclude = nullptr); - void BroadcastBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude); + void BroadcastBlockBreakAnimation(UInt32 a_EntityID, Vector3i a_BlockPos, char a_Stage, const cClientHandle * a_Exclude = nullptr); + void BroadcastBlockEntity(Vector3i a_BlockPos, const cClientHandle * a_Exclude); void BroadcastCollectEntity(const cEntity & a_Entity, const cPlayer & a_Player, int a_Count, const cClientHandle * a_Exclude = nullptr); void BroadcastDestroyEntity(const cEntity & a_Entity, const cClientHandle * a_Exclude = nullptr); void BroadcastDetachEntity(const cEntity & a_Entity, const cEntity & a_PreviousVehicle); diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 967e90226..020707238 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -1257,7 +1257,7 @@ void cClientHandle::HandleBlockDigStarted(int a_BlockX, int a_BlockY, int a_Bloc m_BlockDigAnimY = a_BlockY; m_BlockDigAnimZ = a_BlockZ; m_BlockDigAnimStage = 0; - m_Player->GetWorld()->BroadcastBlockBreakAnimation(static_cast<UInt32>(m_UniqueID), m_BlockDigAnimX, m_BlockDigAnimY, m_BlockDigAnimZ, 0, this); + m_Player->GetWorld()->BroadcastBlockBreakAnimation(static_cast<UInt32>(m_UniqueID), {m_BlockDigAnimX, m_BlockDigAnimY, m_BlockDigAnimZ}, 0, this); cWorld * World = m_Player->GetWorld(); cChunkInterface ChunkInterface(World->GetChunkMap()); @@ -1371,7 +1371,7 @@ void cClientHandle::FinishDigAnimation() // End dig animation m_BlockDigAnimStage = -1; // It seems that 10 ends block animation - m_Player->GetWorld()->BroadcastBlockBreakAnimation(static_cast<UInt32>(m_UniqueID), m_LastDigBlockX, m_LastDigBlockY, m_LastDigBlockZ, 10, this); + m_Player->GetWorld()->BroadcastBlockBreakAnimation(static_cast<UInt32>(m_UniqueID), {m_LastDigBlockX, m_LastDigBlockY, m_LastDigBlockZ}, 10, this); } m_BlockDigAnimX = -1; @@ -2160,7 +2160,7 @@ void cClientHandle::Tick(float a_Dt) } if (m_BlockDigAnimStage / 1000 != lastAnimVal / 1000) { - m_Player->GetWorld()->BroadcastBlockBreakAnimation(static_cast<UInt32>(m_UniqueID), m_BlockDigAnimX, m_BlockDigAnimY, m_BlockDigAnimZ, static_cast<char>(m_BlockDigAnimStage / 1000), this); + m_Player->GetWorld()->BroadcastBlockBreakAnimation(static_cast<UInt32>(m_UniqueID), {m_BlockDigAnimX, m_BlockDigAnimY, m_BlockDigAnimZ}, static_cast<char>(m_BlockDigAnimStage / 1000), this); } } diff --git a/src/Items/ItemMobHead.h b/src/Items/ItemMobHead.h index 5cbcf52f7..747492402 100644 --- a/src/Items/ItemMobHead.h +++ b/src/Items/ItemMobHead.h @@ -38,7 +38,7 @@ public: // If the placed head is a wither, try to spawn the wither first: if (a_EquippedItem.m_ItemDamage == E_META_HEAD_WITHER) { - if (TrySpawnWitherAround(a_World, a_Player, placedX, placedY, placedZ)) + if (TrySpawnWitherAround(a_World, a_Player, {placedX, placedY, placedZ})) { return true; } @@ -82,7 +82,7 @@ public: MobHeadEntity.SetType(HeadType); MobHeadEntity.SetRotation(static_cast<eMobHeadRotation>(Rotation)); - MobHeadEntity.GetWorld()->BroadcastBlockEntity(MobHeadEntity.GetPosX(), MobHeadEntity.GetPosY(), MobHeadEntity.GetPosZ()); + MobHeadEntity.GetWorld()->BroadcastBlockEntity(MobHeadEntity.GetPos()); return false; } ); @@ -93,11 +93,11 @@ public: Returns true if the wither was created. */ bool TrySpawnWitherAround( cWorld & a_World, cPlayer & a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ + Vector3i a_BlockPos ) { // No wither can be created at Y < 2 - not enough space for the formula: - if (a_BlockY < 2) + if (a_BlockPos.y < 2) { return false; } @@ -111,17 +111,17 @@ public: { 0, 0, 1}, { 0, 0, -1}, }; - for (size_t i = 0; i < ARRAYCOUNT(RelCoords); ++i) + for (auto & RelCoord : RelCoords) { if (TrySpawnWitherAt( a_World, a_Player, - a_BlockX, a_BlockY, a_BlockZ, - RelCoords[i].x, RelCoords[i].z + a_BlockPos, + RelCoord.x, RelCoord.z )) { return true; } - } // for i - Coords[] + } // for i - RelCoords[] return false; } @@ -134,7 +134,7 @@ public: Returns true iff the wither was created successfully. */ bool TrySpawnWitherAt( cWorld & a_World, cPlayer & a_Player, - int a_PlacedHeadX, int a_PlacedHeadY, int a_PlacedHeadZ, + Vector3i a_PlacedHeadPos, int a_OffsetX, int a_OffsetZ ) { @@ -170,12 +170,12 @@ public: return ( TrySpawnWitherFromImage( a_World, a_Player, ImageWitherX, ARRAYCOUNT(ImageWitherX), - a_PlacedHeadX, a_PlacedHeadY, a_PlacedHeadZ, + a_PlacedHeadPos, a_OffsetX, a_OffsetZ ) || TrySpawnWitherFromImage( a_World, a_Player, ImageWitherZ, ARRAYCOUNT(ImageWitherZ), - a_PlacedHeadX, a_PlacedHeadY, a_PlacedHeadZ, + a_PlacedHeadPos, a_OffsetX, a_OffsetZ ) ); @@ -189,7 +189,7 @@ public: Returns true iff the wither was created successfully. */ bool TrySpawnWitherFromImage( cWorld & a_World, cPlayer & a_Player, const sSetBlock * a_Image, size_t a_ImageCount, - int a_PlacedHeadX, int a_PlacedHeadY, int a_PlacedHeadZ, + Vector3i a_PlacedHeadPos, int a_OffsetX, int a_OffsetZ ) { @@ -199,12 +199,12 @@ public: for (size_t i = 0; i < a_ImageCount; i++) { // Get the absolute coords of the image: - int BlockX = a_PlacedHeadX + a_OffsetX + a_Image[i].GetX(); - int BlockY = a_PlacedHeadY + a_Image[i].GetY(); - int BlockZ = a_PlacedHeadZ + a_OffsetZ + a_Image[i].GetZ(); + int BlockX = a_PlacedHeadPos.x + a_OffsetX + a_Image[i].GetX(); + int BlockY = a_PlacedHeadPos.y + a_Image[i].GetY(); + int BlockZ = a_PlacedHeadPos.z + a_OffsetZ + a_Image[i].GetZ(); // If the query is for the placed head, short-circuit-evaluate it: - if ((BlockX == a_PlacedHeadX) && (BlockY == a_PlacedHeadY) && (BlockZ == a_PlacedHeadZ)) + if ((BlockX == a_PlacedHeadPos.x) && (BlockY == a_PlacedHeadPos.y) && (BlockZ == a_PlacedHeadPos.z)) { if (a_Image[i].m_BlockType != E_BLOCK_HEAD) { @@ -256,18 +256,18 @@ public: } // Spawn the wither: - int BlockX = a_PlacedHeadX + a_OffsetX; - int BlockZ = a_PlacedHeadZ + a_OffsetZ; - a_World.SpawnMob(static_cast<double>(BlockX) + 0.5, a_PlacedHeadY - 2, static_cast<double>(BlockZ) + 0.5, mtWither, false); - AwardSpawnWitherAchievement(a_World, BlockX, a_PlacedHeadY - 2, BlockZ); + int BlockX = a_PlacedHeadPos.x + a_OffsetX; + int BlockZ = a_PlacedHeadPos.z + a_OffsetZ; + a_World.SpawnMob(static_cast<double>(BlockX) + 0.5, a_PlacedHeadPos.y - 2, static_cast<double>(BlockZ) + 0.5, mtWither, false); + AwardSpawnWitherAchievement(a_World, {BlockX, a_PlacedHeadPos.y - 2, BlockZ}); return true; } /** Awards the achievement to all players close to the specified point. */ - void AwardSpawnWitherAchievement(cWorld & a_World, int a_BlockX, int a_BlockY, int a_BlockZ) + void AwardSpawnWitherAchievement(cWorld & a_World, Vector3i a_BlockPos) { - Vector3f Pos{ static_cast<float>(a_BlockX), static_cast<float>(a_BlockY), static_cast<float>(a_BlockZ) }; + Vector3f Pos(a_BlockPos); a_World.ForEachPlayer([=](cPlayer & a_Player) { // If player is close, award achievement: diff --git a/src/World.cpp b/src/World.cpp index c6bbf548a..48c26da5a 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -2420,18 +2420,18 @@ void cWorld::BroadcastBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, Byte -void cWorld::BroadcastBlockBreakAnimation(UInt32 a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage, const cClientHandle * a_Exclude) +void cWorld::BroadcastBlockBreakAnimation(UInt32 a_EntityID, Vector3i a_BlockPos, char a_Stage, const cClientHandle * a_Exclude) { - m_ChunkMap->BroadcastBlockBreakAnimation(a_EntityID, a_BlockX, a_BlockY, a_BlockZ, a_Stage, a_Exclude); + m_ChunkMap->BroadcastBlockBreakAnimation(a_EntityID, a_BlockPos, a_Stage, a_Exclude); } -void cWorld::BroadcastBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude) +void cWorld::BroadcastBlockEntity(Vector3i a_BlockPos, const cClientHandle * a_Exclude) { - m_ChunkMap->BroadcastBlockEntity(a_BlockX, a_BlockY, a_BlockZ, a_Exclude); + m_ChunkMap->BroadcastBlockEntity(a_BlockPos, a_Exclude); } diff --git a/src/World.h b/src/World.h index b5702a6dc..5f18f7a39 100644 --- a/src/World.h +++ b/src/World.h @@ -163,8 +163,8 @@ public: void BroadcastAttachEntity (const cEntity & a_Entity, const cEntity & a_Vehicle); void BroadcastBlockAction (Vector3i a_BlockPos, Byte a_Byte1, Byte a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude = nullptr); // tolua_export void BroadcastBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, Byte a_Byte1, Byte a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude = nullptr); // tolua_export - void BroadcastBlockBreakAnimation(UInt32 a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage, const cClientHandle * a_Exclude = nullptr); - void BroadcastBlockEntity (int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude = nullptr); ///< If there is a block entity at the specified coods, sends it to all clients except a_Exclude + void BroadcastBlockBreakAnimation(UInt32 a_EntityID, Vector3i a_BlockPos, char a_Stage, const cClientHandle * a_Exclude = nullptr); + void BroadcastBlockEntity (Vector3i a_BlockPos, const cClientHandle * a_Exclude = nullptr); ///< If there is a block entity at the specified coods, sends it to all clients except a_Exclude // tolua_begin void BroadcastChat (const AString & a_Message, const cClientHandle * a_Exclude = nullptr, eMessageType a_ChatPrefix = mtCustom); |