summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSTRWarrior <niels.breuker@hotmail.nl>2014-02-03 20:08:38 +0100
committerSTRWarrior <niels.breuker@hotmail.nl>2014-02-03 20:08:38 +0100
commit5ba46ebc21714c7398e7c1a14e81cb0f00c3f348 (patch)
treef7895e582c20426908ea9b7b39f7a26991041251
parentFixed socket leaking. (diff)
downloadcuberite-5ba46ebc21714c7398e7c1a14e81cb0f00c3f348.tar
cuberite-5ba46ebc21714c7398e7c1a14e81cb0f00c3f348.tar.gz
cuberite-5ba46ebc21714c7398e7c1a14e81cb0f00c3f348.tar.bz2
cuberite-5ba46ebc21714c7398e7c1a14e81cb0f00c3f348.tar.lz
cuberite-5ba46ebc21714c7398e7c1a14e81cb0f00c3f348.tar.xz
cuberite-5ba46ebc21714c7398e7c1a14e81cb0f00c3f348.tar.zst
cuberite-5ba46ebc21714c7398e7c1a14e81cb0f00c3f348.zip
-rw-r--r--src/Blocks/BlockHandler.cpp9
-rw-r--r--src/Blocks/BlockQuartz.h66
-rw-r--r--src/Blocks/BlockSideways.h (renamed from src/Blocks/BlockWood.h)4
3 files changed, 74 insertions, 5 deletions
diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp
index c16f255b8..3ecf0d7e2 100644
--- a/src/Blocks/BlockHandler.cpp
+++ b/src/Blocks/BlockHandler.cpp
@@ -49,6 +49,7 @@
#include "BlockPlanks.h"
#include "BlockPortal.h"
#include "BlockPumpkin.h"
+#include "BlockQuartz.h"
#include "BlockRail.h"
#include "BlockRedstone.h"
#include "BlockRedstoneLamp.h"
@@ -56,6 +57,7 @@
#include "BlockRedstoneTorch.h"
#include "BlockSand.h"
#include "BlockSapling.h"
+#include "BlockSideways.h"
#include "BlockSign.h"
#include "BlockSlab.h"
#include "BlockSnow.h"
@@ -67,7 +69,6 @@
#include "BlockTorch.h"
#include "BlockTrapdoor.h"
#include "BlockVine.h"
-#include "BlockWood.h"
#include "BlockWorkbench.h"
@@ -144,6 +145,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
case E_BLOCK_GLASS: return new cBlockGlassHandler (a_BlockType);
case E_BLOCK_GRASS: return new cBlockDirtHandler (a_BlockType);
case E_BLOCK_GRAVEL: return new cBlockGravelHandler (a_BlockType);
+ case E_BLOCK_HAY_BALE: return new cBlockSidewaysHandler (a_BlockType);
case E_BLOCK_HOPPER: return new cBlockHopperHandler (a_BlockType);
case E_BLOCK_ICE: return new cBlockIceHandler (a_BlockType);
case E_BLOCK_INACTIVE_COMPARATOR: return new cBlockComparatorHandler (a_BlockType);
@@ -158,14 +160,14 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
case E_BLOCK_LAVA: return new cBlockLavaHandler (a_BlockType);
case E_BLOCK_LEAVES: return new cBlockLeavesHandler (a_BlockType);
case E_BLOCK_LIT_FURNACE: return new cBlockFurnaceHandler (a_BlockType);
- case E_BLOCK_LOG: return new cBlockWoodHandler (a_BlockType);
+ case E_BLOCK_LOG: return new cBlockSidewaysHandler (a_BlockType);
case E_BLOCK_MELON: return new cBlockMelonHandler (a_BlockType);
case E_BLOCK_MELON_STEM: return new cBlockStemsHandler (a_BlockType);
case E_BLOCK_MYCELIUM: return new cBlockMyceliumHandler (a_BlockType);
case E_BLOCK_NETHER_BRICK_STAIRS: return new cBlockStairsHandler (a_BlockType);
case E_BLOCK_NETHER_PORTAL: return new cBlockPortalHandler (a_BlockType);
case E_BLOCK_NETHER_WART: return new cBlockNetherWartHandler (a_BlockType);
- case E_BLOCK_NEW_LOG: return new cBlockWoodHandler (a_BlockType);
+ case E_BLOCK_NEW_LOG: return new cBlockSidewaysHandler (a_BlockType);
case E_BLOCK_NOTE_BLOCK: return new cBlockNoteHandler (a_BlockType);
case E_BLOCK_PISTON: return new cBlockPistonHandler (a_BlockType);
case E_BLOCK_PISTON_EXTENSION: return new cBlockPistonHeadHandler ( );
@@ -174,6 +176,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
case E_BLOCK_POWERED_RAIL: return new cBlockRailHandler (a_BlockType);
case E_BLOCK_PUMPKIN: return new cBlockPumpkinHandler (a_BlockType);
case E_BLOCK_PUMPKIN_STEM: return new cBlockStemsHandler (a_BlockType);
+ case E_BLOCK_QUARTZ_BLOCK: return new cBlockQuartsHandler (a_BlockType);
case E_BLOCK_QUARTZ_STAIRS: return new cBlockStairsHandler (a_BlockType);
case E_BLOCK_RAIL: return new cBlockRailHandler (a_BlockType);
case E_BLOCK_REDSTONE_LAMP_ON: return new cBlockRedstoneLampHandler (a_BlockType); // We need this to change pickups to an off lamp; else 1.7+ clients crash
diff --git a/src/Blocks/BlockQuartz.h b/src/Blocks/BlockQuartz.h
new file mode 100644
index 000000000..a01abac7b
--- /dev/null
+++ b/src/Blocks/BlockQuartz.h
@@ -0,0 +1,66 @@
+
+#pragma once
+
+#include "BlockHandler.h"
+
+
+
+
+
+class cBlockQuartsHandler : public cBlockHandler
+{
+public:
+ cBlockQuartsHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
+ {
+ }
+
+
+ virtual bool GetPlacementBlockTypeMeta(
+ cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
+ int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
+ int a_CursorX, int a_CursorY, int a_CursorZ,
+ BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
+ ) override
+ {
+ a_BlockType = m_BlockType;
+ NIBBLETYPE Meta = (NIBBLETYPE)(a_Player->GetEquippedItem().m_ItemDamage);
+ if (Meta != 0x2) // Check if the block is a pillar block.
+ {
+ return false;
+ }
+
+ a_BlockMeta = BlockFaceToMetaData(a_BlockFace, Meta);
+ return true;
+ }
+
+ inline static NIBBLETYPE BlockFaceToMetaData(char a_BlockFace, NIBBLETYPE a_QuartzMeta)
+ {
+ switch (a_BlockFace)
+ {
+ case BLOCK_FACE_YM:
+ case BLOCK_FACE_YP:
+ {
+ return a_QuartzMeta; // Top or bottom, just return original
+ }
+
+ case BLOCK_FACE_ZP:
+ case BLOCK_FACE_ZM:
+ {
+ return 0x4; // North or south
+ }
+
+ case BLOCK_FACE_XP:
+ case BLOCK_FACE_XM:
+ {
+ return 0x3; // East or west
+ }
+
+ default:
+ {
+ ASSERT(!"Unhandled block face!");
+ return a_QuartzMeta; // No idea, give a special meta (all sides the sa)
+ }
+ }
+ }
+} ; \ No newline at end of file
diff --git a/src/Blocks/BlockWood.h b/src/Blocks/BlockSideways.h
index cf49d0745..f11f0bee1 100644
--- a/src/Blocks/BlockWood.h
+++ b/src/Blocks/BlockSideways.h
@@ -7,10 +7,10 @@
-class cBlockWoodHandler : public cBlockHandler
+class cBlockSidewaysHandler : public cBlockHandler
{
public:
- cBlockWoodHandler(BLOCKTYPE a_BlockType)
+ cBlockSidewaysHandler(BLOCKTYPE a_BlockType)
: cBlockHandler(a_BlockType)
{
}