Implement glowing redstone ore
This commit is contained in:
parent
ede56a5750
commit
96bd4637d7
@ -68,6 +68,7 @@
|
|||||||
#include "BlockRail.h"
|
#include "BlockRail.h"
|
||||||
#include "BlockRedstone.h"
|
#include "BlockRedstone.h"
|
||||||
#include "BlockRedstoneLamp.h"
|
#include "BlockRedstoneLamp.h"
|
||||||
|
#include "BlockRedstoneOre.h"
|
||||||
#include "BlockRedstoneRepeater.h"
|
#include "BlockRedstoneRepeater.h"
|
||||||
#include "BlockRedstoneTorch.h"
|
#include "BlockRedstoneTorch.h"
|
||||||
#include "BlockTNT.h"
|
#include "BlockTNT.h"
|
||||||
@ -328,8 +329,8 @@ static cBlockHandler * CreateBlockHandler(BLOCKTYPE 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);
|
case E_BLOCK_REDSTONE_LAMP_ON: return new cBlockRedstoneLampHandler (a_BlockType);
|
||||||
case E_BLOCK_REDSTONE_ORE: return new cBlockOreHandler (a_BlockType);
|
case E_BLOCK_REDSTONE_ORE: return new cBlockRedstoneOreHandler (a_BlockType);
|
||||||
case E_BLOCK_REDSTONE_ORE_GLOWING: return new cBlockOreHandler (a_BlockType);
|
case E_BLOCK_REDSTONE_ORE_GLOWING: return new cBlockGlowingRedstoneOreHandler(a_BlockType);
|
||||||
case E_BLOCK_REDSTONE_REPEATER_OFF: return new cBlockRedstoneRepeaterHandler (a_BlockType);
|
case E_BLOCK_REDSTONE_REPEATER_OFF: return new cBlockRedstoneRepeaterHandler (a_BlockType);
|
||||||
case E_BLOCK_REDSTONE_REPEATER_ON: return new cBlockRedstoneRepeaterHandler (a_BlockType);
|
case E_BLOCK_REDSTONE_REPEATER_ON: return new cBlockRedstoneRepeaterHandler (a_BlockType);
|
||||||
case E_BLOCK_REDSTONE_TORCH_OFF: return new cBlockRedstoneTorchHandler (a_BlockType);
|
case E_BLOCK_REDSTONE_TORCH_OFF: return new cBlockRedstoneTorchHandler (a_BlockType);
|
||||||
|
79
src/Blocks/BlockRedstoneOre.h
Normal file
79
src/Blocks/BlockRedstoneOre.h
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "BlockHandler.h"
|
||||||
|
#include "BlockOre.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class cBlockRedstoneOreHandler :
|
||||||
|
public cBlockOreHandler
|
||||||
|
{
|
||||||
|
using Super = cBlockOreHandler;
|
||||||
|
public:
|
||||||
|
|
||||||
|
using Super::Super;
|
||||||
|
|
||||||
|
virtual bool OnUse(
|
||||||
|
cChunkInterface & a_ChunkInterface,
|
||||||
|
cWorldInterface & a_WorldInterface,
|
||||||
|
cPlayer & a_Player,
|
||||||
|
int a_BlockX, int a_BlockY, int a_BlockZ,
|
||||||
|
eBlockFace a_BlockFace,
|
||||||
|
int a_CursorX, int a_CursorY, int a_CursorZ
|
||||||
|
) override
|
||||||
|
{
|
||||||
|
Vector3i BlockPos{a_BlockX, a_BlockY, a_BlockZ};
|
||||||
|
a_ChunkInterface.SetBlock(BlockPos, E_BLOCK_REDSTONE_ORE_GLOWING, 0);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void OnDigging(
|
||||||
|
cChunkInterface & a_ChunkInterface,
|
||||||
|
cWorldInterface & a_WorldInterface,
|
||||||
|
cPlayer & a_Player,
|
||||||
|
int a_BlockX, int a_BlockY, int a_BlockZ
|
||||||
|
) override
|
||||||
|
{
|
||||||
|
Vector3i BlockPos{a_BlockX, a_BlockY, a_BlockZ};
|
||||||
|
a_ChunkInterface.SetBlock(BlockPos, E_BLOCK_REDSTONE_ORE_GLOWING, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool IsUseable() override
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class cBlockGlowingRedstoneOreHandler:
|
||||||
|
public cBlockOreHandler
|
||||||
|
{
|
||||||
|
using Super = cBlockOreHandler;
|
||||||
|
public:
|
||||||
|
|
||||||
|
using Super::Super;
|
||||||
|
|
||||||
|
virtual void OnUpdate(
|
||||||
|
cChunkInterface & a_ChunkInterface,
|
||||||
|
cWorldInterface & a_WorldInterface,
|
||||||
|
cBlockPluginInterface & a_BlockPluginInterface,
|
||||||
|
cChunk & a_Chunk,
|
||||||
|
int a_RelX, int a_RelY, int a_RelZ
|
||||||
|
) override
|
||||||
|
{
|
||||||
|
const Vector3i a_RelPos{a_RelX, a_RelY, a_RelZ};
|
||||||
|
auto BlockPos = a_Chunk.RelativeToAbsolute(a_RelPos);
|
||||||
|
a_ChunkInterface.SetBlock(BlockPos, E_BLOCK_REDSTONE_ORE, 0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user