@lzimul/minecraft-mcp 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +219 -168
- package/SECURITY.md +38 -21
- package/build/config/server-info.js +3 -2
- package/build/config/world-limits.js +4 -1
- package/build/data/entities.js +1581 -0
- package/build/enums/entity-kind.enum.js +5 -0
- package/build/enums/inventory-section.enum.js +5 -0
- package/build/index.js +4 -3
- package/build/interfaces/entity-inventory.interface.js +1 -0
- package/build/interfaces/entity-type.interface.js +1 -0
- package/build/interfaces/entity.interface.js +1 -0
- package/build/resources/dimension-resources.js +23 -6
- package/build/resources/entity-resources.js +17 -0
- package/build/resources/index.js +2 -0
- package/build/schemas/coordinate-schema.js +5 -0
- package/build/schemas/dimension-schema.js +1 -0
- package/build/schemas/entity-schema.js +95 -0
- package/build/tools/block-tools.js +14 -23
- package/build/tools/entity-tools.js +325 -0
- package/build/tools/index.js +4 -0
- package/build/tools/result.js +3 -5
- package/build/tools/world-tools.js +139 -0
- package/build/utils/logger.js +53 -0
- package/build/world/block-spec.js +6 -6
- package/build/world/block-states.js +23 -4
- package/build/world/entity-inventory.js +84 -0
- package/build/world/item-spec.js +25 -0
- package/build/world/simulated-dimension.js +187 -13
- package/build/world/stores/file-world-store.js +67 -20
- package/build/world/stores/memory-world-store.js +13 -5
- package/build/world/stores/serialized-block.js +9 -14
- package/build/world/stores/serialized-entity.js +74 -0
- package/build/world/world.js +33 -1
- package/lib/config/server-info.d.ts.map +1 -1
- package/lib/config/world-limits.d.ts +3 -0
- package/lib/config/world-limits.d.ts.map +1 -1
- package/lib/data/entities.d.ts +5 -0
- package/lib/data/entities.d.ts.map +1 -0
- package/lib/enums/entity-kind.enum.d.ts +5 -0
- package/lib/enums/entity-kind.enum.d.ts.map +1 -0
- package/lib/enums/inventory-section.enum.d.ts +5 -0
- package/lib/enums/inventory-section.enum.d.ts.map +1 -0
- package/lib/interfaces/entity-inventory.interface.d.ts +9 -0
- package/lib/interfaces/entity-inventory.interface.d.ts.map +1 -0
- package/lib/interfaces/entity-type.interface.d.ts +8 -0
- package/lib/interfaces/entity-type.interface.d.ts.map +1 -0
- package/lib/interfaces/entity.interface.d.ts +17 -0
- package/lib/interfaces/entity.interface.d.ts.map +1 -0
- package/lib/interfaces/world-store.interface.d.ts +7 -2
- package/lib/interfaces/world-store.interface.d.ts.map +1 -1
- package/lib/resources/dimension-resources.d.ts.map +1 -1
- package/lib/resources/entity-resources.d.ts +3 -0
- package/lib/resources/entity-resources.d.ts.map +1 -0
- package/lib/resources/index.d.ts.map +1 -1
- package/lib/schemas/coordinate-schema.d.ts +5 -0
- package/lib/schemas/coordinate-schema.d.ts.map +1 -1
- package/lib/schemas/dimension-schema.d.ts +1 -0
- package/lib/schemas/dimension-schema.d.ts.map +1 -1
- package/lib/schemas/entity-schema.d.ts +134 -0
- package/lib/schemas/entity-schema.d.ts.map +1 -0
- package/lib/tools/block-tools.d.ts.map +1 -1
- package/lib/tools/entity-tools.d.ts +4 -0
- package/lib/tools/entity-tools.d.ts.map +1 -0
- package/lib/tools/index.d.ts.map +1 -1
- package/lib/tools/result.d.ts +2 -6
- package/lib/tools/result.d.ts.map +1 -1
- package/lib/tools/world-tools.d.ts +4 -0
- package/lib/tools/world-tools.d.ts.map +1 -0
- package/lib/utils/logger.d.ts +3 -0
- package/lib/utils/logger.d.ts.map +1 -0
- package/lib/world/block-states.d.ts +2 -0
- package/lib/world/block-states.d.ts.map +1 -1
- package/lib/world/entity-inventory.d.ts +16 -0
- package/lib/world/entity-inventory.d.ts.map +1 -0
- package/lib/world/item-spec.d.ts +10 -0
- package/lib/world/item-spec.d.ts.map +1 -0
- package/lib/world/simulated-dimension.d.ts +29 -0
- package/lib/world/simulated-dimension.d.ts.map +1 -1
- package/lib/world/stores/file-world-store.d.ts +3 -3
- package/lib/world/stores/file-world-store.d.ts.map +1 -1
- package/lib/world/stores/memory-world-store.d.ts +3 -4
- package/lib/world/stores/memory-world-store.d.ts.map +1 -1
- package/lib/world/stores/serialized-block.d.ts.map +1 -1
- package/lib/world/stores/serialized-entity.d.ts +24 -0
- package/lib/world/stores/serialized-entity.d.ts.map +1 -0
- package/lib/world/world.d.ts +3 -0
- package/lib/world/world.d.ts.map +1 -1
- package/package.json +113 -109
package/build/world/world.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DIMENSIONS } from '../config/dimensions.js';
|
|
2
2
|
import { toErrorMessage } from '../utils/error-message.js';
|
|
3
|
+
import { logger } from '../utils/logger.js';
|
|
3
4
|
import { SimulatedDimension } from './simulated-dimension.js';
|
|
4
5
|
export class World {
|
|
5
6
|
dimensions;
|
|
@@ -17,7 +18,16 @@ export class World {
|
|
|
17
18
|
}
|
|
18
19
|
return [dimension.type, simulated];
|
|
19
20
|
}));
|
|
20
|
-
|
|
21
|
+
const dimensions = new Map(entries);
|
|
22
|
+
const claimedPlayerNames = new Set();
|
|
23
|
+
let duplicatePlayers = 0;
|
|
24
|
+
for (const dimension of dimensions.values()) {
|
|
25
|
+
duplicatePlayers += dimension.removeDuplicatePlayers(claimedPlayerNames);
|
|
26
|
+
}
|
|
27
|
+
if (duplicatePlayers > 0) {
|
|
28
|
+
logger.warn(`Removed ${duplicatePlayers} duplicate player name(s) while loading the world`);
|
|
29
|
+
}
|
|
30
|
+
return new World(dimensions);
|
|
21
31
|
}
|
|
22
32
|
static listDimensions() {
|
|
23
33
|
return DIMENSIONS;
|
|
@@ -29,6 +39,28 @@ export class World {
|
|
|
29
39
|
}
|
|
30
40
|
return dimension;
|
|
31
41
|
}
|
|
42
|
+
findEntity(id) {
|
|
43
|
+
for (const dimension of this.dimensions.values()) {
|
|
44
|
+
const entity = dimension.getEntity(id);
|
|
45
|
+
if (entity) {
|
|
46
|
+
return entity;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
findPlayer(name) {
|
|
52
|
+
const normalized = name.trim().toLowerCase();
|
|
53
|
+
if (normalized.length === 0) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
for (const dimension of this.dimensions.values()) {
|
|
57
|
+
const player = dimension.findPlayer(normalized);
|
|
58
|
+
if (player) {
|
|
59
|
+
return player;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
32
64
|
async flush() {
|
|
33
65
|
const results = await Promise.allSettled([...this.dimensions.values()].map(dimension => dimension.flush()));
|
|
34
66
|
const failures = results.filter((result) => result.status === 'rejected');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-info.d.ts","sourceRoot":"","sources":["../../src/config/server-info.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server-info.d.ts","sourceRoot":"","sources":["../../src/config/server-info.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,eAAO,MAAM,WAAW;;;;;;;;;;;;CAoBvB,CAAC"}
|
|
@@ -4,5 +4,8 @@ export declare const WORLD_LIMITS: {
|
|
|
4
4
|
readonly minVertical: -64;
|
|
5
5
|
readonly maxVertical: 320;
|
|
6
6
|
readonly maxModifiedBlocks: 250000;
|
|
7
|
+
readonly maxEntitiesPerDimension: 10000;
|
|
8
|
+
readonly maxEntityNameLength: 64;
|
|
9
|
+
readonly maxPlayerNameLength: 32;
|
|
7
10
|
};
|
|
8
11
|
//# sourceMappingURL=world-limits.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"world-limits.d.ts","sourceRoot":"","sources":["../../src/config/world-limits.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"world-limits.d.ts","sourceRoot":"","sources":["../../src/config/world-limits.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;;;;;;;CAWf,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IEntityType } from '../interfaces/entity-type.interface.js';
|
|
2
|
+
export declare const MINECRAFT_ENTITY_TYPES: readonly IEntityType[];
|
|
3
|
+
export declare const MINECRAFT_ENTITY_COUNT: number;
|
|
4
|
+
export declare function getEntityTypeByName(name: string): IEntityType | undefined;
|
|
5
|
+
//# sourceMappingURL=entities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../src/data/entities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAE1E,eAAO,MAAM,sBAAsB,EAAE,SAAS,WAAW,EAmiDxD,CAAC;AAEF,eAAO,MAAM,sBAAsB,QAAgC,CAAC;AAQpE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAEzE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-kind.enum.d.ts","sourceRoot":"","sources":["../../src/enums/entity-kind.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inventory-section.enum.d.ts","sourceRoot":"","sources":["../../src/enums/inventory-section.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,iBAAiB;IAC3B,MAAM,WAAW;IACjB,SAAS,cAAc;CACxB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface IItemStack {
|
|
2
|
+
readonly item: string;
|
|
3
|
+
readonly count: number;
|
|
4
|
+
}
|
|
5
|
+
export interface IEntityInventory {
|
|
6
|
+
readonly hotbar: readonly (IItemStack | null)[];
|
|
7
|
+
readonly inventory: readonly (IItemStack | null)[];
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=entity-inventory.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-inventory.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/entity-inventory.interface.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,UAAU;IAEzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAMD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,UAAU,GAAG,IAAI,CAAC,EAAE,CAAC;IAChD,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC,UAAU,GAAG,IAAI,CAAC,EAAE,CAAC;CACpD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IDataEntry } from './data-entry.interface.js';
|
|
2
|
+
export interface IEntityType extends IDataEntry {
|
|
3
|
+
readonly type: string;
|
|
4
|
+
readonly category: string;
|
|
5
|
+
readonly width: number;
|
|
6
|
+
readonly height: number;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=entity-type.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-type.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/entity-type.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,MAAM,WAAW,WAAY,SAAQ,UAAU;IAE7C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { EEntityKind } from '../enums/entity-kind.enum.js';
|
|
2
|
+
import type { EDimensionType } from '../enums/dimension-type.enum.js';
|
|
3
|
+
import type { IEntityInventory } from './entity-inventory.interface.js';
|
|
4
|
+
import type { IEntityType } from './entity-type.interface.js';
|
|
5
|
+
export interface IEntity {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly kind: EEntityKind;
|
|
8
|
+
readonly type: IEntityType;
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly x: number;
|
|
11
|
+
readonly y: number;
|
|
12
|
+
readonly z: number;
|
|
13
|
+
readonly dimension: EDimensionType;
|
|
14
|
+
readonly inventory: IEntityInventory;
|
|
15
|
+
readonly createdAt: string;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=entity.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/entity.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAG9D,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAE3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;IACnC,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;IACrC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { EDimensionType } from '../enums/dimension-type.enum.js';
|
|
2
|
+
import type { IEntity } from './entity.interface.js';
|
|
2
3
|
import type { IPlacedBlock } from './placed-block.interface.js';
|
|
4
|
+
export interface IWorldSnapshot {
|
|
5
|
+
readonly blocks: readonly IPlacedBlock[];
|
|
6
|
+
readonly entities: readonly IEntity[];
|
|
7
|
+
}
|
|
3
8
|
export interface IWorldStore {
|
|
4
|
-
load(type: EDimensionType): Promise<
|
|
5
|
-
save(type: EDimensionType,
|
|
9
|
+
load(type: EDimensionType): Promise<IWorldSnapshot>;
|
|
10
|
+
save(type: EDimensionType, snapshot: IWorldSnapshot): Promise<void>;
|
|
6
11
|
}
|
|
7
12
|
//# sourceMappingURL=world-store.interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"world-store.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/world-store.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"world-store.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/world-store.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAMhE,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;IACzC,QAAQ,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACpD,IAAI,CAAC,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dimension-resources.d.ts","sourceRoot":"","sources":["../../src/resources/dimension-resources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"dimension-resources.d.ts","sourceRoot":"","sources":["../../src/resources/dimension-resources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAO9D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AA+C1C,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,KAAK,GACX,IAAI,CAgCN;AAED,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,KAAK,GACX,IAAI,CA2BN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-resources.d.ts","sourceRoot":"","sources":["../../src/resources/entity-resources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAY9D,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAa/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAU9D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAMvE"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import * as z from 'zod/v4';
|
|
2
2
|
export declare const horizontalCoordinate: z.ZodNumber;
|
|
3
3
|
export declare const verticalCoordinate: z.ZodNumber;
|
|
4
|
+
export declare const blockPositionShape: {
|
|
5
|
+
readonly x: z.ZodNumber;
|
|
6
|
+
readonly y: z.ZodNumber;
|
|
7
|
+
readonly z: z.ZodNumber;
|
|
8
|
+
};
|
|
4
9
|
//# sourceMappingURL=coordinate-schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinate-schema.d.ts","sourceRoot":"","sources":["../../src/schemas/coordinate-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAI5B,eAAO,MAAM,oBAAoB,aAIC,CAAC;AAEnC,eAAO,MAAM,kBAAkB,aAIC,CAAC"}
|
|
1
|
+
{"version":3,"file":"coordinate-schema.d.ts","sourceRoot":"","sources":["../../src/schemas/coordinate-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAI5B,eAAO,MAAM,oBAAoB,aAIC,CAAC;AAEnC,eAAO,MAAM,kBAAkB,aAIC,CAAC;AAMjC,eAAO,MAAM,kBAAkB;;;;CAMrB,CAAC"}
|
|
@@ -2,4 +2,5 @@ import * as z from 'zod/v4';
|
|
|
2
2
|
import { EDimensionType } from '../enums/dimension-type.enum.js';
|
|
3
3
|
export declare const dimensionSchema: z.ZodDefault<z.ZodEnum<typeof EDimensionType>>;
|
|
4
4
|
export declare const dimensionTypeSchema: z.ZodEnum<typeof EDimensionType>;
|
|
5
|
+
export declare const dimensionField: z.ZodDefault<z.ZodEnum<typeof EDimensionType>>;
|
|
5
6
|
//# sourceMappingURL=dimension-schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dimension-schema.d.ts","sourceRoot":"","sources":["../../src/schemas/dimension-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,eAAO,MAAM,eAAe,gDAEQ,CAAC;AAErC,eAAO,MAAM,mBAAmB,kCAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"dimension-schema.d.ts","sourceRoot":"","sources":["../../src/schemas/dimension-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,eAAO,MAAM,eAAe,gDAEQ,CAAC;AAErC,eAAO,MAAM,mBAAmB,kCAAyB,CAAC;AAE1D,eAAO,MAAM,cAAc,gDAE1B,CAAC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
import { EEntityKind } from '../enums/entity-kind.enum.js';
|
|
3
|
+
import { EInventorySection } from '../enums/inventory-section.enum.js';
|
|
4
|
+
import type { IEntity } from '../interfaces/entity.interface.js';
|
|
5
|
+
import type { IItemStack } from '../interfaces/entity-inventory.interface.js';
|
|
6
|
+
export declare const itemStackSchema: z.ZodObject<{
|
|
7
|
+
item: z.ZodString;
|
|
8
|
+
count: z.ZodNumber;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export type ItemStackInfo = z.infer<typeof itemStackSchema>;
|
|
11
|
+
export declare const entityInventorySchema: z.ZodObject<{
|
|
12
|
+
hotbar: z.ZodArray<z.ZodNullable<z.ZodObject<{
|
|
13
|
+
item: z.ZodString;
|
|
14
|
+
count: z.ZodNumber;
|
|
15
|
+
}, z.core.$strip>>>;
|
|
16
|
+
inventory: z.ZodArray<z.ZodNullable<z.ZodObject<{
|
|
17
|
+
item: z.ZodString;
|
|
18
|
+
count: z.ZodNumber;
|
|
19
|
+
}, z.core.$strip>>>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
export type EntityInventoryInfo = z.infer<typeof entityInventorySchema>;
|
|
22
|
+
export declare const entitySummarySchema: z.ZodObject<{
|
|
23
|
+
id: z.ZodString;
|
|
24
|
+
kind: z.ZodEnum<typeof EEntityKind>;
|
|
25
|
+
type: z.ZodString;
|
|
26
|
+
typeDisplayName: z.ZodString;
|
|
27
|
+
category: z.ZodString;
|
|
28
|
+
name: z.ZodString;
|
|
29
|
+
x: z.ZodNumber;
|
|
30
|
+
y: z.ZodNumber;
|
|
31
|
+
z: z.ZodNumber;
|
|
32
|
+
dimension: z.ZodString;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
export type EntitySummary = z.infer<typeof entitySummarySchema>;
|
|
35
|
+
export declare const entityInfoSchema: z.ZodObject<{
|
|
36
|
+
id: z.ZodString;
|
|
37
|
+
kind: z.ZodEnum<typeof EEntityKind>;
|
|
38
|
+
type: z.ZodString;
|
|
39
|
+
typeDisplayName: z.ZodString;
|
|
40
|
+
category: z.ZodString;
|
|
41
|
+
name: z.ZodString;
|
|
42
|
+
x: z.ZodNumber;
|
|
43
|
+
y: z.ZodNumber;
|
|
44
|
+
z: z.ZodNumber;
|
|
45
|
+
dimension: z.ZodString;
|
|
46
|
+
createdAt: z.ZodString;
|
|
47
|
+
usedSlots: z.ZodNumber;
|
|
48
|
+
totalSlots: z.ZodNumber;
|
|
49
|
+
inventory: z.ZodObject<{
|
|
50
|
+
hotbar: z.ZodArray<z.ZodNullable<z.ZodObject<{
|
|
51
|
+
item: z.ZodString;
|
|
52
|
+
count: z.ZodNumber;
|
|
53
|
+
}, z.core.$strip>>>;
|
|
54
|
+
inventory: z.ZodArray<z.ZodNullable<z.ZodObject<{
|
|
55
|
+
item: z.ZodString;
|
|
56
|
+
count: z.ZodNumber;
|
|
57
|
+
}, z.core.$strip>>>;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
export type EntityInfo = z.infer<typeof entityInfoSchema>;
|
|
61
|
+
export declare const inventoryViewSchema: z.ZodObject<{
|
|
62
|
+
entity: z.ZodObject<{
|
|
63
|
+
id: z.ZodString;
|
|
64
|
+
kind: z.ZodEnum<typeof EEntityKind>;
|
|
65
|
+
type: z.ZodString;
|
|
66
|
+
typeDisplayName: z.ZodString;
|
|
67
|
+
category: z.ZodString;
|
|
68
|
+
name: z.ZodString;
|
|
69
|
+
x: z.ZodNumber;
|
|
70
|
+
y: z.ZodNumber;
|
|
71
|
+
z: z.ZodNumber;
|
|
72
|
+
dimension: z.ZodString;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
hotbar: z.ZodArray<z.ZodNullable<z.ZodObject<{
|
|
75
|
+
item: z.ZodString;
|
|
76
|
+
count: z.ZodNumber;
|
|
77
|
+
}, z.core.$strip>>>;
|
|
78
|
+
inventory: z.ZodArray<z.ZodNullable<z.ZodObject<{
|
|
79
|
+
item: z.ZodString;
|
|
80
|
+
count: z.ZodNumber;
|
|
81
|
+
}, z.core.$strip>>>;
|
|
82
|
+
hotbarUsed: z.ZodNumber;
|
|
83
|
+
inventoryUsed: z.ZodNumber;
|
|
84
|
+
usedSlots: z.ZodNumber;
|
|
85
|
+
totalSlots: z.ZodNumber;
|
|
86
|
+
}, z.core.$strip>;
|
|
87
|
+
export type InventoryView = z.infer<typeof inventoryViewSchema>;
|
|
88
|
+
export declare const inventoryChangeSchema: z.ZodObject<{
|
|
89
|
+
entity: z.ZodObject<{
|
|
90
|
+
id: z.ZodString;
|
|
91
|
+
kind: z.ZodEnum<typeof EEntityKind>;
|
|
92
|
+
type: z.ZodString;
|
|
93
|
+
typeDisplayName: z.ZodString;
|
|
94
|
+
category: z.ZodString;
|
|
95
|
+
name: z.ZodString;
|
|
96
|
+
x: z.ZodNumber;
|
|
97
|
+
y: z.ZodNumber;
|
|
98
|
+
z: z.ZodNumber;
|
|
99
|
+
dimension: z.ZodString;
|
|
100
|
+
}, z.core.$strip>;
|
|
101
|
+
hotbar: z.ZodArray<z.ZodNullable<z.ZodObject<{
|
|
102
|
+
item: z.ZodString;
|
|
103
|
+
count: z.ZodNumber;
|
|
104
|
+
}, z.core.$strip>>>;
|
|
105
|
+
inventory: z.ZodArray<z.ZodNullable<z.ZodObject<{
|
|
106
|
+
item: z.ZodString;
|
|
107
|
+
count: z.ZodNumber;
|
|
108
|
+
}, z.core.$strip>>>;
|
|
109
|
+
hotbarUsed: z.ZodNumber;
|
|
110
|
+
inventoryUsed: z.ZodNumber;
|
|
111
|
+
usedSlots: z.ZodNumber;
|
|
112
|
+
totalSlots: z.ZodNumber;
|
|
113
|
+
section: z.ZodEnum<typeof EInventorySection>;
|
|
114
|
+
slot: z.ZodNumber;
|
|
115
|
+
previous: z.ZodNullable<z.ZodObject<{
|
|
116
|
+
item: z.ZodString;
|
|
117
|
+
count: z.ZodNumber;
|
|
118
|
+
}, z.core.$strip>>;
|
|
119
|
+
item: z.ZodNullable<z.ZodObject<{
|
|
120
|
+
item: z.ZodString;
|
|
121
|
+
count: z.ZodNumber;
|
|
122
|
+
}, z.core.$strip>>;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
export type InventoryChange = z.infer<typeof inventoryChangeSchema>;
|
|
125
|
+
export declare function toItemStackInfo(stack: IItemStack): ItemStackInfo;
|
|
126
|
+
export declare function toEntityInventoryInfo(entity: IEntity): EntityInventoryInfo;
|
|
127
|
+
export declare function toEntitySummary(entity: IEntity): EntitySummary;
|
|
128
|
+
export declare function toEntityInfo(entity: IEntity): EntityInfo;
|
|
129
|
+
export declare function toInventoryView(entity: IEntity): InventoryView;
|
|
130
|
+
export declare const INVENTORY_LIMITS: {
|
|
131
|
+
readonly hotbar: 9;
|
|
132
|
+
readonly inventory: 27;
|
|
133
|
+
};
|
|
134
|
+
//# sourceMappingURL=entity-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-schema.d.ts","sourceRoot":"","sources":["../../src/schemas/entity-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC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,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,aAAa,CAa9D;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,GAAG,UAAU,CAQxD;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,aAAa,CAa9D;AAED,eAAO,MAAM,gBAAgB;;;CAGnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-tools.d.ts","sourceRoot":"","sources":["../../src/tools/block-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"block-tools.d.ts","sourceRoot":"","sources":["../../src/tools/block-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAY9D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI/C,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAiJxE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-tools.d.ts","sourceRoot":"","sources":["../../src/tools/entity-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AA4B9D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AA6D/C,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAyWzE"}
|
package/lib/tools/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAO9D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAKnE"}
|
package/lib/tools/result.d.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
content: [{
|
|
3
|
-
type: 'text';
|
|
4
|
-
text: string;
|
|
5
|
-
}];
|
|
6
|
-
};
|
|
1
|
+
import type { IDimension } from '../interfaces/dimension.interface.js';
|
|
7
2
|
export declare function toolError(message: string): {
|
|
8
3
|
isError: true;
|
|
9
4
|
content: [{
|
|
@@ -11,4 +6,5 @@ export declare function toolError(message: string): {
|
|
|
11
6
|
text: string;
|
|
12
7
|
}];
|
|
13
8
|
};
|
|
9
|
+
export declare function coordinateRangeError(dimension: IDimension, x: number, y: number, z: number): ReturnType<typeof toolError>;
|
|
14
10
|
//# sourceMappingURL=result.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/tools/result.ts"],"names":[],"mappings":"AAAA,wBAAgB,
|
|
1
|
+
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/tools/result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAMvE,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG;IAC1C,OAAO,EAAE,IAAI,CAAC;IACd,OAAO,EAAE,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC3C,CAKA;AAED,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,UAAU,EACrB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACR,UAAU,CAAC,OAAO,SAAS,CAAC,CAI9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"world-tools.d.ts","sourceRoot":"","sources":["../../src/tools/world-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAO9D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI/C,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAkJxE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAGA,OAAO,MAAM,MAAM,QAAQ,CAAC;AA+D5B,eAAO,MAAM,MAAM,eAAoC,CAAC"}
|
|
@@ -2,6 +2,8 @@ import type { BlockStates } from '../interfaces/block-states.interface.js';
|
|
|
2
2
|
export declare const EMPTY_BLOCK_STATES: BlockStates;
|
|
3
3
|
export declare function isSafeStateName(name: string): boolean;
|
|
4
4
|
export declare function isSafeStateValue(value: string): boolean;
|
|
5
|
+
export declare function compareStateNames(a: string, b: string): number;
|
|
6
|
+
export declare function isEmptyStates(states: BlockStates | null | undefined): boolean;
|
|
5
7
|
export declare function normalizeStates(states: BlockStates | null | undefined): BlockStates;
|
|
6
8
|
export declare function sameStates(a: BlockStates, b: BlockStates): boolean;
|
|
7
9
|
export declare function formatStates(states: BlockStates): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-states.d.ts","sourceRoot":"","sources":["../../src/world/block-states.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAE3E,eAAO,MAAM,kBAAkB,EAAE,WAA+B,CAAC;AAajE,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQrD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAOvD;AAGD,wBAAgB,eAAe,CAC7B,MAAM,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GACrC,WAAW,
|
|
1
|
+
{"version":3,"file":"block-states.d.ts","sourceRoot":"","sources":["../../src/world/block-states.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAE3E,eAAO,MAAM,kBAAkB,EAAE,WAA+B,CAAC;AAajE,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQrD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAOvD;AAMD,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAK9D;AAGD,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAU7E;AAGD,wBAAgB,eAAe,CAC7B,MAAM,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GACrC,WAAW,CAkBb;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,WAAW,GAAG,OAAO,CAMlE;AAGD,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAQxD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EInventorySection } from '../enums/inventory-section.enum.js';
|
|
2
|
+
import type { IEntityInventory, IItemStack } from '../interfaces/entity-inventory.interface.js';
|
|
3
|
+
export declare const HOTBAR_SLOT_COUNT = 9;
|
|
4
|
+
export declare const INVENTORY_SLOT_COUNT = 27;
|
|
5
|
+
export declare const TOTAL_SLOT_COUNT: number;
|
|
6
|
+
export declare function slotCount(section: EInventorySection): number;
|
|
7
|
+
export declare function isSlotInRange(section: EInventorySection, slot: number): boolean;
|
|
8
|
+
export declare function createEmptyInventory(): IEntityInventory;
|
|
9
|
+
export declare function normalizeItemStack(value: unknown): IItemStack | null;
|
|
10
|
+
export declare function normalizeInventory(value: unknown): IEntityInventory;
|
|
11
|
+
export declare function getInventorySlot(inventory: IEntityInventory, section: EInventorySection, slot: number): IItemStack | null;
|
|
12
|
+
export declare function withInventorySlot(inventory: IEntityInventory, section: EInventorySection, slot: number, stack: IItemStack | null): IEntityInventory;
|
|
13
|
+
export declare function sameItemStack(a: IItemStack | null, b: IItemStack | null): boolean;
|
|
14
|
+
export declare function inventoryUsedSlots(inventory: IEntityInventory): number;
|
|
15
|
+
export declare function sectionUsedSlots(inventory: IEntityInventory, section: EInventorySection): number;
|
|
16
|
+
//# sourceMappingURL=entity-inventory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-inventory.d.ts","sourceRoot":"","sources":["../../src/world/entity-inventory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAEvE,OAAO,KAAK,EACV,gBAAgB,EAChB,UAAU,EACX,MAAM,6CAA6C,CAAC;AAErD,eAAO,MAAM,iBAAiB,IAAI,CAAC;AACnC,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,gBAAgB,QAA2C,CAAC;AAEzE,wBAAgB,SAAS,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAI5D;AAED,wBAAgB,aAAa,CAC3B,OAAO,EAAE,iBAAiB,EAC1B,IAAI,EAAE,MAAM,GACX,OAAO,CAET;AAED,wBAAgB,oBAAoB,IAAI,gBAAgB,CAKvD;AAQD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAyBpE;AAaD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAUnE;AAED,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,gBAAgB,EAC3B,OAAO,EAAE,iBAAiB,EAC1B,IAAI,EAAE,MAAM,GACX,UAAU,GAAG,IAAI,CAInB;AAGD,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,gBAAgB,EAC3B,OAAO,EAAE,iBAAiB,EAC1B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,UAAU,GAAG,IAAI,GACvB,gBAAgB,CAUlB;AAED,wBAAgB,aAAa,CAC3B,CAAC,EAAE,UAAU,GAAG,IAAI,EACpB,CAAC,EAAE,UAAU,GAAG,IAAI,GACnB,OAAO,CAKT;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,gBAAgB,GAAG,MAAM,CAKtE;AAED,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,gBAAgB,EAC3B,OAAO,EAAE,iBAAiB,GACzB,MAAM,CAMR"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IItem } from '../interfaces/item.interface.js';
|
|
2
|
+
export type ItemSpecResult = {
|
|
3
|
+
readonly ok: true;
|
|
4
|
+
readonly item: IItem;
|
|
5
|
+
} | {
|
|
6
|
+
readonly ok: false;
|
|
7
|
+
readonly error: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function parseItemSpec(input: string): ItemSpecResult;
|
|
10
|
+
//# sourceMappingURL=item-spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"item-spec.d.ts","sourceRoot":"","sources":["../../src/world/item-spec.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAE7D,MAAM,MAAM,cAAc,GACtB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;CAAE,GAC3C;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AASnD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAyB3D"}
|
|
@@ -1,27 +1,56 @@
|
|
|
1
|
+
import { EInventorySection } from '../enums/inventory-section.enum.js';
|
|
1
2
|
import type { IBlock } from '../interfaces/block.interface.js';
|
|
2
3
|
import type { BlockStates } from '../interfaces/block-states.interface.js';
|
|
3
4
|
import type { IDimension } from '../interfaces/dimension.interface.js';
|
|
5
|
+
import type { IEntity } from '../interfaces/entity.interface.js';
|
|
6
|
+
import type { IItemStack } from '../interfaces/entity-inventory.interface.js';
|
|
7
|
+
import type { IEntityType } from '../interfaces/entity-type.interface.js';
|
|
4
8
|
import type { IPlacedBlock } from '../interfaces/placed-block.interface.js';
|
|
5
9
|
import type { IWorldStore } from '../interfaces/world-store.interface.js';
|
|
6
10
|
export declare class SimulatedDimension {
|
|
7
11
|
readonly info: IDimension;
|
|
8
12
|
private readonly blocks;
|
|
13
|
+
private readonly entities;
|
|
14
|
+
private readonly playersByName;
|
|
9
15
|
private readonly store;
|
|
10
16
|
private readonly writeDelayMs;
|
|
11
17
|
private timer;
|
|
12
18
|
private queue;
|
|
13
19
|
private savePromise;
|
|
14
20
|
private dirty;
|
|
21
|
+
private sortedBlocksCache;
|
|
22
|
+
private sortedEntitiesCache;
|
|
15
23
|
constructor(info: IDimension, store: IWorldStore, writeDelayMs?: number);
|
|
16
24
|
get modifiedBlockCount(): number;
|
|
25
|
+
get entityCount(): number;
|
|
26
|
+
get playerCount(): number;
|
|
17
27
|
get placedBlocks(): readonly IPlacedBlock[];
|
|
28
|
+
get sortedPlacedBlocks(): readonly IPlacedBlock[];
|
|
29
|
+
get placedEntities(): readonly IEntity[];
|
|
30
|
+
get sortedPlacedEntities(): readonly IEntity[];
|
|
18
31
|
load(): Promise<void>;
|
|
19
32
|
contains(x: number, y: number, z: number): boolean;
|
|
20
33
|
canSetBlock(x: number, y: number, z: number): boolean;
|
|
34
|
+
canAddEntity(): boolean;
|
|
21
35
|
getBlock(x: number, y: number, z: number): IBlock;
|
|
22
36
|
getStates(x: number, y: number, z: number): BlockStates;
|
|
37
|
+
getBlockState(x: number, y: number, z: number): {
|
|
38
|
+
readonly block: IBlock;
|
|
39
|
+
readonly states: BlockStates;
|
|
40
|
+
};
|
|
41
|
+
getEntity(id: string): IEntity | undefined;
|
|
42
|
+
findPlayer(name: string): IEntity | undefined;
|
|
43
|
+
removeDuplicatePlayers(claimedNames: Set<string>): number;
|
|
44
|
+
createEntity(type: IEntityType, name: string, x: number, y: number, z: number): IEntity;
|
|
45
|
+
createPlayer(name: string, x: number, y: number, z: number): IEntity;
|
|
46
|
+
private addEntity;
|
|
47
|
+
setInventorySlot(id: string, section: EInventorySection, slot: number, stack: IItemStack | null): {
|
|
48
|
+
readonly previous: IItemStack | null;
|
|
49
|
+
readonly entity: IEntity;
|
|
50
|
+
};
|
|
23
51
|
setBlock(x: number, y: number, z: number, block: IBlock, states?: BlockStates): IBlock;
|
|
24
52
|
flush(): Promise<void>;
|
|
53
|
+
private markDirty;
|
|
25
54
|
private scheduleFlush;
|
|
26
55
|
}
|
|
27
56
|
//# sourceMappingURL=simulated-dimension.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulated-dimension.d.ts","sourceRoot":"","sources":["../../src/world/simulated-dimension.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"simulated-dimension.d.ts","sourceRoot":"","sources":["../../src/world/simulated-dimension.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAkBvE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6CAA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AM,EACT,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,MAAM,EACb,MAAM,GAAE,WAAgC,GACvC,MAAM;IA2CH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAoC5B,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,aAAa;CAatB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EDimensionType } from '../../enums/dimension-type.enum.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { IWorldSnapshot } from '../../interfaces/world-store.interface.js';
|
|
3
3
|
import type { IWorldStore } from '../../interfaces/world-store.interface.js';
|
|
4
4
|
export declare class FileWorldStore implements IWorldStore {
|
|
5
5
|
private readonly directory;
|
|
@@ -7,8 +7,8 @@ export declare class FileWorldStore implements IWorldStore {
|
|
|
7
7
|
constructor(directory: string);
|
|
8
8
|
private ensureDirectory;
|
|
9
9
|
private fileFor;
|
|
10
|
-
load(type: EDimensionType): Promise<
|
|
11
|
-
save(type: EDimensionType,
|
|
10
|
+
load(type: EDimensionType): Promise<IWorldSnapshot>;
|
|
11
|
+
save(type: EDimensionType, snapshot: IWorldSnapshot): Promise<void>;
|
|
12
12
|
private quarantine;
|
|
13
13
|
}
|
|
14
14
|
//# sourceMappingURL=file-world-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-world-store.d.ts","sourceRoot":"","sources":["../../../src/world/stores/file-world-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"file-world-store.d.ts","sourceRoot":"","sources":["../../../src/world/stores/file-world-store.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAqC7E,qBAAa,cAAe,YAAW,WAAW;IAChD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,cAAc,CAAS;gBAEnB,SAAS,EAAE,MAAM;YAIf,eAAe;IAO7B,OAAO,CAAC,OAAO;IAIT,IAAI,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;IAsFnD,IAAI,CAAC,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;YAsD3D,UAAU;CAWzB"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { EDimensionType } from '../../enums/dimension-type.enum.js';
|
|
2
|
-
import type {
|
|
3
|
-
import type { IWorldStore } from '../../interfaces/world-store.interface.js';
|
|
2
|
+
import type { IWorldSnapshot, IWorldStore } from '../../interfaces/world-store.interface.js';
|
|
4
3
|
export declare class MemoryWorldStore implements IWorldStore {
|
|
5
4
|
private readonly worlds;
|
|
6
|
-
load(type: EDimensionType): Promise<
|
|
7
|
-
save(type: EDimensionType,
|
|
5
|
+
load(type: EDimensionType): Promise<IWorldSnapshot>;
|
|
6
|
+
save(type: EDimensionType, snapshot: IWorldSnapshot): Promise<void>;
|
|
8
7
|
}
|
|
9
8
|
//# sourceMappingURL=memory-world-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-world-store.d.ts","sourceRoot":"","sources":["../../../src/world/stores/memory-world-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"memory-world-store.d.ts","sourceRoot":"","sources":["../../../src/world/stores/memory-world-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACZ,MAAM,2CAA2C,CAAC;AAMnD,qBAAa,gBAAiB,YAAW,WAAW;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6C;IAE9D,IAAI,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;IAOnD,IAAI,CAAC,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAgB1E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialized-block.d.ts","sourceRoot":"","sources":["../../../src/world/stores/serialized-block.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAG9E,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,gBAAgB,
|
|
1
|
+
{"version":3,"file":"serialized-block.d.ts","sourceRoot":"","sources":["../../../src/world/stores/serialized-block.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAG9E,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,gBAAgB,CAcnE;AAkBD,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI,CAyBlE"}
|