summaryrefslogtreecommitdiffstats
path: root/src/BlockInfo.h
blob: 7c7c3fd7e5affe07154a2ba66e45a070a9316b9d (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97

#pragma once

#include "ChunkDef.h"





// tolua_begin
class cBlockInfo
{
  public:
	/** How much light do the blocks emit on their own? */
	static NIBBLETYPE GetLightValue(BLOCKTYPE Block);

	/** How much light do the blocks consume? */
	static NIBBLETYPE GetSpreadLightFalloff(BLOCKTYPE Block);

	/** Can a finisher change it? */
	static bool CanBeTerraformed(BLOCKTYPE Block);

	/** Does this block fully occupy its voxel - is it a 'full' block? */
	static bool FullyOccupiesVoxel(BLOCKTYPE Block);

	/** Does the client pretend the block doesn't exist when clicking?
	For example, digging a fire will hit the block below the fire, so fire is "clicked through". */
	static bool IsClickedThrough(BLOCKTYPE a_Block);

	/** Is a block destroyed after a single hit?
	Warning: IsOneHitDig does not take into account enchantments / status effects / swim state / floating state
	and therefore may be incorrect. Only use to check if hardness is 0.
	If you want to check if a player would instantly mine a_Block use cPlayer::CanInstantlyMine(a_Block) */
	static bool IsOneHitDig(BLOCKTYPE Block);

	/** Can a piston break this block? */
	static bool IsPistonBreakable(BLOCKTYPE Block);

	/** Does this block block the passage of rain? */
	static bool IsRainBlocker(BLOCKTYPE Block);

	/** Does this block disperse sky light? (only relevant for transparent blocks) */
	static bool IsSkylightDispersant(BLOCKTYPE Block);

	static bool IsSnowable(BLOCKTYPE Block);

	/** Is this block solid (player cannot walk through)? */
	static bool IsSolid(BLOCKTYPE Block);

	/** Is a block transparent? (https://minecraft.wiki/w/Opacity) */
	static bool IsTransparent(BLOCKTYPE Block);

	/** Can a spectator interact with this block? */
	static bool IsUseableBySpectator(BLOCKTYPE Block);

	/** Block's height. */
	static float GetBlockHeight(BLOCKTYPE Block);

	/** Block's hardness. The greater the value the longer the player needs to break the block. */
	static float GetHardness(BLOCKTYPE Block);
};
// tolua_end




bool IsBlockWater(BLOCKTYPE a_BlockType);

bool IsBlockIce(BLOCKTYPE a_BlockType);

bool IsBlockWaterOrIce(BLOCKTYPE a_BlockType);

bool IsBlockLava(BLOCKTYPE a_BlockType);

bool IsBlockLiquid(BLOCKTYPE a_BlockType);

bool IsBlockRail(BLOCKTYPE a_BlockType);

bool IsBlockTypeOfDirt(BLOCKTYPE a_BlockType);

bool IsBlockFence(BLOCKTYPE a_BlockType);

bool IsBlockShulkerBox(BLOCKTYPE a_BlockType);

bool IsBlockMaterialWood(BLOCKTYPE a_BlockType);

bool IsBlockMaterialPlants(BLOCKTYPE a_BlockType);

bool IsBlockMaterialVine(BLOCKTYPE a_BlockType);

bool IsBlockMaterialIron(BLOCKTYPE a_BlockType);

bool IsBlockMaterialLeaves(BLOCKTYPE a_BlockType);

bool IsBlockMaterialGourd(BLOCKTYPE a_BlockType);

bool IsBlockMaterialRock(BLOCKTYPE a_BlockType);