From b35771ca0d7faa6572025f8e9e61007df498e14c Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Tue, 20 Aug 2013 22:47:10 +0100 Subject: [PATCH] Fixed broken carpet handler [SEE DESC] Made BlockHandler pass on control to carpet handler Declared thinggummies in carpet handler Fixed carpet block pushback using incorrect format --- source/Blocks/BlockCarpet.h | 12 +++++++++--- source/Blocks/BlockHandler.cpp | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/source/Blocks/BlockCarpet.h b/source/Blocks/BlockCarpet.h index f70ff45b6..9ac998131 100644 --- a/source/Blocks/BlockCarpet.h +++ b/source/Blocks/BlockCarpet.h @@ -8,6 +8,8 @@ #pragma once +#include "BlockHandler.h" + @@ -16,7 +18,11 @@ class cBlockCarpetHandler : public cBlockHandler { public: - cBlockCarpetHandler(BLOCKTYPE a_BlockType); + cBlockCarpetHandler(BLOCKTYPE a_BlockType) + : cBlockHandler(a_BlockType) + { + } + virtual const char * GetStepSound(void) override { @@ -39,13 +45,13 @@ public: virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { - a_Pickups.push_back(cItem(E_BLOCK_CARPET, a_BlockMeta)); + a_Pickups.push_back(cItem(E_BLOCK_CARPET, 1, a_BlockMeta)); } virtual bool CanBeAt(int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override { - return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) != E_BLOCK_AIR)); + return (a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) != E_BLOCK_AIR); } } ; diff --git a/source/Blocks/BlockHandler.cpp b/source/Blocks/BlockHandler.cpp index 6584eeed4..0fa013058 100644 --- a/source/Blocks/BlockHandler.cpp +++ b/source/Blocks/BlockHandler.cpp @@ -104,6 +104,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_BROWN_MUSHROOM: return new cBlockMushroomHandler (a_BlockType); case E_BLOCK_CACTUS: return new cBlockCactusHandler (a_BlockType); case E_BLOCK_CARROTS: return new cBlockCropsHandler (a_BlockType); + case E_BLOCK_CARPET: return new cBlockCarpetHandler (a_BlockType); case E_BLOCK_CAULDRON: return new cBlockCauldronHandler (a_BlockType); case E_BLOCK_CHEST: return new cBlockChestHandler (a_BlockType); case E_BLOCK_COAL_ORE: return new cBlockOreHandler (a_BlockType);