tile entity base
All checks were successful
Node.js Build / build (20.x) (push) Successful in 5m19s

This commit is contained in:
Holly Stubbs 2024-11-17 08:26:35 +00:00
parent f6abf37f41
commit 18ff5a5910
Signed by: tgpholly
GPG key ID: B8583C4B7D18119E
3 changed files with 24 additions and 0 deletions

View file

@ -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);

View file

@ -0,0 +1,5 @@
enum TileEntityType {
Chest
}
export default TileEntityType;

View 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;
}
}