summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockRedstoneOre.h
diff options
context:
space:
mode:
authorPeter Bell <peterbell10@live.co.uk>2020-04-16 23:35:49 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-04-17 00:49:33 +0200
commit96bd4637d7d89e414da57973f729f9b10cbb6557 (patch)
treea783fda34dd5dc8b2ffa885568442a6d25fbae09 /src/Blocks/BlockRedstoneOre.h
parentಠ_ಠ (#4660) (diff)
downloadcuberite-96bd4637d7d89e414da57973f729f9b10cbb6557.tar
cuberite-96bd4637d7d89e414da57973f729f9b10cbb6557.tar.gz
cuberite-96bd4637d7d89e414da57973f729f9b10cbb6557.tar.bz2
cuberite-96bd4637d7d89e414da57973f729f9b10cbb6557.tar.lz
cuberite-96bd4637d7d89e414da57973f729f9b10cbb6557.tar.xz
cuberite-96bd4637d7d89e414da57973f729f9b10cbb6557.tar.zst
cuberite-96bd4637d7d89e414da57973f729f9b10cbb6557.zip
Diffstat (limited to '')
-rw-r--r--src/Blocks/BlockRedstoneOre.h79
1 files changed, 79 insertions, 0 deletions
diff --git a/src/Blocks/BlockRedstoneOre.h b/src/Blocks/BlockRedstoneOre.h
new file mode 100644
index 000000000..cb6f73733
--- /dev/null
+++ b/src/Blocks/BlockRedstoneOre.h
@@ -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);
+ }
+};
+
+
+
+
+