hytopia 0.6.34 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bun-server.mjs +167 -167
- package/docs/server.blocktype.collideroptions.md +1 -1
- package/docs/server.blocktype.halfextents.md +13 -0
- package/docs/server.blocktype.md +43 -1
- package/docs/server.blocktype.size.md +13 -0
- package/docs/server.blocktypeoptions.customcollideroptions.md +1 -1
- package/docs/server.blocktypeoptions.halfextents.md +13 -0
- package/docs/server.blocktypeoptions.md +20 -1
- package/docs/server.chunk._constructor_.md +35 -1
- package/docs/server.chunk.md +4 -147
- package/docs/server.chunk.origincoordinate.md +1 -1
- package/docs/server.chunklattice.clear.md +1 -1
- package/docs/server.chunklattice.getblocktypecount.md +55 -0
- package/docs/server.chunklattice.getchunk.md +5 -5
- package/docs/server.chunklattice.getorcreatechunk.md +55 -0
- package/docs/server.chunklattice.haschunk.md +4 -4
- package/docs/server.chunklattice.md +36 -7
- package/docs/server.chunklattice.setblock.md +1 -1
- package/docs/server.chunklatticeevent.md +61 -0
- package/docs/server.chunklatticeeventpayloads._chunk_lattice.remove_chunk_.md +16 -0
- package/docs/server.chunklatticeeventpayloads._chunk_lattice.set_block_.md +19 -0
- package/docs/server.chunklatticeeventpayloads.md +76 -0
- package/docs/server.collider.md +16 -0
- package/docs/server.collider.scale.md +4 -0
- package/docs/server.collider.setvoxel.md +69 -0
- package/docs/server.collideroptions.md +2 -2
- package/docs/server.collidershape.md +14 -0
- package/docs/server.eventpayloads.md +2 -2
- package/docs/server.md +17 -4
- package/docs/server.particleemitteroptions.md +2 -0
- package/docs/server.voxelscollideroptions.coordinates.md +13 -0
- package/docs/server.voxelscollideroptions.md +94 -0
- package/docs/server.voxelscollideroptions.shape.md +11 -0
- package/docs/server.voxelscollideroptions.size.md +13 -0
- package/docs/server.world.md +1 -1
- package/docs/server.world.setdirectionallightposition.md +2 -2
- package/node-server.mjs +167 -167
- package/package.json +1 -1
- package/server.api.json +827 -764
- package/server.d.ts +100 -113
- package/docs/server.chunk.despawn.md +0 -17
- package/docs/server.chunk.issimulated.md +0 -13
- package/docs/server.chunk.isspawned.md +0 -13
- package/docs/server.chunk.isvalidorigincoordinate.md +0 -55
- package/docs/server.chunk.setblock.md +0 -69
- package/docs/server.chunk.spawn.md +0 -69
- package/docs/server.chunk.world.md +0 -13
- package/docs/server.chunkevent.md +0 -75
- package/docs/server.chunkeventpayloads._chunk.despawn_.md +0 -15
- package/docs/server.chunkeventpayloads._chunk.set_block_.md +0 -18
- package/docs/server.chunkeventpayloads._chunk.spawn_.md +0 -15
- package/docs/server.chunkeventpayloads.md +0 -95
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [server](./server.md) > [BlockType](./server.blocktype.md) > [halfExtents](./server.blocktype.halfextents.md)
|
|
4
|
+
|
|
5
|
+
## BlockType.halfExtents property
|
|
6
|
+
|
|
7
|
+
The half extents size of the block type.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
get halfExtents(): Vector3Like;
|
|
13
|
+
```
|
package/docs/server.blocktype.md
CHANGED
|
@@ -107,7 +107,7 @@ Description
|
|
|
107
107
|
|
|
108
108
|
</td><td>
|
|
109
109
|
|
|
110
|
-
[
|
|
110
|
+
[VoxelsColliderOptions](./server.voxelscollideroptions.md)
|
|
111
111
|
|
|
112
112
|
|
|
113
113
|
</td><td>
|
|
@@ -115,6 +115,27 @@ Description
|
|
|
115
115
|
The collider options for the block type.
|
|
116
116
|
|
|
117
117
|
|
|
118
|
+
</td></tr>
|
|
119
|
+
<tr><td>
|
|
120
|
+
|
|
121
|
+
[halfExtents](./server.blocktype.halfextents.md)
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
</td><td>
|
|
125
|
+
|
|
126
|
+
`readonly`
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
</td><td>
|
|
130
|
+
|
|
131
|
+
[Vector3Like](./server.vector3like.md)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
</td><td>
|
|
135
|
+
|
|
136
|
+
The half extents size of the block type.
|
|
137
|
+
|
|
138
|
+
|
|
118
139
|
</td></tr>
|
|
119
140
|
<tr><td>
|
|
120
141
|
|
|
@@ -199,6 +220,27 @@ string
|
|
|
199
220
|
The name of the block type.
|
|
200
221
|
|
|
201
222
|
|
|
223
|
+
</td></tr>
|
|
224
|
+
<tr><td>
|
|
225
|
+
|
|
226
|
+
[size](./server.blocktype.size.md)
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
</td><td>
|
|
230
|
+
|
|
231
|
+
`readonly`
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
</td><td>
|
|
235
|
+
|
|
236
|
+
[Vector3Like](./server.vector3like.md)
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
</td><td>
|
|
240
|
+
|
|
241
|
+
The size of the block type.
|
|
242
|
+
|
|
243
|
+
|
|
202
244
|
</td></tr>
|
|
203
245
|
<tr><td>
|
|
204
246
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [server](./server.md) > [BlockType](./server.blocktype.md) > [size](./server.blocktype.size.md)
|
|
4
|
+
|
|
5
|
+
## BlockType.size property
|
|
6
|
+
|
|
7
|
+
The size of the block type.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
get size(): Vector3Like;
|
|
13
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [server](./server.md) > [BlockTypeOptions](./server.blocktypeoptions.md) > [halfExtents](./server.blocktypeoptions.halfextents.md)
|
|
4
|
+
|
|
5
|
+
## BlockTypeOptions.halfExtents property
|
|
6
|
+
|
|
7
|
+
The half extents size of the block type.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
halfExtents?: Vector3Like;
|
|
13
|
+
```
|
|
@@ -45,7 +45,7 @@ Description
|
|
|
45
45
|
|
|
46
46
|
</td><td>
|
|
47
47
|
|
|
48
|
-
[
|
|
48
|
+
[VoxelsColliderOptions](./server.voxelscollideroptions.md)
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
</td><td>
|
|
@@ -53,6 +53,25 @@ Description
|
|
|
53
53
|
_(Optional)_ The custom collider options for the block type.
|
|
54
54
|
|
|
55
55
|
|
|
56
|
+
</td></tr>
|
|
57
|
+
<tr><td>
|
|
58
|
+
|
|
59
|
+
[halfExtents?](./server.blocktypeoptions.halfextents.md)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
</td><td>
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
</td><td>
|
|
66
|
+
|
|
67
|
+
[Vector3Like](./server.vector3like.md)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
</td><td>
|
|
71
|
+
|
|
72
|
+
_(Optional)_ The half extents size of the block type.
|
|
73
|
+
|
|
74
|
+
|
|
56
75
|
</td></tr>
|
|
57
76
|
<tr><td>
|
|
58
77
|
|
|
@@ -9,5 +9,39 @@ Creates a new chunk instance.
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
constructor();
|
|
12
|
+
constructor(originCoordinate: Vector3Like);
|
|
13
13
|
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
<table><thead><tr><th>
|
|
18
|
+
|
|
19
|
+
Parameter
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</th><th>
|
|
23
|
+
|
|
24
|
+
Type
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Description
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th></tr></thead>
|
|
33
|
+
<tbody><tr><td>
|
|
34
|
+
|
|
35
|
+
originCoordinate
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</td><td>
|
|
39
|
+
|
|
40
|
+
[Vector3Like](./server.vector3like.md)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
</td></tr>
|
|
47
|
+
</tbody></table>
|
package/docs/server.chunk.md
CHANGED
|
@@ -9,35 +9,13 @@ A 16^3 chunk of blocks. Used to represent a world's terrain.
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
export default class Chunk
|
|
12
|
+
export default class Chunk implements protocol.Serializable
|
|
13
13
|
```
|
|
14
|
-
**Extends:** [EventRouter](./server.eventrouter.md)
|
|
15
|
-
|
|
16
14
|
**Implements:** protocol.Serializable
|
|
17
15
|
|
|
18
16
|
## Remarks
|
|
19
17
|
|
|
20
|
-
Chunks make up the bulk of the terrain in a world. Chunks are fixed size, each containing 16^3 possible blocks as a 16x16x16 cube. Chunks
|
|
21
|
-
|
|
22
|
-
The Chunk follows a spawn and despawn lifecycle pattern. When you create a chunk, when you're ready to load it in your world you use .spawn(). To remove it, you use .despawn().
|
|
23
|
-
|
|
24
|
-
Use .setBlock() to set the block type id at a specific local cooridnate. Block type ids are ones that have been registered in the [BlockTypeRegistry](./server.blocktyperegistry.md) associated with the [World](./server.world.md) the chunk belongs to. A block type id of 0 is used to represent no block. Removing a block is done by .setBlock(localCoordinate, 0).
|
|
25
|
-
|
|
26
|
-
<h2>Events</h2>
|
|
27
|
-
|
|
28
|
-
This class is an EventRouter, and instances of it emit events with payloads listed under [ChunkEventPayloads](./server.chunkeventpayloads.md)
|
|
29
|
-
|
|
30
|
-
## Example
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
```typescript
|
|
34
|
-
// Assume we previously registered a stone block with type id of 10..
|
|
35
|
-
|
|
36
|
-
const chunk = new Chunk();
|
|
37
|
-
|
|
38
|
-
chunk.setBlock({ x: 0, y: 0, z: 0 }, 10); // Set the block at 0, 0, 0 to stone
|
|
39
|
-
chunk.spawn(world, { x: 16, y: 0, z: 16 }); // Spawn the chunk at global coordinate 16, 0, 16
|
|
40
|
-
```
|
|
18
|
+
Chunks make up the bulk of the terrain in a world. Chunks are fixed size, each containing 16^3 possible blocks as a 16x16x16 cube. Chunks are primarily a data structure used by [ChunkLattice](./server.chunklattice.md) to represent a world's terrain. Chunks store their internal block coordinates in local space, meaning local coordinates x: 0...15, y: 0...15, z: 0...15.
|
|
41
19
|
|
|
42
20
|
## Constructors
|
|
43
21
|
|
|
@@ -59,7 +37,7 @@ Description
|
|
|
59
37
|
</th></tr></thead>
|
|
60
38
|
<tbody><tr><td>
|
|
61
39
|
|
|
62
|
-
[(constructor)()](./server.chunk._constructor_.md)
|
|
40
|
+
[(constructor)(originCoordinate)](./server.chunk._constructor_.md)
|
|
63
41
|
|
|
64
42
|
|
|
65
43
|
</td><td>
|
|
@@ -116,48 +94,6 @@ Readonly<Uint8Array>
|
|
|
116
94
|
The blocks in the chunk as a flat Uint8Array\[4096\], each index as 0 or a block type id.
|
|
117
95
|
|
|
118
96
|
|
|
119
|
-
</td></tr>
|
|
120
|
-
<tr><td>
|
|
121
|
-
|
|
122
|
-
[isSimulated](./server.chunk.issimulated.md)
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
</td><td>
|
|
126
|
-
|
|
127
|
-
`readonly`
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
</td><td>
|
|
131
|
-
|
|
132
|
-
boolean
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
</td><td>
|
|
136
|
-
|
|
137
|
-
Whether the chunk is actively simulated in the internal physics engine.
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
</td></tr>
|
|
141
|
-
<tr><td>
|
|
142
|
-
|
|
143
|
-
[isSpawned](./server.chunk.isspawned.md)
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
</td><td>
|
|
147
|
-
|
|
148
|
-
`readonly`
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
</td><td>
|
|
152
|
-
|
|
153
|
-
boolean
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
</td><td>
|
|
157
|
-
|
|
158
|
-
Whether the chunk has been spawned.
|
|
159
|
-
|
|
160
|
-
|
|
161
97
|
</td></tr>
|
|
162
98
|
<tr><td>
|
|
163
99
|
|
|
@@ -171,7 +107,7 @@ Whether the chunk has been spawned.
|
|
|
171
107
|
|
|
172
108
|
</td><td>
|
|
173
109
|
|
|
174
|
-
[Vector3Like](./server.vector3like.md)
|
|
110
|
+
[Vector3Like](./server.vector3like.md)
|
|
175
111
|
|
|
176
112
|
|
|
177
113
|
</td><td>
|
|
@@ -179,27 +115,6 @@ Whether the chunk has been spawned.
|
|
|
179
115
|
The origin coordinate of the chunk.
|
|
180
116
|
|
|
181
117
|
|
|
182
|
-
</td></tr>
|
|
183
|
-
<tr><td>
|
|
184
|
-
|
|
185
|
-
[world](./server.chunk.world.md)
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
</td><td>
|
|
189
|
-
|
|
190
|
-
`readonly`
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
</td><td>
|
|
194
|
-
|
|
195
|
-
[World](./server.world.md) \| undefined
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
</td><td>
|
|
199
|
-
|
|
200
|
-
The world the chunk belongs to.
|
|
201
|
-
|
|
202
|
-
|
|
203
118
|
</td></tr>
|
|
204
119
|
</tbody></table>
|
|
205
120
|
|
|
@@ -236,20 +151,6 @@ Description
|
|
|
236
151
|
Convert a block index to a local coordinate.
|
|
237
152
|
|
|
238
153
|
|
|
239
|
-
</td></tr>
|
|
240
|
-
<tr><td>
|
|
241
|
-
|
|
242
|
-
[despawn()](./server.chunk.despawn.md)
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
</td><td>
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
</td><td>
|
|
249
|
-
|
|
250
|
-
Despawn the chunk from the world.
|
|
251
|
-
|
|
252
|
-
|
|
253
154
|
</td></tr>
|
|
254
155
|
<tr><td>
|
|
255
156
|
|
|
@@ -310,49 +211,5 @@ Convert a global coordinate to an origin coordinate.
|
|
|
310
211
|
Check if a block exists at a specific local coordinate.
|
|
311
212
|
|
|
312
213
|
|
|
313
|
-
</td></tr>
|
|
314
|
-
<tr><td>
|
|
315
|
-
|
|
316
|
-
[isValidOriginCoordinate(coordinate)](./server.chunk.isvalidorigincoordinate.md)
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
</td><td>
|
|
320
|
-
|
|
321
|
-
`static`
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
</td><td>
|
|
325
|
-
|
|
326
|
-
Check if an origin coordinate is valid.
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
</td></tr>
|
|
330
|
-
<tr><td>
|
|
331
|
-
|
|
332
|
-
[setBlock(localCoordinate, blockTypeId)](./server.chunk.setblock.md)
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
</td><td>
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
</td><td>
|
|
339
|
-
|
|
340
|
-
Set the block at a specific local coordinate by block type id.
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
</td></tr>
|
|
344
|
-
<tr><td>
|
|
345
|
-
|
|
346
|
-
[spawn(world, originCoordinate)](./server.chunk.spawn.md)
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
</td><td>
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
</td><td>
|
|
353
|
-
|
|
354
|
-
Spawn the chunk in the world.
|
|
355
|
-
|
|
356
|
-
|
|
357
214
|
</td></tr>
|
|
358
215
|
</tbody></table>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [server](./server.md) > [ChunkLattice](./server.chunklattice.md) > [getBlockTypeCount](./server.chunklattice.getblocktypecount.md)
|
|
4
|
+
|
|
5
|
+
## ChunkLattice.getBlockTypeCount() method
|
|
6
|
+
|
|
7
|
+
Get the number of blocks of a specific block type in the lattice.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
getBlockTypeCount(blockTypeId: number): number;
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
<table><thead><tr><th>
|
|
18
|
+
|
|
19
|
+
Parameter
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</th><th>
|
|
23
|
+
|
|
24
|
+
Type
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Description
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th></tr></thead>
|
|
33
|
+
<tbody><tr><td>
|
|
34
|
+
|
|
35
|
+
blockTypeId
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</td><td>
|
|
39
|
+
|
|
40
|
+
number
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
The block type id to get the count of.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
</td></tr>
|
|
49
|
+
</tbody></table>
|
|
50
|
+
**Returns:**
|
|
51
|
+
|
|
52
|
+
number
|
|
53
|
+
|
|
54
|
+
The number of blocks of the block type.
|
|
55
|
+
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
## ChunkLattice.getChunk() method
|
|
6
6
|
|
|
7
|
-
Get
|
|
7
|
+
Get the chunk that contains the given global coordinate.
|
|
8
8
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
getChunk(
|
|
12
|
+
getChunk(globalCoordinate: Vector3Like): Chunk | undefined;
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Parameters
|
|
@@ -32,7 +32,7 @@ Description
|
|
|
32
32
|
</th></tr></thead>
|
|
33
33
|
<tbody><tr><td>
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
globalCoordinate
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
</td><td>
|
|
@@ -42,7 +42,7 @@ originCoordinate
|
|
|
42
42
|
|
|
43
43
|
</td><td>
|
|
44
44
|
|
|
45
|
-
The
|
|
45
|
+
The global coordinate to get the chunk for.
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
</td></tr>
|
|
@@ -51,5 +51,5 @@ The origin coordinate of the chunk to get.
|
|
|
51
51
|
|
|
52
52
|
[Chunk](./server.chunk.md) \| undefined
|
|
53
53
|
|
|
54
|
-
The chunk
|
|
54
|
+
The chunk that contains the given global coordinate or undefined if not found.
|
|
55
55
|
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [server](./server.md) > [ChunkLattice](./server.chunklattice.md) > [getOrCreateChunk](./server.chunklattice.getorcreatechunk.md)
|
|
4
|
+
|
|
5
|
+
## ChunkLattice.getOrCreateChunk() method
|
|
6
|
+
|
|
7
|
+
Get the chunk for a given global coordinate.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
getOrCreateChunk(globalCoordinate: Vector3Like): Chunk;
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
<table><thead><tr><th>
|
|
18
|
+
|
|
19
|
+
Parameter
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</th><th>
|
|
23
|
+
|
|
24
|
+
Type
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Description
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th></tr></thead>
|
|
33
|
+
<tbody><tr><td>
|
|
34
|
+
|
|
35
|
+
globalCoordinate
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</td><td>
|
|
39
|
+
|
|
40
|
+
[Vector3Like](./server.vector3like.md)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
The global coordinate of the chunk to get.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
</td></tr>
|
|
49
|
+
</tbody></table>
|
|
50
|
+
**Returns:**
|
|
51
|
+
|
|
52
|
+
[Chunk](./server.chunk.md)
|
|
53
|
+
|
|
54
|
+
The chunk at the given global coordinate or undefined if not found.
|
|
55
|
+
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
## ChunkLattice.hasChunk() method
|
|
6
6
|
|
|
7
|
-
Check if a chunk exists
|
|
7
|
+
Check if a chunk exists for a given global coordinate.
|
|
8
8
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
hasChunk(
|
|
12
|
+
hasChunk(globalCoordinate: Vector3Like): boolean;
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Parameters
|
|
@@ -32,7 +32,7 @@ Description
|
|
|
32
32
|
</th></tr></thead>
|
|
33
33
|
<tbody><tr><td>
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
globalCoordinate
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
</td><td>
|
|
@@ -42,7 +42,7 @@ originCoordinate
|
|
|
42
42
|
|
|
43
43
|
</td><td>
|
|
44
44
|
|
|
45
|
-
The
|
|
45
|
+
The global coordinate of the chunk to check.
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
</td></tr>
|
|
@@ -9,8 +9,9 @@ A lattice of chunks that represent a world's terrain.
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
export default class ChunkLattice
|
|
12
|
+
export default class ChunkLattice extends EventRouter
|
|
13
13
|
```
|
|
14
|
+
**Extends:** [EventRouter](./server.eventrouter.md)
|
|
14
15
|
|
|
15
16
|
## Remarks
|
|
16
17
|
|
|
@@ -124,7 +125,7 @@ Description
|
|
|
124
125
|
|
|
125
126
|
</td><td>
|
|
126
127
|
|
|
127
|
-
|
|
128
|
+
Removes and clears all chunks and their blocks from the lattice.
|
|
128
129
|
|
|
129
130
|
|
|
130
131
|
</td></tr>
|
|
@@ -172,7 +173,7 @@ Get the block type at a specific global coordinate.
|
|
|
172
173
|
</td></tr>
|
|
173
174
|
<tr><td>
|
|
174
175
|
|
|
175
|
-
[
|
|
176
|
+
[getBlockTypeCount(blockTypeId)](./server.chunklattice.getblocktypecount.md)
|
|
176
177
|
|
|
177
178
|
|
|
178
179
|
</td><td>
|
|
@@ -180,7 +181,35 @@ Get the block type at a specific global coordinate.
|
|
|
180
181
|
|
|
181
182
|
</td><td>
|
|
182
183
|
|
|
183
|
-
Get a
|
|
184
|
+
Get the number of blocks of a specific block type in the lattice.
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
</td></tr>
|
|
188
|
+
<tr><td>
|
|
189
|
+
|
|
190
|
+
[getChunk(globalCoordinate)](./server.chunklattice.getchunk.md)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
</td><td>
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
</td><td>
|
|
197
|
+
|
|
198
|
+
Get the chunk that contains the given global coordinate.
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
</td></tr>
|
|
202
|
+
<tr><td>
|
|
203
|
+
|
|
204
|
+
[getOrCreateChunk(globalCoordinate)](./server.chunklattice.getorcreatechunk.md)
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
</td><td>
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
</td><td>
|
|
211
|
+
|
|
212
|
+
Get the chunk for a given global coordinate.
|
|
184
213
|
|
|
185
214
|
|
|
186
215
|
</td></tr>
|
|
@@ -200,7 +229,7 @@ Check if a block exists at a specific global coordinate.
|
|
|
200
229
|
</td></tr>
|
|
201
230
|
<tr><td>
|
|
202
231
|
|
|
203
|
-
[hasChunk(
|
|
232
|
+
[hasChunk(globalCoordinate)](./server.chunklattice.haschunk.md)
|
|
204
233
|
|
|
205
234
|
|
|
206
235
|
</td><td>
|
|
@@ -208,7 +237,7 @@ Check if a block exists at a specific global coordinate.
|
|
|
208
237
|
|
|
209
238
|
</td><td>
|
|
210
239
|
|
|
211
|
-
Check if a chunk exists
|
|
240
|
+
Check if a chunk exists for a given global coordinate.
|
|
212
241
|
|
|
213
242
|
|
|
214
243
|
</td></tr>
|
|
@@ -222,7 +251,7 @@ Check if a chunk exists by its origin coordinate.
|
|
|
222
251
|
|
|
223
252
|
</td><td>
|
|
224
253
|
|
|
225
|
-
Set the block at a global coordinate by block type id, automatically creating a chunk if it doesn't exist. Use block type id 0 for air.
|
|
254
|
+
Set the block at a global coordinate by block type id, automatically creating a chunk if it doesn't exist. Use block type id 0 for air (to remove a block).
|
|
226
255
|
|
|
227
256
|
|
|
228
257
|
</td></tr>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## ChunkLattice.setBlock() method
|
|
6
6
|
|
|
7
|
-
Set the block at a global coordinate by block type id, automatically creating a chunk if it doesn't exist. Use block type id 0 for air.
|
|
7
|
+
Set the block at a global coordinate by block type id, automatically creating a chunk if it doesn't exist. Use block type id 0 for air (to remove a block).
|
|
8
8
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|