summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemBed.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-06-21 19:49:22 +0200
committerMattes D <github@xoft.cz>2015-06-21 19:49:22 +0200
commit3889b2cac26410650d7ec6f296e0bb19c3debb4b (patch)
tree53fbbb941c11e39190c094b3ebea82d66d61deb0 /src/Items/ItemBed.h
parentMerge pull request #2267 from cuberite/InfoDumpFix (diff)
downloadcuberite-3889b2cac26410650d7ec6f296e0bb19c3debb4b.tar
cuberite-3889b2cac26410650d7ec6f296e0bb19c3debb4b.tar.gz
cuberite-3889b2cac26410650d7ec6f296e0bb19c3debb4b.tar.bz2
cuberite-3889b2cac26410650d7ec6f296e0bb19c3debb4b.tar.lz
cuberite-3889b2cac26410650d7ec6f296e0bb19c3debb4b.tar.xz
cuberite-3889b2cac26410650d7ec6f296e0bb19c3debb4b.tar.zst
cuberite-3889b2cac26410650d7ec6f296e0bb19c3debb4b.zip
Diffstat (limited to '')
-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;
}
} ;