summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockBed.h
diff options
context:
space:
mode:
authorLukas Pioch <lukas@zgow.de>2017-07-07 09:31:45 +0200
committerGitHub <noreply@github.com>2017-07-07 09:31:45 +0200
commit885d8287125439047ca2318f8e349b8da279e612 (patch)
tree2f54b688dba0f49b64544d3c1220a16a6936cd6f /src/Blocks/BlockBed.h
parentChanged Lua plugins to only execute files ending in .lua (#3831) (diff)
downloadcuberite-885d8287125439047ca2318f8e349b8da279e612.tar
cuberite-885d8287125439047ca2318f8e349b8da279e612.tar.gz
cuberite-885d8287125439047ca2318f8e349b8da279e612.tar.bz2
cuberite-885d8287125439047ca2318f8e349b8da279e612.tar.lz
cuberite-885d8287125439047ca2318f8e349b8da279e612.tar.xz
cuberite-885d8287125439047ca2318f8e349b8da279e612.tar.zst
cuberite-885d8287125439047ca2318f8e349b8da279e612.zip
Diffstat (limited to '')
-rw-r--r--src/Blocks/BlockBed.h21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/Blocks/BlockBed.h b/src/Blocks/BlockBed.h
index cfb02ceeb..a9a3d0e20 100644
--- a/src/Blocks/BlockBed.h
+++ b/src/Blocks/BlockBed.h
@@ -1,10 +1,14 @@
+// BlockBed.h
+
#pragma once
+#include "BlockEntity.h"
#include "BlockHandler.h"
#include "MetaRotator.h"
-#include "Item.h"
#include "ChunkInterface.h"
+#include "../World.h"
+#include "../Entities/Entity.h"
class cPlayer;
@@ -14,15 +18,16 @@ class cWorldInterface;
class cBlockBedHandler :
- public cMetaRotator<cBlockHandler, 0x3, 0x02, 0x03, 0x00, 0x01, true>
+ public cMetaRotator<cBlockEntityHandler, 0x3, 0x02, 0x03, 0x00, 0x01, true>
{
public:
cBlockBedHandler(BLOCKTYPE a_BlockType)
- : cMetaRotator<cBlockHandler, 0x3, 0x02, 0x03, 0x00, 0x01, true>(a_BlockType)
+ : cMetaRotator<cBlockEntityHandler, 0x3, 0x02, 0x03, 0x00, 0x01, true>(a_BlockType)
{
}
virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override;
+
virtual bool OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override;
virtual bool IsUseable(void) override
@@ -30,11 +35,9 @@ public:
return true;
}
- virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
- {
- // Reset meta to zero
- a_Pickups.push_back(cItem(E_ITEM_BED, 1, 0));
- }
+ virtual void ConvertToPickups(cItems & Pickups, NIBBLETYPE Meta) override {}
+
+ virtual void ConvertToPickups(cEntity * a_Digger, cItems & a_Pickups, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ) override;
// Bed specific helper functions
static NIBBLETYPE RotationToMetaData(double a_Rotation)
@@ -77,6 +80,8 @@ public:
a_ChunkInterface.SetBlockMeta(a_BedPosition.x, a_BedPosition.y, a_BedPosition.z, Meta);
}
+ virtual void OnPlacedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, const sSetBlock & a_BlockChange) override;
+
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
{
UNUSED(a_Meta);