diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-08-10 22:26:50 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-08-10 22:26:50 +0200 |
commit | e6ac77a2c1c03498a99de1b4aafdd1ee46e19db0 (patch) | |
tree | 2e23dccd3899f317d4178b1d72d5f4315178dfbb /source | |
parent | Fixed a crash in creative inventory (FS 235, patch submitted by l0udPL) (diff) | |
download | cuberite-e6ac77a2c1c03498a99de1b4aafdd1ee46e19db0.tar cuberite-e6ac77a2c1c03498a99de1b4aafdd1ee46e19db0.tar.gz cuberite-e6ac77a2c1c03498a99de1b4aafdd1ee46e19db0.tar.bz2 cuberite-e6ac77a2c1c03498a99de1b4aafdd1ee46e19db0.tar.lz cuberite-e6ac77a2c1c03498a99de1b4aafdd1ee46e19db0.tar.xz cuberite-e6ac77a2c1c03498a99de1b4aafdd1ee46e19db0.tar.zst cuberite-e6ac77a2c1c03498a99de1b4aafdd1ee46e19db0.zip |
Diffstat (limited to '')
-rw-r--r-- | source/blocks/BlockCactus.h | 24 | ||||
-rw-r--r-- | source/blocks/BlockSugarcane.h | 47 |
2 files changed, 50 insertions, 21 deletions
diff --git a/source/blocks/BlockCactus.h b/source/blocks/BlockCactus.h index 5eb351d9c..e5bfdda03 100644 --- a/source/blocks/BlockCactus.h +++ b/source/blocks/BlockCactus.h @@ -1,8 +1,13 @@ +
#pragma once
#include "Block.h"
-class cBlockCactusHandler : public cBlockHandler
+
+
+
+class cBlockCactusHandler :
+ public cBlockHandler
{
public:
cBlockCactusHandler(BLOCKTYPE a_BlockID)
@@ -10,12 +15,14 @@ public: {
}
+
virtual NIBBLETYPE GetDropMeta(NIBBLETYPE a_BlockMeta) override
{
return 0;
}
- virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z) override
+
+ virtual bool CanBeAt(cWorld * a_World, int a_X, int a_Y, int a_Z) override
{
BLOCKTYPE Surface = a_World->GetBlock(a_X, a_Y - 1, a_Z);
if ((Surface != E_BLOCK_SAND) && (Surface != E_BLOCK_CACTUS))
@@ -34,13 +41,8 @@ public: {
return false;
}
-
- return true;
- }
- virtual bool AllowBlockOnTop() override
- {
- return false;
+ return true;
}
@@ -48,4 +50,8 @@ public: {
return false;
}
-};
\ No newline at end of file +};
+
+
+
+
diff --git a/source/blocks/BlockSugarcane.h b/source/blocks/BlockSugarcane.h index f402c4c28..b3db0a795 100644 --- a/source/blocks/BlockSugarcane.h +++ b/source/blocks/BlockSugarcane.h @@ -1,9 +1,13 @@ +
#pragma once
#include "Block.h"
-#include "../MersenneTwister.h"
-#include "../cWorld.h"
-class cBlockSugarcaneHandler : public cBlockHandler
+
+
+
+
+class cBlockSugarcaneHandler :
+ public cBlockHandler
{
public:
cBlockSugarcaneHandler(BLOCKTYPE a_BlockID)
@@ -11,33 +15,52 @@ public: {
}
+
virtual bool NeedsRandomTicks() override
{
return true;
}
+
virtual int GetDropID() override
{
return E_ITEM_SUGARCANE;
}
- virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z) override
+
+ virtual bool CanBeAt(cWorld * a_World, int a_X, int a_Y, int a_Z) override
{
- BLOCKTYPE Block = a_World->GetBlock(a_X, a_Y-1, a_Z);
- if(!IsBlockTypeOfDirt(Block) && Block != E_BLOCK_SAND && Block != E_BLOCK_SUGARCANE)
- return false;
-
- return a_World->IsBlockDirectlyWatered(a_X, a_Y - 1, a_Z);
+ switch (a_World->GetBlock(a_X, a_Y - 1, a_Z))
+ {
+ case E_BLOCK_DIRT:
+ case E_BLOCK_GRASS:
+ case E_BLOCK_FARMLAND:
+ case E_BLOCK_SAND:
+ {
+ return a_World->IsBlockDirectlyWatered(a_X, a_Y - 1, a_Z);
+ }
+ case E_BLOCK_SUGARCANE:
+ {
+ return true;
+ }
+ }
+ return false;
}
- void OnUpdate(cWorld *a_World, int a_X, int a_Y, int a_Z) override
+
+ void OnUpdate(cWorld * a_World, int a_X, int a_Y, int a_Z) override
{
-
//TODO: Handle Growing here
}
+
virtual bool CanBePlacedOnSide() override
{
return false;
}
-};
\ No newline at end of file +
+};
+
+
+
+
|