Skip to content

Commit bf5e8a2

Browse files
committed
v1.2.2 Added type declaration file.
1 parent fa2e33e commit bf5e8a2

File tree

2 files changed

+139
-1
lines changed

2 files changed

+139
-1
lines changed

main.d.ts

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
declare class MCStructure {
2+
/**
3+
* Deserialize mcstructure from given blob.
4+
*
5+
* @param buf - Input buffer
6+
* @returns s
7+
*/
8+
static deserialize(buf: ArrayBuffer): MCStructure;
9+
10+
/**
11+
* Remove unused blocks in structure.
12+
*
13+
* Changes original object.
14+
*
15+
* @param a - INput object.
16+
* @returns
17+
*/
18+
static makePruned(a: MCStructure): MCStructure;
19+
20+
/**
21+
* Create a mcstructure with given size.
22+
*
23+
* @param xL - X side length.
24+
* @param yL - Y side length.
25+
* @param zL - Z side length.
26+
*/
27+
constructor(xL: number, yL: number, zL: number);
28+
29+
/**
30+
* Get volume of of the structure.
31+
*
32+
* @returns
33+
*/
34+
getVolume(): number;
35+
36+
/**
37+
* Get a block in the structure.
38+
*
39+
* @param pos - Position in the structure.
40+
* @param pos.x - Pos X.
41+
* @param pos.y - Pos Y.
42+
* @param pos.z - Pos Z.
43+
* @returns
44+
*/
45+
getBlock(pos: { x: number, y: number, z: number }): object;
46+
47+
/**
48+
* Get block entity at given position.
49+
*
50+
* @param pos - Position in the structure.
51+
* @param pos.x - Pos X.
52+
* @param pos.y - Pos Y.
53+
* @param pos.z - Pos Z.
54+
* @returns
55+
*/
56+
getBlockData(pos: { x: number, y: number, z: number }): object;
57+
58+
/**
59+
* Get specified entity.
60+
*
61+
* @param uniqueID - Entity ID.
62+
* @returns The specified entity or null.
63+
*/
64+
getEntity(uniqueID: number | bigint): object;
65+
66+
/**
67+
* Place a block, and put given NBT data into block indices.
68+
*
69+
* @param pos - Position in the structure.
70+
* @param pos.x - Pos X.
71+
* @param pos.y - Pos Y.
72+
* @param pos.z - Pos Z.
73+
* @param block - Data of the block.
74+
* @returns
75+
*/
76+
setBlock(pos: { x: number, y: number, z: number }, block: object): boolean;
77+
78+
/**
79+
* Set the block entity of a block.
80+
*
81+
* @param pos - Position in the structure.
82+
* @param pos.x - Pos X.
83+
* @param pos.y - Pos Y.
84+
* @param pos.z - Pos Z.
85+
* @param nbt - Block entity data.
86+
* @returns
87+
*/
88+
setBlockData(pos: { x: number, y: number, z: number }, nbt: object): boolean;
89+
90+
/**
91+
* Fill specified area with given block.
92+
*
93+
* @param from - Position in the structure.
94+
* @param from.x
95+
* @param from.y
96+
* @param from.z
97+
* @param to - Position in the structure.
98+
* @param to.x
99+
* @param to.y
100+
* @param to.z
101+
* @param block - Data of the block.
102+
* @returns
103+
*/
104+
fill(from: { x: number, y: number, z: number }, to: { x: number, y: number, z: number }, block: object): boolean;
105+
106+
/**
107+
* Place an entity.
108+
*
109+
* @param entity - Entity data.
110+
* @param pos - Position in the structure.
111+
* @param pos.x - Pos X.
112+
* @param pos.y - Pos Y.
113+
* @param pos.z - Pos Z.
114+
* @returns Entity ID.
115+
*/
116+
summon(entity: object, pos: { x: number, y: number, z: number }): bigint;
117+
118+
/**
119+
* Remove specified entity.
120+
*
121+
* @param uniqueID - Entity ID.
122+
* @returns The entity removed or null.
123+
*/
124+
kill(uniqueID: number | bigint): object;
125+
126+
/**
127+
* Serialize MCStructure object to NBT.
128+
*
129+
* @returns
130+
*/
131+
serialize(): object;
132+
}
133+
134+
export = MCStructure;

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
{
22
"name": "mcstructure-js",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"description": "A NodeJS package for .mcstructure read & write",
55
"main": "main.js",
6+
"files": [
7+
"./main.js",
8+
"./main.d.ts"
9+
],
610
"scripts": {
711
"test": "echo \"Error: no test specified\" && exit 1"
812
},

0 commit comments

Comments
 (0)