summaryrefslogtreecommitdiffstats
path: root/src/BlockInServerPluginInterface.h
blob: ca89f33d0e36db6f7ad19cfd458555ee992169b0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

// BlockInServerPluginInterface.h

// Defines the cBlockInServerPluginInterface class that implements the cBlockPluginInterface for blocks, using the
// plugin manager





#pragma once

#include "Blocks/BlockPluginInterface.h"
#include "Bindings/PluginManager.h"


class cWorld;


class cBlockInServerPluginInterface : public cBlockPluginInterface
{
  public:
	cBlockInServerPluginInterface(cWorld & a_World) :
		m_World(a_World)
	{
	}

	virtual bool CallHookBlockSpread(Vector3i a_BlockPos, eSpreadSource a_Source) override
	{
		return cPluginManager::Get()->CallHookBlockSpread(m_World, a_BlockPos, a_Source);
	}

	virtual bool CallHookPlayerBreakingBlock(
		cPlayer & a_Player,
		Vector3i a_BlockPos,
		eBlockFace a_BlockFace,
		BLOCKTYPE a_BlockType,
		NIBBLETYPE a_BlockMeta
	) override
	{
		return cPluginManager::Get()
			->CallHookPlayerBreakingBlock(a_Player, a_BlockPos, a_BlockFace, a_BlockType, a_BlockMeta);
	}

	virtual bool CallHookPlayerBrokenBlock(
		cPlayer & a_Player,
		Vector3i a_BlockPos,
		eBlockFace a_BlockFace,
		BLOCKTYPE a_BlockType,
		NIBBLETYPE a_BlockMeta
	) override
	{
		return cPluginManager::Get()
			->CallHookPlayerBrokenBlock(a_Player, a_BlockPos, a_BlockFace, a_BlockType, a_BlockMeta);
	}

  private:
	cWorld & m_World;
};