Skip to content
This repository was archived by the owner on Feb 9, 2020. It is now read-only.

Commit 95a4623

Browse files
committed
my code makes me wanna die
sad truth
1 parent ee938d8 commit 95a4623

1 file changed

Lines changed: 16 additions & 12 deletions

File tree

src/pocketnode/network/PlayerSessionAdapter.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ const ResourcePack = pocketnode("resourcepacks/ResourcePack");
1717

1818
const BinaryStream = pocketnode("utils/BinaryStream");
1919

20+
const Async = pocketnode("utils/Async");
21+
2022
class PlayerSessionAdapter {
2123
constructor(player){
2224
/** @type {Server} */
@@ -124,32 +126,34 @@ class PlayerSessionAdapter {
124126
this.player.setViewDistance(packet.radius);
125127

126128
let distance = this.player.getViewDistance();
127-
for(let chunkX = -distance; chunkX <= distance; chunkX++){
128-
for(let chunkZ = -distance; chunkZ <= distance; chunkZ++){
129+
let ccount = 1;
130+
for(let chunkX = -distance; chunkX <= distance; chunkX++) {
131+
for(let chunkZ = -distance; chunkZ <= distance; chunkZ++) {
129132
let chunk = new Chunk(chunkX, chunkZ);
130133

131-
for(let z = 0; z < 16; ++z){
132-
for(let x = 0; x < 16; ++x){
134+
for(let x = 0; x < 16; x++){
135+
for(let z = 0; z < 16; z++){
133136
let y = 0;
134-
//chunk.setBlockId(x, y++, z, 7);
135-
//chunk.setBlockId(x, y++, z, 3);
136-
//chunk.setBlockId(x, y++, z, 3);
137-
chunk.setBlockId(x, y++, z, 2);
138-
139-
chunk.setHeight(y);
137+
chunk.setBlockId(x, y++, z, 7);
138+
chunk.setBlockId(x, y++, z, 3);
139+
chunk.setBlockId(x, y++, z, 3);
140+
chunk.setBlockId(x, y, z, 2);
140141

141-
for(let i = y - 1; i >= 0; i--){
142+
/*for (let i = y - 1; i >= 0; i--) {
142143
chunk.setBlockSkyLight(x, y, z, 0);
143-
}
144+
}*/
144145
}
145146
}
146147

147148
chunk.recalculateHeightMap();
149+
//if(chunkX === -distance && chunkZ === -distance) console.log(`${chunk.toBinary().length}`);// > ${chunk.toBinary().toString("hex")}`);
148150

149151
this.player.sendChunk(chunk);
152+
console.log(`sent chunk #${ccount++}`);
150153
}
151154
}
152155

156+
console.log("done sending chunks");
153157
this.player.sendPlayStatus(PlayStatusPacket.PLAYER_SPAWN);
154158

155159
return true;

0 commit comments

Comments
 (0)