mc-beta-server/server/tileentities/TileEntity.ts

25 lines
724 B
TypeScript
Raw Normal View History

2024-11-22 23:51:27 +00:00
import { IReader, IWriter } from "bufferstuff";
2024-11-17 08:26:35 +00:00
import Block from "../blocks/Block";
import TileEntityType from "../enums/TileEntityType";
import Vec3 from "../Vec3";
2024-11-22 23:51:27 +00:00
import TileEntityChest from "./TileEntityChest";
2024-11-17 08:26:35 +00:00
export default class TileEntity {
public readonly type: TileEntityType;
public readonly forBlock: Block;
public readonly pos: Vec3;
2024-11-17 08:26:35 +00:00
public constructor(type: TileEntityType, forBlock: Block, pos: Vec3) {
2024-11-17 08:26:35 +00:00
this.type = type;
this.forBlock = forBlock;
this.pos = pos;
2024-11-17 08:26:35 +00:00
}
2024-11-22 23:51:27 +00:00
public fromSave(reader:IReader) {}
2024-11-22 23:51:27 +00:00
public toSave(writer:IWriter) {
writer.writeUByte(this.type);
writer.writeUByte(this.forBlock.blockId);
writer.writeUByte(this.pos.x).writeUByte(this.pos.y).writeUByte(this.pos.z);
2024-11-22 23:51:27 +00:00
}
2024-11-17 08:26:35 +00:00
}