diff options
author | nielsbreu@gmail.com <nielsbreu@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-06-15 19:10:34 +0200 |
---|---|---|
committer | nielsbreu@gmail.com <nielsbreu@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-06-15 19:10:34 +0200 |
commit | f3319c4d5f0a83069a63442197e79e54fa9d6a21 (patch) | |
tree | 5c5f642adfc55245a9fa64b115801f447dc92de9 /source/Blocks/BlockBed.cpp | |
parent | First attempt at fixing the inter-threading deadlocks between the tick thread and the socket thread (diff) | |
download | cuberite-f3319c4d5f0a83069a63442197e79e54fa9d6a21.tar cuberite-f3319c4d5f0a83069a63442197e79e54fa9d6a21.tar.gz cuberite-f3319c4d5f0a83069a63442197e79e54fa9d6a21.tar.bz2 cuberite-f3319c4d5f0a83069a63442197e79e54fa9d6a21.tar.lz cuberite-f3319c4d5f0a83069a63442197e79e54fa9d6a21.tar.xz cuberite-f3319c4d5f0a83069a63442197e79e54fa9d6a21.tar.zst cuberite-f3319c4d5f0a83069a63442197e79e54fa9d6a21.zip |
Diffstat (limited to '')
-rw-r--r-- | source/Blocks/BlockBed.cpp | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/source/Blocks/BlockBed.cpp b/source/Blocks/BlockBed.cpp index 57af759b8..2ed8c1636 100644 --- a/source/Blocks/BlockBed.cpp +++ b/source/Blocks/BlockBed.cpp @@ -53,19 +53,29 @@ void cBlockBedHandler::OnDestroyed(cWorld * a_World, int a_BlockX, int a_BlockY, void cBlockBedHandler::OnUse(cWorld *a_World, cPlayer *a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ)
{
- NIBBLETYPE Meta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
- if (Meta & 0x8)
+ if (a_World->GetDimension() != 0)
{
- // Is pillow
- a_World->BroadcastUseBed(*a_Player, a_BlockX, a_BlockY, a_BlockZ);
- }
- else
- {
- // Is foot end
- Vector3i Direction = MetaDataToDirection( Meta & 0x7 );
- if (a_World->GetBlock(a_BlockX + Direction.x, a_BlockY, a_BlockZ + Direction.z) == E_BLOCK_BED) // Must always use pillow location for sleeping
+ a_World->DoExplosiontAt(5, a_BlockX, a_BlockY, a_BlockZ);
+ } else {
+ if (a_World->GetTimeOfDay() > 13000)
{
- a_World->BroadcastUseBed(*a_Player, a_BlockX + Direction.x, a_BlockY, a_BlockZ + Direction.z);
+ NIBBLETYPE Meta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
+ if (Meta & 0x8)
+ {
+ // Is pillow
+ a_World->BroadcastUseBed(*a_Player, a_BlockX, a_BlockY, a_BlockZ);
+ }
+ else
+ {
+ // Is foot end
+ Vector3i Direction = MetaDataToDirection( Meta & 0x7 );
+ if (a_World->GetBlock(a_BlockX + Direction.x, a_BlockY, a_BlockZ + Direction.z) == E_BLOCK_BED) // Must always use pillow location for sleeping
+ {
+ a_World->BroadcastUseBed(*a_Player, a_BlockX + Direction.x, a_BlockY, a_BlockZ + Direction.z);
+ }
+ }
+ } else {
+ a_Player->SendMessageA("You can only sleep at night");
}
}
}
|