Material counter and cleanup

This commit is contained in:
ForestOfLight
2025-03-11 02:13:16 -07:00
Unverified
parent 67e3f6fecc
commit 830b54e55a
5 changed files with 211 additions and 30 deletions
+3 -11
View File
@@ -1,4 +1,3 @@
import { world } from '@minecraft/server';
import { Structure } from './Structure';
class StructureCollection {
@@ -9,8 +8,9 @@ class StructureCollection {
}
add(name) {
const struct = world.structureManager.get(name);
this.#structures[name] = new Structure(name, struct);
const structure = new Structure(name);
this.#structures[name] = structure;
return structure;
}
get(name) {
@@ -26,14 +26,6 @@ class StructureCollection {
struct.remove();
delete this.#structures[name];
}
place(name, dimensionId, location) {
const struct = this.get(name);
if (!struct) {
throw new Error(`Structure ${name} not found.`);
}
struct.place(dimensionId, location);
}
}
export const structureCollection = new StructureCollection();