summaryrefslogtreecommitdiffstats
path: root/source/blocks
diff options
context:
space:
mode:
Diffstat (limited to 'source/blocks')
-rw-r--r--source/blocks/Block.h33
-rw-r--r--source/blocks/BlockEntity.h19
2 files changed, 35 insertions, 17 deletions
diff --git a/source/blocks/Block.h b/source/blocks/Block.h
index 0a5724ca3..50c541551 100644
--- a/source/blocks/Block.h
+++ b/source/blocks/Block.h
@@ -27,21 +27,30 @@ public:
virtual NIBBLETYPE GetDropMeta(NIBBLETYPE a_BlockMeta);
virtual bool NeedsRandomTicks();
virtual void DropBlock(cWorld *a_World, int a_X, int a_Y, int a_Z);
- //Checks if the block can stay at
- virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z);
- //Checks if the block can be placed at this point. Default: CanBeAt(...) NOTE: In the block is not placed in this callback
- virtual bool CanBePlacedAt(cWorld *a_World, int a_X, int a_Y, int a_Z, char a_Dir);
- //This gets called if the player tries to place a block ontop of this block (Only if he aims directly on this block)
- virtual bool AllowBlockOnTop();
- virtual bool IsUseable();
- virtual bool IsClickedThrough();
- virtual bool IgnoreBuildCollision();
- //Indicates this block can be placed on the side of other blocks. Default: true
+
+ /// Checks if the block can stay at the specified coords in the
+ virtual bool CanBeAt(cWorld *a_World, int a_BlockX, int a_BlockY, int a_BlockZ);
+
+ /// Checks if the block can be placed at this point. Default: CanBeAt(...) NOTE: This call doesn't actually place the block
+ virtual bool CanBePlacedAt(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir);
+
+ /// Called when the player tries to place a block on top of this block (Only if he aims directly on this block); return false to disallow
+ virtual bool AllowBlockOnTop(void);
+
+ /// Called to check whether this block supports a rclk action. If it returns true, OnClicked() is called
+ virtual bool IsUseable(void);
+
+ virtual bool IsClickedThrough(void);
+
+ virtual bool IgnoreBuildCollision(void);
+
+ /// Indicates this block can be placed on the side of other blocks. Default: true
virtual bool CanBePlacedOnSide();
- //Does this block drops if it gets destroyed by an unsuitable situation? Default: true
+
+ /// Does this block drop if it gets destroyed by an unsuitable situation? Default: true
virtual bool DropOnUnsuitable();
- static cBlockHandler *GetBlockHandler(BLOCKTYPE a_BlockID);
+ static cBlockHandler * GetBlockHandler(BLOCKTYPE a_BlockID);
static void Deinit();
diff --git a/source/blocks/BlockEntity.h b/source/blocks/BlockEntity.h
index c7b8b0859..085b65158 100644
--- a/source/blocks/BlockEntity.h
+++ b/source/blocks/BlockEntity.h
@@ -1,7 +1,12 @@
+
#pragma once
+
#include "Block.h"
+
+
+
class cBlockEntityHandler : public cBlockHandler
{
public:
@@ -9,14 +14,18 @@ public:
: cBlockHandler(a_BlockID)
{
}
- virtual void OnClick(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) override
+
+ virtual void OnClick(cWorld * a_World, cPlayer *a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
- a_World->UseBlockEntity(a_Player, a_X, a_Y, a_Z);
+ a_World->UseBlockEntity(a_Player, a_BlockX, a_BlockY, a_BlockZ);
}
+
virtual bool IsUseable() override
{
return true;
}
-
-
-}; \ No newline at end of file
+};
+
+
+
+