blob: 42576f6320801897533215ed7f0991e8dc63fe79 (
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
#pragma once
#include "ItemHandler.h"
class cItemPickaxeHandler final : public cItemHandler
{
using Super = cItemHandler;
public:
constexpr cItemPickaxeHandler(int a_ItemType) :
Super(a_ItemType)
{
}
virtual short GetDurabilityLossByAction(eDurabilityLostAction a_Action) const override
{
switch (a_Action)
{
case dlaAttackEntity: return 2;
case dlaBreakBlock: return 1;
case dlaBreakBlockInstant: return 0;
}
UNREACHABLE("Unsupported durability loss action");
}
char PickaxeLevel() const
{
switch (m_ItemType)
{
case E_ITEM_WOODEN_PICKAXE: return 1;
case E_ITEM_GOLD_PICKAXE: return 1;
case E_ITEM_STONE_PICKAXE: return 2;
case E_ITEM_IRON_PICKAXE: return 3;
case E_ITEM_DIAMOND_PICKAXE: return 4;
default: return 0;
}
}
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) const override
{
// NOTICE: Make sure to update cItemHandler::CanHarvestBlock() if adding new blocks here!
switch (a_BlockType)
{
case E_BLOCK_OBSIDIAN:
{
return PickaxeLevel() >= 4;
}
case E_BLOCK_DIAMOND_BLOCK:
case E_BLOCK_DIAMOND_ORE:
case E_BLOCK_EMERALD_ORE:
case E_BLOCK_GOLD_BLOCK:
case E_BLOCK_GOLD_ORE:
case E_BLOCK_REDSTONE_ORE:
case E_BLOCK_REDSTONE_ORE_GLOWING:
{
return PickaxeLevel() >= 3;
}
case E_BLOCK_IRON_BLOCK:
case E_BLOCK_IRON_ORE:
case E_BLOCK_LAPIS_ORE:
case E_BLOCK_LAPIS_BLOCK:
{
return PickaxeLevel() >= 2;
}
case E_BLOCK_ANVIL:
case E_BLOCK_BLACK_GLAZED_TERRACOTTA:
case E_BLOCK_BLOCK_OF_COAL:
case E_BLOCK_BLOCK_OF_REDSTONE:
case E_BLOCK_BLUE_GLAZED_TERRACOTTA:
case E_BLOCK_BONE_BLOCK:
case E_BLOCK_BREWING_STAND:
case E_BLOCK_BRICK:
case E_BLOCK_BRICK_STAIRS:
case E_BLOCK_BROWN_GLAZED_TERRACOTTA:
case E_BLOCK_CAULDRON:
case E_BLOCK_COAL_ORE:
case E_BLOCK_COBBLESTONE:
case E_BLOCK_COBBLESTONE_STAIRS:
case E_BLOCK_COBBLESTONE_WALL:
case E_BLOCK_CONCRETE:
case E_BLOCK_CYAN_GLAZED_TERRACOTTA:
case E_BLOCK_DISPENSER:
case E_BLOCK_DROPPER:
case E_BLOCK_DOUBLE_RED_SANDSTONE_SLAB:
case E_BLOCK_DOUBLE_STONE_SLAB:
case E_BLOCK_ENCHANTMENT_TABLE:
case E_BLOCK_END_BRICKS:
case E_BLOCK_END_STONE:
case E_BLOCK_FURNACE:
case E_BLOCK_GRAY_GLAZED_TERRACOTTA:
case E_BLOCK_GREEN_GLAZED_TERRACOTTA:
case E_BLOCK_HARDENED_CLAY:
case E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE:
case E_BLOCK_HOPPER:
case E_BLOCK_IRON_BARS:
case E_BLOCK_IRON_DOOR:
case E_BLOCK_IRON_TRAPDOOR:
case E_BLOCK_LIGHT_BLUE_GLAZED_TERRACOTTA:
case E_BLOCK_LIGHT_GRAY_GLAZED_TERRACOTTA:
case E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE:
case E_BLOCK_LIT_FURNACE:
case E_BLOCK_LIME_GLAZED_TERRACOTTA:
case E_BLOCK_MAGENTA_GLAZED_TERRACOTTA:
case E_BLOCK_MOB_SPAWNER:
case E_BLOCK_MOSSY_COBBLESTONE:
case E_BLOCK_MAGMA:
case E_BLOCK_NETHER_BRICK:
case E_BLOCK_NETHER_BRICK_STAIRS:
case E_BLOCK_NETHER_BRICK_FENCE:
case E_BLOCK_NETHER_QUARTZ_ORE:
case E_BLOCK_NETHERRACK:
case E_BLOCK_OBSERVER:
case E_BLOCK_ORANGE_GLAZED_TERRACOTTA:
case E_BLOCK_PRISMARINE_BLOCK:
case E_BLOCK_PINK_GLAZED_TERRACOTTA:
case E_BLOCK_PURPLE_GLAZED_TERRACOTTA:
case E_BLOCK_PURPUR_BLOCK:
case E_BLOCK_PURPUR_DOUBLE_SLAB:
case E_BLOCK_PURPUR_PILLAR:
case E_BLOCK_PURPUR_SLAB:
case E_BLOCK_PURPUR_STAIRS:
case E_BLOCK_QUARTZ_BLOCK:
case E_BLOCK_QUARTZ_STAIRS:
case E_BLOCK_RED_GLAZED_TERRACOTTA:
case E_BLOCK_RED_NETHER_BRICK:
case E_BLOCK_RED_SANDSTONE:
case E_BLOCK_RED_SANDSTONE_STAIRS:
case E_BLOCK_SANDSTONE:
case E_BLOCK_SANDSTONE_STAIRS:
case E_BLOCK_STONE:
case E_BLOCK_STONE_BRICKS:
case E_BLOCK_STONE_BRICK_STAIRS:
case E_BLOCK_STONE_PRESSURE_PLATE:
case E_BLOCK_STONE_SLAB:
case E_BLOCK_WHITE_GLAZED_TERRACOTTA:
case E_BLOCK_YELLOW_GLAZED_TERRACOTTA:
{
return PickaxeLevel() >= 1;
}
}
return Super::CanHarvestBlock(a_BlockType);
}
virtual bool CanRepairWithRawMaterial(short a_ItemType) const override
{
switch (m_ItemType)
{
case E_ITEM_WOODEN_PICKAXE: return (a_ItemType == E_BLOCK_PLANKS);
case E_ITEM_STONE_PICKAXE: return (a_ItemType == E_BLOCK_COBBLESTONE);
case E_ITEM_IRON_PICKAXE: return (a_ItemType == E_ITEM_IRON);
case E_ITEM_GOLD_PICKAXE: return (a_ItemType == E_ITEM_GOLD);
case E_ITEM_DIAMOND_PICKAXE: return (a_ItemType == E_ITEM_DIAMOND);
}
return false;
}
virtual float GetBlockBreakingStrength(BLOCKTYPE a_Block) const override
{
if (!IsBlockMaterialIron(a_Block) && (a_Block != E_BLOCK_ANVIL) && !IsBlockMaterialRock(a_Block))
{
return Super::GetBlockBreakingStrength(a_Block);
}
else
{
switch (m_ItemType)
{
case E_ITEM_WOODEN_PICKAXE: return 2.0f;
case E_ITEM_STONE_PICKAXE: return 4.0f;
case E_ITEM_IRON_PICKAXE: return 6.0f;
case E_ITEM_GOLD_PICKAXE: return 12.0f;
case E_ITEM_DIAMOND_PICKAXE: return 8.0f;
}
}
ASSERT(!"Something is wrong here... Maybe they are pickaxes out of a new material?");
return 1.0f;
}
};
|