1
0

Added the Carpet block.

This commit is contained in:
madmaxoft 2013-08-05 10:43:43 +02:00
parent f660475905
commit 073bcd0361
6 changed files with 113 additions and 49 deletions

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
@ -1832,6 +1832,10 @@
RelativePath="..\source\blocks\BlockCactus.h"
>
</File>
<File
RelativePath="..\source\Blocks\BlockCarpet.h"
>
</File>
<File
RelativePath="..\source\Blocks\BlockCauldron.h"
>

View File

@ -169,6 +169,8 @@ enum ENUM_BLOCK_ID
E_BLOCK_DROPPER = 158,
E_BLOCK_CARPET = 171,
// Keep these two as the last values, without a number - they will get their correct number assigned automagically by C++
// IsValidBlock() depends on this
E_BLOCK_NUMBER_OF_TYPES, ///< Number of individual (different) blocktypes

View File

@ -0,0 +1,54 @@
// BlockCarpet.h
// Declares the cBlockCarpetHandler class representing the handler for the carpet block
#pragma once
class cBlockCarpetHandler :
public cBlockHandler
{
public:
cBlockCarpetHandler(BLOCKTYPE a_BlockType);
virtual const char * GetStepSound(void) override
{
return "step.cloth";
}
virtual bool GetPlacementBlockTypeMeta(
cWorld * a_World, 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;
a_BlockMeta = a_Player->GetEquippedItem().m_ItemDamage & 0x0f;
return true;
}
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
a_Pickups.push_back(cItem(E_BLOCK_CARPET, 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));
}
} ;

View File

@ -3,6 +3,7 @@
#include "BlockEntity.h"
#include "../World.h"
#include "../BlockArea.h"
#include "../Player.h"

View File

@ -5,6 +5,8 @@
#pragma once
#include "../Piston.h"

View File

@ -5,59 +5,60 @@
#include "../World.h"
#include "../Root.h"
#include "../PluginManager.h"
#include "BlockSand.h"
#include "BlockGravel.h"
#include "BlockDoor.h"
#include "BlockFire.h"
#include "BlockRedstone.h"
#include "BlockRedstoneTorch.h"
#include "BlockRedstoneRepeater.h"
#include "BlockPiston.h"
#include "BlockWorkbench.h"
#include "BlockEntity.h"
#include "BlockVine.h"
#include "BlockTallGrass.h"
#include "BlockSnow.h"
#include "BlockCloth.h"
#include "BlockSlab.h"
#include "BlockDirt.h"
#include "BlockTorch.h"
#include "BlockWood.h"
#include "BlockLeaves.h"
#include "BlockSapling.h"
#include "BlockFluid.h"
#include "BlockChest.h"
#include "BlockFurnace.h"
#include "BlockDropSpenser.h"
#include "BlockStairs.h"
#include "BlockLadder.h"
#include "BlockLever.h"
#include "BlockSign.h"
#include "BlockCrops.h"
#include "BlockSugarcane.h"
#include "BlockFlower.h"
#include "BlockMushroom.h"
#include "BlockCactus.h"
#include "BlockStems.h"
#include "BlockGlowstone.h"
#include "BlockStone.h"
#include "BlockMelon.h"
#include "BlockIce.h"
#include "BlockOre.h"
#include "BlockNote.h"
#include "BlockBed.h"
#include "BlockFarmland.h"
#include "BlockMycelium.h"
#include "BlockRail.h"
#include "BlockGlass.h"
#include "BlockEnderchest.h"
#include "BlockFenceGate.h"
#include "BlockFlowerPot.h"
#include "BlockCauldron.h"
#include "BlockBrewingStand.h"
#include "BlockCactus.h"
#include "BlockCarpet.h"
#include "BlockCauldron.h"
#include "BlockChest.h"
#include "BlockCloth.h"
#include "BlockCobWeb.h"
#include "BlockCrops.h"
#include "BlockDeadBush.h"
#include "BlockDirt.h"
#include "BlockDoor.h"
#include "BlockDropSpenser.h"
#include "BlockEnderchest.h"
#include "BlockEntity.h"
#include "BlockFarmland.h"
#include "BlockFenceGate.h"
#include "BlockFire.h"
#include "BlockFlower.h"
#include "BlockFlowerPot.h"
#include "BlockFluid.h"
#include "BlockFurnace.h"
#include "BlockGlass.h"
#include "BlockGlowstone.h"
#include "BlockGravel.h"
#include "BlockHopper.h"
#include "BlockIce.h"
#include "BlockLadder.h"
#include "BlockLeaves.h"
#include "BlockLever.h"
#include "BlockMelon.h"
#include "BlockMushroom.h"
#include "BlockMycelium.h"
#include "BlockNote.h"
#include "BlockOre.h"
#include "BlockPiston.h"
#include "BlockRail.h"
#include "BlockRedstone.h"
#include "BlockRedstoneRepeater.h"
#include "BlockRedstoneTorch.h"
#include "BlockSand.h"
#include "BlockSapling.h"
#include "BlockSign.h"
#include "BlockSlab.h"
#include "BlockSnow.h"
#include "BlockStairs.h"
#include "BlockStems.h"
#include "BlockStone.h"
#include "BlockSugarcane.h"
#include "BlockTallGrass.h"
#include "BlockTorch.h"
#include "BlockVine.h"
#include "BlockWood.h"
#include "BlockWorkbench.h"