summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemBed.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-06-21 22:18:17 +0200
committerMattes D <github@xoft.cz>2015-06-21 22:18:17 +0200
commitd83c9f194f08016df54220ba0cc4f8751689d64f (patch)
tree53fbbb941c11e39190c094b3ebea82d66d61deb0 /src/Items/ItemBed.h
parentMerge pull request #2267 from cuberite/InfoDumpFix (diff)
parentRefactored block placement workflow. (diff)
downloadcuberite-d83c9f194f08016df54220ba0cc4f8751689d64f.tar
cuberite-d83c9f194f08016df54220ba0cc4f8751689d64f.tar.gz
cuberite-d83c9f194f08016df54220ba0cc4f8751689d64f.tar.bz2
cuberite-d83c9f194f08016df54220ba0cc4f8751689d64f.tar.lz
cuberite-d83c9f194f08016df54220ba0cc4f8751689d64f.tar.xz
cuberite-d83c9f194f08016df54220ba0cc4f8751689d64f.tar.zst
cuberite-d83c9f194f08016df54220ba0cc4f8751689d64f.zip
Diffstat (limited to 'src/Items/ItemBed.h')
-rw-r--r--src/Items/ItemBed.h15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/Items/ItemBed.h b/src/Items/ItemBed.h
index 77d51d744..15b924a08 100644
--- a/src/Items/ItemBed.h
+++ b/src/Items/ItemBed.h
@@ -25,10 +25,11 @@ public:
}
- virtual bool OnPlayerPlace(
+ virtual bool GetBlocksToPlace(
cWorld & a_World, cPlayer & a_Player, const cItem & a_EquippedItem,
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
- int a_CursorX, int a_CursorY, int a_CursorZ
+ int a_CursorX, int a_CursorY, int a_CursorZ,
+ sSetBlockVector & a_BlocksToPlace
) override
{
// Can only be placed on the floor:
@@ -36,12 +37,10 @@ public:
{
return false;
}
- AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace);
// The "foot" block:
- sSetBlockVector blks;
NIBBLETYPE BlockMeta = cBlockBedHandler::RotationToMetaData(a_Player.GetYaw());
- blks.emplace_back(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_BED, BlockMeta);
+ a_BlocksToPlace.emplace_back(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_BED, BlockMeta);
// Check if there is empty space for the "head" block:
// (Vanilla only allows beds to be placed into air)
@@ -50,10 +49,8 @@ public:
{
return false;
}
- blks.emplace_back(a_BlockX + Direction.x, a_BlockY, a_BlockZ + Direction.z, E_BLOCK_BED, BlockMeta | 0x08);
-
- // Place both bed blocks:
- return a_Player.PlaceBlocks(blks);
+ a_BlocksToPlace.emplace_back(a_BlockX + Direction.x, a_BlockY, a_BlockZ + Direction.z, E_BLOCK_BED, BlockMeta | 0x08);
+ return true;
}
} ;