2024-11-22 23:51:27 +00:00
|
|
|
import Block from "../blocks/Block";
|
|
|
|
import TileEntityType from "../enums/TileEntityType";
|
|
|
|
import TileEntity from "./TileEntity";
|
|
|
|
import Vec3 from "../Vec3";
|
2024-11-25 02:30:27 +00:00
|
|
|
import { IReader, IWriter } from "bufferstuff";
|
|
|
|
import Inventory from "../inventories/Inventory";
|
2024-11-22 23:51:27 +00:00
|
|
|
|
|
|
|
export default class TileEntityChest extends TileEntity {
|
2024-11-25 02:30:27 +00:00
|
|
|
public inventory:Inventory;
|
|
|
|
|
2024-11-25 22:28:33 +00:00
|
|
|
public constructor(position: Vec3) {
|
|
|
|
super(TileEntityType.Chest, Block.chest, position);
|
2024-11-25 02:30:27 +00:00
|
|
|
|
|
|
|
this.inventory = new Inventory(9 * 3, "Chest");
|
|
|
|
}
|
|
|
|
|
|
|
|
public fromSave(reader:IReader) {
|
|
|
|
super.fromSave(reader);
|
|
|
|
|
|
|
|
this.inventory.fromSave(reader);
|
|
|
|
}
|
|
|
|
|
|
|
|
public toSave(writer:IWriter) {
|
|
|
|
super.toSave(writer);
|
|
|
|
|
|
|
|
this.inventory.toSave(writer);
|
2024-11-22 23:51:27 +00:00
|
|
|
}
|
|
|
|
}
|