summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockBed.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Blocks/BlockBed.cpp')
-rw-r--r--src/Blocks/BlockBed.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Blocks/BlockBed.cpp b/src/Blocks/BlockBed.cpp
index 58ff720c8..4fd3eba54 100644
--- a/src/Blocks/BlockBed.cpp
+++ b/src/Blocks/BlockBed.cpp
@@ -158,12 +158,12 @@ bool cBlockBedHandler::OnUse(
void cBlockBedHandler::OnPlacedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer & a_Player, const sSetBlock & a_BlockChange) const
{
- a_Player.GetWorld()->DoWithBedAt(a_BlockChange.GetX(), a_BlockChange.GetY(), a_BlockChange.GetZ(), [&](cBedEntity & a_Bed)
- {
- a_Bed.SetColor(a_Player.GetEquippedItem().m_ItemDamage);
- return true;
- }
- );
+ a_Player.GetWorld()->DoWithBlockEntityAt(a_BlockChange.GetAbsolutePos(), [&a_Player](cBlockEntity & a_BlockEntity)
+ {
+ ASSERT(a_BlockEntity.GetBlockType() == E_BLOCK_BED);
+ static_cast<cBedEntity &>(a_BlockEntity).SetColor(a_Player.GetEquippedItem().m_ItemDamage);
+ return false;
+ });
}