diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-12-07 19:03:56 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-12-07 19:03:56 +0100 |
commit | 5bed85aba0720dc22db56dcaec28675c189491c4 (patch) | |
tree | 0b48aac460633e5d0410acf45f591c08ae51ce11 | |
parent | Changed some FastSetBlocks to SetBlock (diff) | |
download | cuberite-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 |
-rw-r--r-- | VC2013/MCServer.vcxproj | 1 | ||||
-rw-r--r-- | VC2013/MCServer.vcxproj.filters | 3 | ||||
-rw-r--r-- | src/Blocks/BlockHandler.cpp | 2 | ||||
-rw-r--r-- | src/Blocks/BlockPiston.h | 6 | ||||
-rw-r--r-- | src/Blocks/BlockRedstoneLamp.h | 27 | ||||
-rw-r--r-- | src/Piston.cpp | 3 |
6 files changed, 41 insertions, 1 deletions
diff --git a/VC2013/MCServer.vcxproj b/VC2013/MCServer.vcxproj index 098253ac3..07e1ffb4a 100644 --- a/VC2013/MCServer.vcxproj +++ b/VC2013/MCServer.vcxproj @@ -225,6 +225,7 @@ </ItemGroup> <ItemGroup> <ClInclude Include="..\src\BlockEntities\EnderChestEntity.h" /> + <ClInclude Include="..\src\Blocks\BlockRedstoneLamp.h" /> <ClInclude Include="resource_MCServer.h" /> <ClInclude Include="..\src\Authenticator.h" /> <ClInclude Include="..\src\BlockArea.h" /> diff --git a/VC2013/MCServer.vcxproj.filters b/VC2013/MCServer.vcxproj.filters index 4e22f5517..2f0794e85 100644 --- a/VC2013/MCServer.vcxproj.filters +++ b/VC2013/MCServer.vcxproj.filters @@ -948,6 +948,9 @@ <ClInclude Include="..\src\BlockEntities\EnderChestEntity.h"> <Filter>Source Files\BlockEntities</Filter> </ClInclude> + <ClInclude Include="..\src\Blocks\BlockRedstoneLamp.h"> + <Filter>Source Files\Blocks</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <None Include="..\webadmin\template.html"> 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 |