This commit is contained in:
parent
f6abf37f41
commit
18ff5a5910
3 changed files with 24 additions and 0 deletions
|
@ -4,6 +4,7 @@ import NibbleArray from "../nibbleArray";
|
|||
import Player from "./entities/Player";
|
||||
import QueuedBlockUpdate from "./queuedUpdateTypes/BlockUpdate";
|
||||
import World from "./World";
|
||||
import TileEntity from "./tileentities/TileEntity";
|
||||
|
||||
export default class Chunk {
|
||||
private readonly MAX_HEIGHT:number = 128;
|
||||
|
@ -16,6 +17,8 @@ export default class Chunk {
|
|||
public savingToDisk:boolean = false;
|
||||
public forceLoaded:boolean = false;
|
||||
|
||||
private tileEntities:FunkyArray<number, TileEntity>;
|
||||
|
||||
private blocks:Uint8Array;
|
||||
private metadata:NibbleArray;
|
||||
public skyLight:NibbleArray;
|
||||
|
@ -30,6 +33,7 @@ export default class Chunk {
|
|||
this.x = x;
|
||||
this.z = z;
|
||||
this.playersInChunk = new FunkyArray<number, Player>();
|
||||
this.tileEntities = new FunkyArray<number, TileEntity>();
|
||||
|
||||
if (generateOrBlockData instanceof Uint8Array && metadata instanceof Uint8Array && blockLight instanceof Uint8Array && skyLight instanceof Uint8Array) {
|
||||
this.blocks = new Uint8Array(generateOrBlockData);
|
||||
|
|
5
server/enums/TileEntityType.ts
Normal file
5
server/enums/TileEntityType.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
enum TileEntityType {
|
||||
Chest
|
||||
}
|
||||
|
||||
export default TileEntityType;
|
15
server/tileentities/TileEntity.ts
Normal file
15
server/tileentities/TileEntity.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import Block from "../blocks/Block";
|
||||
import TileEntityType from "../enums/TileEntityType";
|
||||
import Vec3 from "../Vec3";
|
||||
|
||||
export default class TileEntity {
|
||||
private readonly type: TileEntityType;
|
||||
private readonly forBlockId: Block;
|
||||
private readonly position: Vec3;
|
||||
|
||||
public constructor(type: TileEntityType, forBlockId: Block, position: Vec3) {
|
||||
this.type = type;
|
||||
this.forBlockId = forBlockId;
|
||||
this.position = position;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue