Skip to content

Commit

Permalink
Tested and fully working with Stardust!
Browse files Browse the repository at this point in the history
  • Loading branch information
Bradley Watton committed Oct 23, 2020
1 parent 7e70bb3 commit 7a852b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/Anvil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ export class Anvil {
private readLocationTable(data: Buffer): LocationTable {
const table: LocationTable = []

for(let i = 0; i < 4096; i += 4) {
const offset = data.readUInt32BE(i)
const sectors = data.readIntBE(i + 3, 1)
const timestamp = data.readIntBE(i + 4096, 4)
for(let i = 0; i < 1024; i++) {
const pos = i * 4
const offset = data.readUInt32BE(pos)
const sectors = data.readIntBE(pos + 3, 1)
const timestamp = data.readIntBE(pos + 4096, 4)

if(offset === 0 || sectors === 0) {
table[i] = null
Expand Down
2 changes: 1 addition & 1 deletion src/Region.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class Region {
}

public hasChunk(x: number, z: number): boolean {
return this.getChunkLocationItem(x, z) !== null
return !!this.getChunkLocationItem(x, z)
}

}

0 comments on commit 7a852b4

Please sign in to comment.