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/BlockEntities | |
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 |
5 files changed, 12 insertions, 14 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()); } |