From 2006de22170d40666fc8437829a10a79556f55bf Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sat, 6 Apr 2013 18:20:06 +0000 Subject: [PATCH] Cobwebs are now washed away by water and can be broken by swords and shears, giving string. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1363 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- VC2008/MCServer.vcproj | 4 ++++ source/Blocks/BlockCobWeb.h | 30 +++++++++++++++++++++++++++++ source/Blocks/BlockHandler.cpp | 2 ++ source/Items/ItemShears.h | 2 +- source/Items/ItemSword.h | 2 +- source/Simulator/FluidSimulator.cpp | 1 + 6 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 source/Blocks/BlockCobWeb.h diff --git a/VC2008/MCServer.vcproj b/VC2008/MCServer.vcproj index 7fba7ec31..3908d73d4 100644 --- a/VC2008/MCServer.vcproj +++ b/VC2008/MCServer.vcproj @@ -1810,6 +1810,10 @@ RelativePath="..\source\blocks\BlockCloth.h" > + + diff --git a/source/Blocks/BlockCobWeb.h b/source/Blocks/BlockCobWeb.h new file mode 100644 index 000000000..86bb6e773 --- /dev/null +++ b/source/Blocks/BlockCobWeb.h @@ -0,0 +1,30 @@ + +// BlockCobWeb.h + +// Declares the cBlockCobWebHandler object representing the BlockHandler for cobwebs + +#pragma once + + + + + +class cBlockCobWebHandler : + public cBlockHandler +{ +public: + cBlockCobWebHandler(BLOCKTYPE a_BlockType) + : cBlockHandler(a_BlockType) + { + } + + + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_Meta) override + { + a_Pickups.push_back(cItem(E_ITEM_STRING, 1, 0)); + } +} ; + + + + diff --git a/source/Blocks/BlockHandler.cpp b/source/Blocks/BlockHandler.cpp index 0a6334e15..51051b7a6 100644 --- a/source/Blocks/BlockHandler.cpp +++ b/source/Blocks/BlockHandler.cpp @@ -55,6 +55,7 @@ #include "BlockFlowerPot.h" #include "BlockCauldron.h" #include "BlockBrewingStand.h" +#include "BlockCobWeb.h" @@ -104,6 +105,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_COAL_ORE: return new cBlockOreHandler (a_BlockType); case E_BLOCK_COBBLESTONE: return new cBlockStoneHandler (a_BlockType); case E_BLOCK_COBBLESTONE_STAIRS: return new cBlockStairsHandler (a_BlockType); + case E_BLOCK_COBWEB: return new cBlockCobWebHandler (a_BlockType); case E_BLOCK_CROPS: return new cBlockCropsHandler (a_BlockType); case E_BLOCK_DIAMOND_ORE: return new cBlockOreHandler (a_BlockType); case E_BLOCK_DIRT: return new cBlockDirtHandler (a_BlockType); diff --git a/source/Items/ItemShears.h b/source/Items/ItemShears.h index f1424ee2e..dbdfeff5d 100644 --- a/source/Items/ItemShears.h +++ b/source/Items/ItemShears.h @@ -53,7 +53,7 @@ public: { return true; } - } // switch (a_BlockType + } // switch (a_BlockType) return false; } } ; diff --git a/source/Items/ItemSword.h b/source/Items/ItemSword.h index 327c39a40..37b9ef32d 100644 --- a/source/Items/ItemSword.h +++ b/source/Items/ItemSword.h @@ -16,6 +16,6 @@ public: virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override { - return a_BlockType == E_BLOCK_COBWEB; + return (a_BlockType == E_BLOCK_COBWEB); } }; \ No newline at end of file diff --git a/source/Simulator/FluidSimulator.cpp b/source/Simulator/FluidSimulator.cpp index df86ef6fc..dac666484 100644 --- a/source/Simulator/FluidSimulator.cpp +++ b/source/Simulator/FluidSimulator.cpp @@ -34,6 +34,7 @@ bool cFluidSimulator::CanWashAway(BLOCKTYPE a_BlockType) { case E_BLOCK_BROWN_MUSHROOM: case E_BLOCK_CACTUS: + case E_BLOCK_COBWEB: case E_BLOCK_CROPS: case E_BLOCK_DEAD_BUSH: case E_BLOCK_RAIL: