summaryrefslogtreecommitdiffstats
path: root/src/BlockEntities
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-08-05 23:54:36 +0200
committerTycho <work.tycho+git@gmail.com>2014-08-05 23:54:36 +0200
commit9272bd627c732771b81e6dcf6b8465404917a9d6 (patch)
tree617cb2f8d97901df9e9a47df813c63c6d724563e /src/BlockEntities
parentRefactored Redstone simulator not to depend on TNTEntity or DropSpenserENtity Directly (diff)
downloadcuberite-9272bd627c732771b81e6dcf6b8465404917a9d6.tar
cuberite-9272bd627c732771b81e6dcf6b8465404917a9d6.tar.gz
cuberite-9272bd627c732771b81e6dcf6b8465404917a9d6.tar.bz2
cuberite-9272bd627c732771b81e6dcf6b8465404917a9d6.tar.lz
cuberite-9272bd627c732771b81e6dcf6b8465404917a9d6.tar.xz
cuberite-9272bd627c732771b81e6dcf6b8465404917a9d6.tar.zst
cuberite-9272bd627c732771b81e6dcf6b8465404917a9d6.zip
Diffstat (limited to '')
-rw-r--r--src/BlockEntities/NoteEntity.h10
-rw-r--r--src/BlockEntities/RedstonePoweredEntity.h4
2 files changed, 13 insertions, 1 deletions
diff --git a/src/BlockEntities/NoteEntity.h b/src/BlockEntities/NoteEntity.h
index e8497da3e..f9db6cbe6 100644
--- a/src/BlockEntities/NoteEntity.h
+++ b/src/BlockEntities/NoteEntity.h
@@ -2,6 +2,7 @@
#pragma once
#include "BlockEntity.h"
+#include "RedstonePoweredEntity.h"
namespace Json
@@ -29,7 +30,8 @@ enum ENUM_NOTE_INSTRUMENTS
// tolua_begin
class cNoteEntity :
- public cBlockEntity
+ public cBlockEntity,
+ public cRedstonePoweredEntity
{
typedef cBlockEntity super;
public:
@@ -38,6 +40,7 @@ public:
/// Creates a new note entity. a_World may be NULL
cNoteEntity(int a_X, int a_Y, int a_Z, cWorld * a_World);
+ virtual ~cNoteEntity() {}
bool LoadFromJson(const Json::Value & a_Value);
virtual void SaveToJson(Json::Value & a_Value) override;
@@ -53,6 +56,11 @@ public:
virtual void UsedBy(cPlayer * a_Player) override;
virtual void SendTo(cClientHandle &) override {}
+
+ virtual void SetRedstonePower(bool a_Value)
+ {
+ if (a_Value) MakeSound();
+ }
static const char * GetClassStatic(void) { return "cNoteEntity"; }
diff --git a/src/BlockEntities/RedstonePoweredEntity.h b/src/BlockEntities/RedstonePoweredEntity.h
index aebba771f..7d6904442 100644
--- a/src/BlockEntities/RedstonePoweredEntity.h
+++ b/src/BlockEntities/RedstonePoweredEntity.h
@@ -1,9 +1,13 @@
+#pragma once
// Interface class representing a blockEntity that responds to redstone
class cRedstonePoweredEntity
{
public:
+
+ virtual ~cRedstonePoweredEntity() {};
+
/// Sets the internal redstone power flag to "on" or "off", depending on the parameter. Calls Activate() if appropriate
virtual void SetRedstonePower(bool a_IsPowered) = 0;
};