forked from alecgorge/nodecraft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelpers.js
76 lines (69 loc) · 1012 Bytes
/
helpers.js
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
exports.concat = function () {
var totalLength = 0, buf_pos = 0;
for(var i = 0; i < arguments.length; i++) {
totalLength += arguments[i].length;
}
var buf = new Buffer(totalLength);
for(var j = 0; j < arguments.length; j++) {
arguments[j].copy(buf, buf_pos, 0);
buf_pos += arguments[j].length;
}
return buf;
};
exports.findBlockCoordsForDirection = function (x, y, z, face) {
switch (face) {
case 0:
return {
x: x,
y: y - 1,
z: z
};
case 1:
return {
x: x,
y: y + 1,
z: z
};
case 2:
return {
x: x,
y: y,
z: z - 1
};
case 3:
return {
x: x,
y: y,
z: z + 1
};
case 4:
return {
x: x - 1,
y: y,
z: z
};
case 5:
return {
x: x + 1,
y: y,
z: z
};
}
};
exports.isUsableObject = function (type) {
var usable_objects = {
61: true,
62: true,
58: true,
54: true
};
return type in usable_objects;
};
exports.hiddenPackets = {
0x0a: true,
0x0b: true,
0x0c: true,
0x0d: true,
0x12: true,
0x32: true
};