-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstructor.js
94 lines (86 loc) · 2.42 KB
/
constructor.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
** This file is licensed in BSD 2 Clause.
*/
//TODO:Wrap up the constructor && find better solution.
class Coordinate {
constructor(x, y, z) {
this.x = x;
this.y = y;
this.z = z;
}
add({ x, y, z }) {
this.x += x;
this.y += y;
this.z += z;
}
}
class Position {
constructor(coordinate, dimension = "overworld") {
this.coordinate = coordinate;
this.dimension = dimension;
}
}
class BlockType {
constructor(blockIdentifier, blockState, blockNBT = {}) {
this.blockIdentifier = blockIdentifier;
this.blockState = blockState;
this.blockNBT = blockNBT
}
}
class Direction {
constructor(x, y) {
this.x = x;
this.y = y;
}
}
class Block {
constructor(position, blockType) {
this.position = position;
this.blockType = blockType;
}
}
class Usage {
constructor(positionUsage, blockTypeUsage, directionUsage, optionUsage) {
this.positionUsage = positionUsage;
this.blockTypeUsage = blockTypeUsage;
this.directionUsage = directionUsage;
this.optionUsage = optionUsage;
}
}
class Description {
constructor(name, usage) {
this.name = name;
this.usage = usage;
}
}
//TODO:Refactor generator
class Generator {
constructor(description,
positionArray, blockTypeArray, directionArray, option,
addPosition, addBlockType, addDirection,
removePosition, removeBlockType, removeDirection,
validateParameter, generate, postGenerate, UIHandler) {
this.description = description;
this.positionArray = positionArray;
this.blockTypeArray = blockTypeArray;
this.directionArray = directionArray;
this.option = option;
this.addPosition = addPosition;
this.addBlockType = addBlockType;
this.addDirection = addDirection;
this.removePosition = removePosition;
this.removeBlockType = removeBlockType;
this.removeDirection = removeDirection;
this.validateParameter = validateParameter;
this.generate = generate;
this.postGenerate = postGenerate;
this.UIHandler = UIHandler;
}
}
class BuildInstruction {
constructor(type, data) {
this.type = type;
this.data = data;
}
}
module.exports = { Coordinate, Position, BlockType, Block, Direction, Usage, Description, Generator, BuildInstruction };