summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-12-07 19:03:56 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-12-07 19:03:56 +0100
commit5bed85aba0720dc22db56dcaec28675c189491c4 (patch)
tree0b48aac460633e5d0410acf45f591c08ae51ce11 /src
parentChanged some FastSetBlocks to SetBlock (diff)
downloadcuberite-5bed85aba0720dc22db56dcaec28675c189491c4.tar
cuberite-5bed85aba0720dc22db56dcaec28675c189491c4.tar.gz
cuberite-5bed85aba0720dc22db56dcaec28675c189491c4.tar.bz2
cuberite-5bed85aba0720dc22db56dcaec28675c189491c4.tar.lz
cuberite-5bed85aba0720dc22db56dcaec28675c189491c4.tar.xz
cuberite-5bed85aba0720dc22db56dcaec28675c189491c4.tar.zst
cuberite-5bed85aba0720dc22db56dcaec28675c189491c4.zip
Diffstat (limited to 'src')
-rw-r--r--src/Blocks/BlockHandler.cpp2
-rw-r--r--src/Blocks/BlockPiston.h6
-rw-r--r--src/Blocks/BlockRedstoneLamp.h27
-rw-r--r--src/Piston.cpp3
4 files changed, 37 insertions, 1 deletions
diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp
index 4a6d49449..43f9eda37 100644
--- a/src/Blocks/BlockHandler.cpp
+++ b/src/Blocks/BlockHandler.cpp
@@ -48,6 +48,7 @@
#include "BlockPumpkin.h"
#include "BlockRail.h"
#include "BlockRedstone.h"
+#include "BlockRedstoneLamp.h"
#include "BlockRedstoneRepeater.h"
#include "BlockRedstoneTorch.h"
#include "BlockSand.h"
@@ -171,6 +172,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
case E_BLOCK_RAIL: return new cBlockRailHandler (a_BlockType);
case E_BLOCK_REDSTONE_ORE: return new cBlockOreHandler (a_BlockType);
case E_BLOCK_REDSTONE_ORE_GLOWING: return new cBlockOreHandler (a_BlockType);
+ case E_BLOCK_REDSTONE_LAMP_ON: return new cBlockRedstoneLampHandler (a_BlockType);
case E_BLOCK_REDSTONE_REPEATER_OFF: return new cBlockRedstoneRepeaterHandler(a_BlockType);
case E_BLOCK_REDSTONE_REPEATER_ON: return new cBlockRedstoneRepeaterHandler(a_BlockType);
case E_BLOCK_REDSTONE_TORCH_OFF: return new cBlockRedstoneTorchHandler (a_BlockType);
diff --git a/src/Blocks/BlockPiston.h b/src/Blocks/BlockPiston.h
index 109f5ea8b..36fa6a572 100644
--- a/src/Blocks/BlockPiston.h
+++ b/src/Blocks/BlockPiston.h
@@ -36,6 +36,12 @@ public:
cBlockPistonHeadHandler(void);
virtual void OnDestroyedByPlayer(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override;
+
+ virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
+ {
+ // No pickups
+ // Also with 1.7, the item forms of these tecnical blocks have been removed, so giving someone this will crash their client...
+ }
} ;
diff --git a/src/Blocks/BlockRedstoneLamp.h b/src/Blocks/BlockRedstoneLamp.h
new file mode 100644
index 000000000..69a2b27c2
--- /dev/null
+++ b/src/Blocks/BlockRedstoneLamp.h
@@ -0,0 +1,27 @@
+
+#pragma once
+
+#include "BlockHandler.h"
+
+
+
+
+
+class cBlockRedstoneLampHandler :
+ public cBlockHandler
+{
+public:
+ cBlockRedstoneLampHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
+ {
+ }
+
+ virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
+ {
+ a_Pickups.push_back(cItem(E_BLOCK_REDSTONE_LAMP_OFF, 1, 0));
+ }
+};
+
+
+
+
diff --git a/src/Piston.cpp b/src/Piston.cpp
index 63ffbad0b..b893af73a 100644
--- a/src/Piston.cpp
+++ b/src/Piston.cpp
@@ -113,7 +113,7 @@ void cPiston::ExtendPiston(int pistx, int pisty, int pistz)
AddDir(pistx, pisty, pistz, pistonMeta, -1);
// "pist" now at piston body, "ext" at future extension
- m_World->SetBlock( pistx, pisty, pistz, pistonBlock, pistonMeta | 0x8);
+ m_World->SetBlock(pistx, pisty, pistz, pistonBlock, pistonMeta | 0x8);
m_World->QueueSetBlock(extx, exty, extz, E_BLOCK_PISTON_EXTENSION, pistonMeta | (IsSticky(pistonBlock) ? 8 : 0), PISTON_TICK_DELAY);
}
@@ -126,6 +126,7 @@ void cPiston::RetractPiston(int pistx, int pisty, int pistz)
BLOCKTYPE pistonBlock;
NIBBLETYPE pistonMeta;
m_World->GetBlockTypeMeta(pistx, pisty, pistz, pistonBlock, pistonMeta);
+
if (!IsExtended(pistonMeta))
{
// Already retracted, bail out