Skip to content

Commit a5331e0

Browse files
committed
stairsNeighbours
1 parent 6688099 commit a5331e0

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

index.html

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ <h3>Gra zatrzymana</h3>
130130
[0, 0, 1]
131131
],
132132
this.blocks = {
133+
0: {
134+
isSolid:false
135+
},
133136
1: {
134137
name:"grass",
135138
isSolid:true,
@@ -327,29 +330,29 @@ <h3>Gra zatrzymana</h3>
327330

328331

329332
}else{
330-
if (this.blocks[voxel] != undefined) {
333+
if (voxel!=0 && voxel!=4) {
331334
var geometries = [];
332-
if (this.getVoxel(x - 1, y, z) == 0) {
335+
if (!this.blocks[this.getVoxel(x - 1, y, z)].isSolid) {
333336
var nxGeometry = this.generateFace("nx", voxel);
334337
geometries.push(nxGeometry.applyMatrix4(matrix))
335338
}
336-
if (this.getVoxel(x + 1, y, z) == 0) {
339+
if (!this.blocks[this.getVoxel(x + 1, y, z)].isSolid) {
337340
var pxGeometry = this.generateFace("px", voxel);
338341
geometries.push(pxGeometry.applyMatrix4(matrix))
339342
}
340-
if (this.getVoxel(x, y - 1, z) == 0) {
343+
if (!this.blocks[this.getVoxel(x, y - 1, z)].isSolid) {
341344
var nyGeometry = this.generateFace("ny", voxel);
342345
geometries.push(nyGeometry.applyMatrix4(matrix))
343346
}
344-
if (this.getVoxel(x, y + 1, z) == 0) {
347+
if (!this.blocks[this.getVoxel(x, y + 1, z)].isSolid) {
345348
var pyGeometry = this.generateFace("py", voxel);
346349
geometries.push(pyGeometry.applyMatrix4(matrix))
347350
}
348-
if (this.getVoxel(x, y, z - 1) == 0) {
351+
if (!this.blocks[this.getVoxel(x, y, z - 1)].isSolid) {
349352
var nzGeometry = this.generateFace("nz", voxel);
350353
geometries.push(nzGeometry.applyMatrix4(matrix))
351354
}
352-
if (this.getVoxel(x, y, z + 1) == 0) {
355+
if (!this.blocks[this.getVoxel(x, y, z + 1)].isSolid) {
353356
var pzGeometry = this.generateFace("pz", voxel);
354357
geometries.push(pzGeometry.applyMatrix4(matrix))
355358
}

0 commit comments

Comments
 (0)