2023-04-08 20:52:47 +01:00
|
|
|
export class Block {
|
|
|
|
public readonly blockId:number;
|
2023-04-13 23:52:13 +01:00
|
|
|
public static readonly blocks:Array<Block> = new Array<Block>();
|
|
|
|
public static readonly lightPassage:Array<number> = new Array<number>();
|
2023-04-08 20:52:47 +01:00
|
|
|
|
|
|
|
public constructor(blockId:number) {
|
2023-04-13 23:52:13 +01:00
|
|
|
Block.blocks[blockId] = this;
|
|
|
|
Block.lightPassage[blockId] = 0;
|
2023-04-08 20:52:47 +01:00
|
|
|
this.blockId = blockId;
|
|
|
|
}
|
|
|
|
|
2023-04-13 23:52:13 +01:00
|
|
|
public get lightPassage() {
|
|
|
|
return Block.lightPassage[this.blockId];
|
|
|
|
}
|
|
|
|
|
|
|
|
public set lightPassage(value:number) {
|
|
|
|
Block.lightPassage[this.blockId] = value;
|
|
|
|
}
|
|
|
|
|
2023-05-02 08:50:49 +01:00
|
|
|
public setLightPassage(value:number) {
|
|
|
|
this.lightPassage = value;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2023-04-11 01:53:33 +01:00
|
|
|
// Define statics here
|
|
|
|
static readonly stone = new Block(1);
|
|
|
|
static readonly grass = new Block(2);
|
|
|
|
static readonly dirt = new Block(3);
|
2023-04-08 20:52:47 +01:00
|
|
|
|
2023-04-11 01:53:33 +01:00
|
|
|
static readonly bedrock = new Block(7);
|
2023-04-09 04:19:10 +01:00
|
|
|
|
2023-05-02 08:50:49 +01:00
|
|
|
static readonly waterStill = new Block(9).setLightPassage(3);
|
2023-04-09 04:19:10 +01:00
|
|
|
|
2023-04-17 02:05:11 +01:00
|
|
|
static readonly lavaStill = new Block(11);
|
|
|
|
|
2023-04-11 07:47:56 +01:00
|
|
|
static readonly sand = new Block(12);
|
|
|
|
static readonly gravel = new Block(13);
|
2023-04-09 04:19:10 +01:00
|
|
|
|
2023-04-11 01:53:33 +01:00
|
|
|
static readonly wood = new Block(17);
|
2023-05-02 08:50:49 +01:00
|
|
|
static readonly leaves = new Block(18).setLightPassage(1);
|
|
|
|
|
|
|
|
static readonly glass = new Block(20).setLightPassage(255);
|
2023-04-11 07:47:56 +01:00
|
|
|
|
2023-04-13 23:52:13 +01:00
|
|
|
static readonly tallGrass = new Block(31);
|
|
|
|
|
2023-04-17 02:05:11 +01:00
|
|
|
static readonly flowerDandelion = new Block(37);
|
|
|
|
static readonly flowerRose = new Block(38);
|
|
|
|
|
2023-04-11 07:47:56 +01:00
|
|
|
static readonly clay = new Block(82);
|
2023-04-08 20:52:47 +01:00
|
|
|
}
|