This renames the cBlockWoodHandler to cBlockSidewaysHandler, and implements a new cBlockQuartzHandler to handle the quartz pillars.
This commit is contained in:
parent
c9916cd8c2
commit
5ba46ebc21
@ -49,6 +49,7 @@
|
|||||||
#include "BlockPlanks.h"
|
#include "BlockPlanks.h"
|
||||||
#include "BlockPortal.h"
|
#include "BlockPortal.h"
|
||||||
#include "BlockPumpkin.h"
|
#include "BlockPumpkin.h"
|
||||||
|
#include "BlockQuartz.h"
|
||||||
#include "BlockRail.h"
|
#include "BlockRail.h"
|
||||||
#include "BlockRedstone.h"
|
#include "BlockRedstone.h"
|
||||||
#include "BlockRedstoneLamp.h"
|
#include "BlockRedstoneLamp.h"
|
||||||
@ -56,6 +57,7 @@
|
|||||||
#include "BlockRedstoneTorch.h"
|
#include "BlockRedstoneTorch.h"
|
||||||
#include "BlockSand.h"
|
#include "BlockSand.h"
|
||||||
#include "BlockSapling.h"
|
#include "BlockSapling.h"
|
||||||
|
#include "BlockSideways.h"
|
||||||
#include "BlockSign.h"
|
#include "BlockSign.h"
|
||||||
#include "BlockSlab.h"
|
#include "BlockSlab.h"
|
||||||
#include "BlockSnow.h"
|
#include "BlockSnow.h"
|
||||||
@ -67,7 +69,6 @@
|
|||||||
#include "BlockTorch.h"
|
#include "BlockTorch.h"
|
||||||
#include "BlockTrapdoor.h"
|
#include "BlockTrapdoor.h"
|
||||||
#include "BlockVine.h"
|
#include "BlockVine.h"
|
||||||
#include "BlockWood.h"
|
|
||||||
#include "BlockWorkbench.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_GLASS: return new cBlockGlassHandler (a_BlockType);
|
||||||
case E_BLOCK_GRASS: return new cBlockDirtHandler (a_BlockType);
|
case E_BLOCK_GRASS: return new cBlockDirtHandler (a_BlockType);
|
||||||
case E_BLOCK_GRAVEL: return new cBlockGravelHandler (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_HOPPER: return new cBlockHopperHandler (a_BlockType);
|
||||||
case E_BLOCK_ICE: return new cBlockIceHandler (a_BlockType);
|
case E_BLOCK_ICE: return new cBlockIceHandler (a_BlockType);
|
||||||
case E_BLOCK_INACTIVE_COMPARATOR: return new cBlockComparatorHandler (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_LAVA: return new cBlockLavaHandler (a_BlockType);
|
||||||
case E_BLOCK_LEAVES: return new cBlockLeavesHandler (a_BlockType);
|
case E_BLOCK_LEAVES: return new cBlockLeavesHandler (a_BlockType);
|
||||||
case E_BLOCK_LIT_FURNACE: return new cBlockFurnaceHandler (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: return new cBlockMelonHandler (a_BlockType);
|
||||||
case E_BLOCK_MELON_STEM: return new cBlockStemsHandler (a_BlockType);
|
case E_BLOCK_MELON_STEM: return new cBlockStemsHandler (a_BlockType);
|
||||||
case E_BLOCK_MYCELIUM: return new cBlockMyceliumHandler (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_BRICK_STAIRS: return new cBlockStairsHandler (a_BlockType);
|
||||||
case E_BLOCK_NETHER_PORTAL: return new cBlockPortalHandler (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_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_NOTE_BLOCK: return new cBlockNoteHandler (a_BlockType);
|
||||||
case E_BLOCK_PISTON: return new cBlockPistonHandler (a_BlockType);
|
case E_BLOCK_PISTON: return new cBlockPistonHandler (a_BlockType);
|
||||||
case E_BLOCK_PISTON_EXTENSION: return new cBlockPistonHeadHandler ( );
|
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_POWERED_RAIL: return new cBlockRailHandler (a_BlockType);
|
||||||
case E_BLOCK_PUMPKIN: return new cBlockPumpkinHandler (a_BlockType);
|
case E_BLOCK_PUMPKIN: return new cBlockPumpkinHandler (a_BlockType);
|
||||||
case E_BLOCK_PUMPKIN_STEM: return new cBlockStemsHandler (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_QUARTZ_STAIRS: return new cBlockStairsHandler (a_BlockType);
|
||||||
case E_BLOCK_RAIL: return new cBlockRailHandler (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
|
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
|
||||||
|
66
src/Blocks/BlockQuartz.h
Normal file
66
src/Blocks/BlockQuartz.h
Normal file
@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} ;
|
@ -7,10 +7,10 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class cBlockWoodHandler : public cBlockHandler
|
class cBlockSidewaysHandler : public cBlockHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cBlockWoodHandler(BLOCKTYPE a_BlockType)
|
cBlockSidewaysHandler(BLOCKTYPE a_BlockType)
|
||||||
: cBlockHandler(a_BlockType)
|
: cBlockHandler(a_BlockType)
|
||||||
{
|
{
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user