@shirokasoke/webapi-sdk 2.9.0-beta2-0.11-test2 → 2.9.0-beta3-0.13-pre2
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/dist/client.d.ts +16 -3
- package/dist/client.js +12 -3
- package/dist/esm/client.js +12 -3
- package/dist/esm/validators/block.js +10 -1
- package/dist/esm/validators/entity.js +12 -2
- package/dist/esm/validators/fluid.js +6 -0
- package/dist/esm/validators/gt5.js +4 -0
- package/dist/types/block.d.ts +10 -1
- package/dist/types/entity.d.ts +20 -2
- package/dist/types/fluid.d.ts +11 -0
- package/dist/types/gt5.d.ts +4 -0
- package/dist/validators/block.d.ts +2 -2
- package/dist/validators/block.js +10 -1
- package/dist/validators/entity.d.ts +1 -0
- package/dist/validators/entity.js +13 -3
- package/dist/validators/fluid.d.ts +3 -1
- package/dist/validators/fluid.js +7 -1
- package/dist/validators/gt5.d.ts +3 -1
- package/dist/validators/gt5.js +5 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AE2Pattern, AECPU, AECPUCancelBody, AECPUCancelResult, AECraftingTaskBody, AECraftingTaskResult, AEHitResult, AEItemDefinitions, AEItemsResult, AEMEInterface, AENode, BatchSetBlockJobResult, BatchSetBlockSubmitResult, BatchSetBlockTask, Block, BlockDetail, ChunkForceList, ChunkLoadResult, ChunkMapCell, ChunksByDimension, ChunkWithDimension, Coordinates, EntitiesByDimension, Entity, Fluid, FluidContainer, FMPPart, GT5BatchJobResult, GT5BatchMachineCoord, GT5BatchRerunResult, GT5BatchSubmitResult, GT5MachineInfo, GT5ScanJobResult, GT5ScanSubmitResult, Item, ItemDetail, LagAnalyzerData, ProfilerData, RootInfo, SetBlockBody, SetBlockResult, TPSInfo, WorldInfoData, CraftingRecipesResult, FurnaceRecipesResult, GTRecipesResult, GTRecipeMap, PlayerPrintResult, PrintSizeResult, WorldPrintJobResult, WorldPrintSubmitResult } from "./types";
|
|
1
|
+
import type { AE2Pattern, AECPU, AECPUCancelBody, AECPUCancelResult, AECraftingTaskBody, AECraftingTaskResult, AEHitResult, AEItemDefinitions, AEItemsResult, AEMEInterface, AENode, BatchSetBlockJobResult, BatchSetBlockSubmitResult, BatchSetBlockTask, Block, BlockDetail, ChunkForceList, ChunkLoadResult, ChunkMapCell, ChunksByDimension, ChunkWithDimension, Coordinates, EntitiesByDimension, Entity, Fluid, FluidContainer, FMPPart, GT5BatchJobResult, GT5BatchMachineCoord, GT5BatchRerunResult, GT5BatchSubmitResult, GT5MachineInfo, GT5ScanJobResult, GT5ScanSubmitResult, GT5StatusResult, Item, ItemDetail, LagAnalyzerData, ProfilerData, RootInfo, SetBlockBody, SetBlockResult, TPSInfo, WorldInfoData, CraftingRecipesResult, FurnaceRecipesResult, GTRecipesResult, GTRecipeMap, PlayerPrintResult, PrintSizeResult, WorldPrintJobResult, WorldPrintSubmitResult } from "./types";
|
|
2
2
|
export type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
3
3
|
export interface WebApiClientOptions {
|
|
4
4
|
baseUrl: string;
|
|
@@ -9,7 +9,7 @@ export declare class WebApiClient {
|
|
|
9
9
|
private baseUrl;
|
|
10
10
|
private authToken?;
|
|
11
11
|
private fetchImpl;
|
|
12
|
-
SSE: boolean;
|
|
12
|
+
SSE: boolean | undefined;
|
|
13
13
|
constructor(options: WebApiClientOptions);
|
|
14
14
|
private request;
|
|
15
15
|
/**
|
|
@@ -39,7 +39,7 @@ export declare class WebApiClient {
|
|
|
39
39
|
* @returns 服务端 SSE 可用返回 `true`,否则返回 `false`
|
|
40
40
|
* @java [java](../../../src/main/java/love/shirokasoke/webapi/webserver/handlers/test/SSETestHandler.java)
|
|
41
41
|
*/
|
|
42
|
-
|
|
42
|
+
checkSSE(timeoutMs?: number): Promise<boolean>;
|
|
43
43
|
/**
|
|
44
44
|
* @java [java](../../../src/main/java/love/shirokasoke/webapi/webserver/handlers/TPSHandler.java)
|
|
45
45
|
* @returns 使用 `Joi.object().pattern(Joi.string(), {@link TPSInfoSchema})` 验证
|
|
@@ -262,6 +262,19 @@ export declare class WebApiClient {
|
|
|
262
262
|
z: number;
|
|
263
263
|
dim?: number;
|
|
264
264
|
}): Promise<GT5MachineInfo>;
|
|
265
|
+
/**
|
|
266
|
+
* 启停单台 GT5 机器
|
|
267
|
+
*
|
|
268
|
+
* @returns 使用 {@link GT5StatusResultSchema} 验证;`changed=false` 表示机器本就处于目标状态
|
|
269
|
+
* @java [java](../../../src/main/java/love/shirokasoke/webapi/webserver/handlers/gt5/GT5StatusHandler.java)
|
|
270
|
+
*/
|
|
271
|
+
setGT5MachineStatus(params: {
|
|
272
|
+
x: number;
|
|
273
|
+
y: number;
|
|
274
|
+
z: number;
|
|
275
|
+
dim?: number;
|
|
276
|
+
action: "start" | "stop";
|
|
277
|
+
}): Promise<GT5StatusResult>;
|
|
265
278
|
/**
|
|
266
279
|
* 提交批量 GT5 机器查询任务。
|
|
267
280
|
* @java [java](../../../src/main/java/love/shirokasoke/webapi/webserver/handlers/gt5/GT5BatchHandler.java)
|
package/dist/client.js
CHANGED
|
@@ -19,7 +19,7 @@ function unwrapApiResponse(body) {
|
|
|
19
19
|
}
|
|
20
20
|
class WebApiClient {
|
|
21
21
|
constructor(options) {
|
|
22
|
-
this.SSE =
|
|
22
|
+
this.SSE = undefined;
|
|
23
23
|
this.baseUrl = options.baseUrl.replace(/\/$/, "");
|
|
24
24
|
this.authToken = options.authToken;
|
|
25
25
|
const globalFetch = typeof globalThis !== "undefined" ? globalThis.fetch : undefined;
|
|
@@ -130,8 +130,8 @@ class WebApiClient {
|
|
|
130
130
|
* @returns 服务端 SSE 可用返回 `true`,否则返回 `false`
|
|
131
131
|
* @java [java](../../../src/main/java/love/shirokasoke/webapi/webserver/handlers/test/SSETestHandler.java)
|
|
132
132
|
*/
|
|
133
|
-
|
|
134
|
-
if (this.SSE)
|
|
133
|
+
checkSSE(timeoutMs = 500) {
|
|
134
|
+
if (this.SSE != undefined)
|
|
135
135
|
return Promise.resolve(this.SSE);
|
|
136
136
|
return new Promise(resolve => {
|
|
137
137
|
let controller;
|
|
@@ -393,6 +393,15 @@ class WebApiClient {
|
|
|
393
393
|
getGT5Machine(params) {
|
|
394
394
|
return this.request(`/gt5${buildQuery(params)}`);
|
|
395
395
|
}
|
|
396
|
+
/**
|
|
397
|
+
* 启停单台 GT5 机器
|
|
398
|
+
*
|
|
399
|
+
* @returns 使用 {@link GT5StatusResultSchema} 验证;`changed=false` 表示机器本就处于目标状态
|
|
400
|
+
* @java [java](../../../src/main/java/love/shirokasoke/webapi/webserver/handlers/gt5/GT5StatusHandler.java)
|
|
401
|
+
*/
|
|
402
|
+
setGT5MachineStatus(params) {
|
|
403
|
+
return this.request(`/gt5/status${buildQuery(params)}`, { method: "POST" });
|
|
404
|
+
}
|
|
396
405
|
/**
|
|
397
406
|
* 提交批量 GT5 机器查询任务。
|
|
398
407
|
* @java [java](../../../src/main/java/love/shirokasoke/webapi/webserver/handlers/gt5/GT5BatchHandler.java)
|
package/dist/esm/client.js
CHANGED
|
@@ -16,7 +16,7 @@ function unwrapApiResponse(body) {
|
|
|
16
16
|
}
|
|
17
17
|
export class WebApiClient {
|
|
18
18
|
constructor(options) {
|
|
19
|
-
this.SSE =
|
|
19
|
+
this.SSE = undefined;
|
|
20
20
|
this.baseUrl = options.baseUrl.replace(/\/$/, "");
|
|
21
21
|
this.authToken = options.authToken;
|
|
22
22
|
const globalFetch = typeof globalThis !== "undefined" ? globalThis.fetch : undefined;
|
|
@@ -127,8 +127,8 @@ export class WebApiClient {
|
|
|
127
127
|
* @returns 服务端 SSE 可用返回 `true`,否则返回 `false`
|
|
128
128
|
* @java [java](../../../src/main/java/love/shirokasoke/webapi/webserver/handlers/test/SSETestHandler.java)
|
|
129
129
|
*/
|
|
130
|
-
|
|
131
|
-
if (this.SSE)
|
|
130
|
+
checkSSE(timeoutMs = 500) {
|
|
131
|
+
if (this.SSE != undefined)
|
|
132
132
|
return Promise.resolve(this.SSE);
|
|
133
133
|
return new Promise(resolve => {
|
|
134
134
|
let controller;
|
|
@@ -390,6 +390,15 @@ export class WebApiClient {
|
|
|
390
390
|
getGT5Machine(params) {
|
|
391
391
|
return this.request(`/gt5${buildQuery(params)}`);
|
|
392
392
|
}
|
|
393
|
+
/**
|
|
394
|
+
* 启停单台 GT5 机器
|
|
395
|
+
*
|
|
396
|
+
* @returns 使用 {@link GT5StatusResultSchema} 验证;`changed=false` 表示机器本就处于目标状态
|
|
397
|
+
* @java [java](../../../src/main/java/love/shirokasoke/webapi/webserver/handlers/gt5/GT5StatusHandler.java)
|
|
398
|
+
*/
|
|
399
|
+
setGT5MachineStatus(params) {
|
|
400
|
+
return this.request(`/gt5/status${buildQuery(params)}`, { method: "POST" });
|
|
401
|
+
}
|
|
393
402
|
/**
|
|
394
403
|
* 提交批量 GT5 机器查询任务。
|
|
395
404
|
* @java [java](../../../src/main/java/love/shirokasoke/webapi/webserver/handlers/gt5/GT5BatchHandler.java)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Joi from "joi";
|
|
2
2
|
import { ClassInfoSchema, CoordinatesSchema } from "./common";
|
|
3
|
+
import { FluidTankSchema } from "./fluid";
|
|
3
4
|
import { ItemStackSchema, NBTCompoundSchema } from "./item";
|
|
4
5
|
export const MaterialSchema = Joi.object({
|
|
5
6
|
isLiquid: Joi.boolean().required(),
|
|
@@ -43,14 +44,19 @@ export const BlockDetailSchema = Joi.object({
|
|
|
43
44
|
class: ClassInfoSchema.optional(),
|
|
44
45
|
inventorySize: Joi.number().optional(),
|
|
45
46
|
items: Joi.array().items(ItemStackSchema.append({ slot: Joi.number().required() })).optional(),
|
|
47
|
+
fluids: Joi.array().items(FluidTankSchema).optional(),
|
|
46
48
|
}).optional(),
|
|
47
49
|
});
|
|
48
50
|
export const SetBlockBodySchema = Joi.object({
|
|
49
51
|
id: Joi.number().required(),
|
|
50
52
|
metadataIn: Joi.number().optional(),
|
|
51
53
|
flag: Joi.number().optional(),
|
|
54
|
+
nbt: Joi.string().optional(),
|
|
55
|
+
});
|
|
56
|
+
export const SetBlockResultSchema = Joi.object({
|
|
57
|
+
changed: Joi.boolean().required(),
|
|
58
|
+
nbtchanged: Joi.boolean().required(),
|
|
52
59
|
});
|
|
53
|
-
export const SetBlockResultSchema = Joi.valid(null);
|
|
54
60
|
export const BatchSetBlockTaskSchema = Joi.object({
|
|
55
61
|
x: Joi.number().required(),
|
|
56
62
|
y: Joi.number().required(),
|
|
@@ -59,6 +65,7 @@ export const BatchSetBlockTaskSchema = Joi.object({
|
|
|
59
65
|
id: Joi.number().required(),
|
|
60
66
|
metadata: Joi.number().optional(),
|
|
61
67
|
flag: Joi.number().optional(),
|
|
68
|
+
nbt: Joi.string().optional(),
|
|
62
69
|
});
|
|
63
70
|
export const BatchSetBlockSubmitResultSchema = Joi.object({
|
|
64
71
|
id: Joi.string().required(),
|
|
@@ -77,6 +84,8 @@ export const BatchSetBlockJobResultSchema = Joi.object({
|
|
|
77
84
|
completed: Joi.number().required(),
|
|
78
85
|
success: Joi.number().required(),
|
|
79
86
|
failed: Joi.number().required(),
|
|
87
|
+
changed: Joi.number().required(),
|
|
88
|
+
nbtchanged: Joi.number().required(),
|
|
80
89
|
status: BatchSetBlockJobStatusSchema.required(),
|
|
81
90
|
createTime: Joi.number().required(),
|
|
82
91
|
finishTime: Joi.number().optional(),
|
|
@@ -79,10 +79,20 @@ export const EntityLivingBaseInfoSchema = Joi.object({
|
|
|
79
79
|
lastAttackerId: Joi.number().optional(),
|
|
80
80
|
activePotionEffects: Joi.object().pattern(Joi.string(), PotionEffectSchema).optional(),
|
|
81
81
|
});
|
|
82
|
+
export const PlayerAbilitiesSchema = Joi.object({
|
|
83
|
+
walkSpeed: Joi.number().required(),
|
|
84
|
+
flySpeed: Joi.number().required(),
|
|
85
|
+
flying: Joi.number().required(),
|
|
86
|
+
instabuild: Joi.number().required(),
|
|
87
|
+
mayfly: Joi.number().required(),
|
|
88
|
+
invulnerable: Joi.number().required(),
|
|
89
|
+
mayBuild: Joi.number().required(),
|
|
90
|
+
});
|
|
82
91
|
export const PlayerInfoSchema = Joi.object({
|
|
83
92
|
experienceLevel: Joi.number().required(),
|
|
84
93
|
experience: Joi.number().required(),
|
|
85
94
|
experienceTotal: Joi.number().required(),
|
|
95
|
+
abilities: PlayerAbilitiesSchema.required(),
|
|
86
96
|
isSleeping: Joi.boolean().required(),
|
|
87
97
|
isBlocking: Joi.boolean().required(),
|
|
88
98
|
score: Joi.number().required(),
|
|
@@ -91,8 +101,8 @@ export const PlayerInfoSchema = Joi.object({
|
|
|
91
101
|
saturationLevel: Joi.number().required(),
|
|
92
102
|
}).required(),
|
|
93
103
|
heldItem: ItemStackSchema.optional(),
|
|
94
|
-
armor: Joi.array().items(Joi.alternatives(ItemStackSchema, Joi.valid(null))).
|
|
95
|
-
items: Joi.array().items(ItemStackSchema.append({ slot: Joi.number().required() })).
|
|
104
|
+
armor: Joi.array().items(Joi.alternatives(ItemStackSchema, Joi.valid(null))).required(),
|
|
105
|
+
items: Joi.array().items(ItemStackSchema.append({ slot: Joi.number().required() })).required(),
|
|
96
106
|
});
|
|
97
107
|
export const EntitySchema = Joi.object({
|
|
98
108
|
Entity: EntityBaseSchema.concat(NBTDataSchema).required(),
|
|
@@ -16,6 +16,12 @@ export const FluidSchema = Joi.object({
|
|
|
16
16
|
gaseous: Joi.boolean().required(),
|
|
17
17
|
block: Joi.number().optional(),
|
|
18
18
|
});
|
|
19
|
+
/** 流体储罐 */
|
|
20
|
+
export const FluidTankSchema = FluidSchema.append({
|
|
21
|
+
index: Joi.number().required(),
|
|
22
|
+
amount: Joi.number().required(),
|
|
23
|
+
capacity: Joi.number().required(),
|
|
24
|
+
});
|
|
19
25
|
export const FluidContainerSchema = Joi.object({
|
|
20
26
|
fluid: FluidSchema.optional(),
|
|
21
27
|
amount: Joi.number().optional(),
|
|
@@ -114,6 +114,10 @@ export const GT5MachineInfoSchema = Joi.object({
|
|
|
114
114
|
class: ClassInfoSchema.optional(),
|
|
115
115
|
nbt: NBTCompoundSchema.required(),
|
|
116
116
|
}).concat(GT5MachineFieldsSchema);
|
|
117
|
+
export const GT5StatusActionSchema = Joi.string().valid("start", "stop");
|
|
118
|
+
export const GT5StatusResultSchema = Joi.object({
|
|
119
|
+
changed: Joi.boolean().required(),
|
|
120
|
+
});
|
|
117
121
|
export const GT5BatchMachineCoordSchema = Joi.object({
|
|
118
122
|
x: Joi.number().required(),
|
|
119
123
|
y: Joi.number().required(),
|
package/dist/types/block.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ClassInfo } from "./common";
|
|
2
|
+
import type { FluidTank } from "./fluid";
|
|
2
3
|
import type { ItemStack, NBTCompound } from "./item";
|
|
3
4
|
export interface Material {
|
|
4
5
|
isLiquid: boolean;
|
|
@@ -45,14 +46,19 @@ export interface BlockDetail {
|
|
|
45
46
|
items?: Array<ItemStack & {
|
|
46
47
|
slot: number;
|
|
47
48
|
}>;
|
|
49
|
+
fluids?: FluidTank[];
|
|
48
50
|
};
|
|
49
51
|
}
|
|
50
52
|
export interface SetBlockBody {
|
|
51
53
|
id: number;
|
|
52
54
|
metadataIn?: number;
|
|
53
55
|
flag?: number;
|
|
56
|
+
nbt?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface SetBlockResult {
|
|
59
|
+
changed: boolean;
|
|
60
|
+
nbtchanged: boolean;
|
|
54
61
|
}
|
|
55
|
-
export type SetBlockResult = null;
|
|
56
62
|
export interface BatchSetBlockTask {
|
|
57
63
|
x: number;
|
|
58
64
|
y: number;
|
|
@@ -61,6 +67,7 @@ export interface BatchSetBlockTask {
|
|
|
61
67
|
id: number;
|
|
62
68
|
metadata?: number;
|
|
63
69
|
flag?: number;
|
|
70
|
+
nbt?: string;
|
|
64
71
|
}
|
|
65
72
|
export interface BatchSetBlockSubmitResult {
|
|
66
73
|
id: string;
|
|
@@ -79,6 +86,8 @@ export interface BatchSetBlockJobResult {
|
|
|
79
86
|
completed: number;
|
|
80
87
|
success: number;
|
|
81
88
|
failed: number;
|
|
89
|
+
changed: number;
|
|
90
|
+
nbtchanged: number;
|
|
82
91
|
status: BatchSetBlockJobStatus;
|
|
83
92
|
createTime: number;
|
|
84
93
|
finishTime?: number;
|
package/dist/types/entity.d.ts
CHANGED
|
@@ -81,10 +81,25 @@ export interface EntityLivingBaseInfo {
|
|
|
81
81
|
lastAttackerId?: number;
|
|
82
82
|
activePotionEffects?: Record<string, PotionEffect>;
|
|
83
83
|
}
|
|
84
|
+
export interface PlayerAbilities {
|
|
85
|
+
walkSpeed: number;
|
|
86
|
+
flySpeed: number;
|
|
87
|
+
/** 是否飞行中 */
|
|
88
|
+
flying: number;
|
|
89
|
+
/** 是否可瞬间破坏方块(创造模式) */
|
|
90
|
+
instabuild: number;
|
|
91
|
+
/** 是否允许飞行 */
|
|
92
|
+
mayfly: number;
|
|
93
|
+
/** 是否无敌 */
|
|
94
|
+
invulnerable: number;
|
|
95
|
+
/** 是否允许修改方块 */
|
|
96
|
+
mayBuild: number;
|
|
97
|
+
}
|
|
84
98
|
export interface PlayerInfo {
|
|
85
99
|
experienceLevel: number;
|
|
86
100
|
experience: number;
|
|
87
101
|
experienceTotal: number;
|
|
102
|
+
abilities: PlayerAbilities;
|
|
88
103
|
isSleeping: boolean;
|
|
89
104
|
isBlocking: boolean;
|
|
90
105
|
score: number;
|
|
@@ -92,9 +107,12 @@ export interface PlayerInfo {
|
|
|
92
107
|
foodLevel: number;
|
|
93
108
|
saturationLevel: number;
|
|
94
109
|
};
|
|
110
|
+
/** 主手物品,未持有物品时不输出 */
|
|
95
111
|
heldItem?: ItemStack;
|
|
96
|
-
|
|
97
|
-
|
|
112
|
+
/** 4 格盔甲槽,空槽为 null */
|
|
113
|
+
armor: (ItemStack | null)[];
|
|
114
|
+
/** 主背包中的非空物品 */
|
|
115
|
+
items: Array<ItemStack & {
|
|
98
116
|
slot: number;
|
|
99
117
|
}>;
|
|
100
118
|
}
|
package/dist/types/fluid.d.ts
CHANGED
|
@@ -15,6 +15,17 @@ export interface Fluid {
|
|
|
15
15
|
gaseous: boolean;
|
|
16
16
|
block?: number;
|
|
17
17
|
}
|
|
18
|
+
export interface FluidTank extends Fluid {
|
|
19
|
+
/**
|
|
20
|
+
* 储罐索引
|
|
21
|
+
* @example 从 0-5 分别对应 下上北南西东
|
|
22
|
+
*/
|
|
23
|
+
index: number;
|
|
24
|
+
/** 当前存储量(mB) */
|
|
25
|
+
amount: number;
|
|
26
|
+
/** 储罐容量(mB) */
|
|
27
|
+
capacity: number;
|
|
28
|
+
}
|
|
18
29
|
export interface FluidContainer {
|
|
19
30
|
fluid?: Fluid;
|
|
20
31
|
amount?: number;
|
package/dist/types/gt5.d.ts
CHANGED
|
@@ -133,6 +133,10 @@ export type GT5MachineInfo = {
|
|
|
133
133
|
class?: ClassInfo;
|
|
134
134
|
nbt: NBTCompound;
|
|
135
135
|
} & GT5Machine;
|
|
136
|
+
export interface GT5StatusResult {
|
|
137
|
+
/** 状态是否实际发生变化;机器已处于目标状态时为 false */
|
|
138
|
+
changed: boolean;
|
|
139
|
+
}
|
|
136
140
|
export interface GT5BatchMachineCoord {
|
|
137
141
|
x: number;
|
|
138
142
|
y: number;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import Joi from "joi";
|
|
2
|
-
import type { BatchSetBlockJobResult, Block, BlockDetail } from "../types/block";
|
|
2
|
+
import type { BatchSetBlockJobResult, Block, BlockDetail, SetBlockResult } from "../types/block";
|
|
3
3
|
export declare const MaterialSchema: Joi.ObjectSchema<any>;
|
|
4
4
|
export declare const BlockSchema: Joi.ObjectSchema<Block>;
|
|
5
5
|
export declare const BlockDetailSchema: Joi.ObjectSchema<BlockDetail>;
|
|
6
6
|
export declare const SetBlockBodySchema: Joi.ObjectSchema<any>;
|
|
7
|
-
export declare const SetBlockResultSchema: Joi.
|
|
7
|
+
export declare const SetBlockResultSchema: Joi.ObjectSchema<SetBlockResult>;
|
|
8
8
|
export declare const BatchSetBlockTaskSchema: Joi.ObjectSchema<any>;
|
|
9
9
|
export declare const BatchSetBlockSubmitResultSchema: Joi.ObjectSchema<any>;
|
|
10
10
|
export declare const BatchSetBlockJobStatusSchema: Joi.Schema<any>;
|
package/dist/validators/block.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.BatchSetBlockJobResultSchema = exports.BatchSetBlockFailureSchema = exports.BatchSetBlockJobStatusSchema = exports.BatchSetBlockSubmitResultSchema = exports.BatchSetBlockTaskSchema = exports.SetBlockResultSchema = exports.SetBlockBodySchema = exports.BlockDetailSchema = exports.BlockSchema = exports.MaterialSchema = void 0;
|
|
7
7
|
const joi_1 = __importDefault(require("joi"));
|
|
8
8
|
const common_1 = require("./common");
|
|
9
|
+
const fluid_1 = require("./fluid");
|
|
9
10
|
const item_1 = require("./item");
|
|
10
11
|
exports.MaterialSchema = joi_1.default.object({
|
|
11
12
|
isLiquid: joi_1.default.boolean().required(),
|
|
@@ -49,14 +50,19 @@ exports.BlockDetailSchema = joi_1.default.object({
|
|
|
49
50
|
class: common_1.ClassInfoSchema.optional(),
|
|
50
51
|
inventorySize: joi_1.default.number().optional(),
|
|
51
52
|
items: joi_1.default.array().items(item_1.ItemStackSchema.append({ slot: joi_1.default.number().required() })).optional(),
|
|
53
|
+
fluids: joi_1.default.array().items(fluid_1.FluidTankSchema).optional(),
|
|
52
54
|
}).optional(),
|
|
53
55
|
});
|
|
54
56
|
exports.SetBlockBodySchema = joi_1.default.object({
|
|
55
57
|
id: joi_1.default.number().required(),
|
|
56
58
|
metadataIn: joi_1.default.number().optional(),
|
|
57
59
|
flag: joi_1.default.number().optional(),
|
|
60
|
+
nbt: joi_1.default.string().optional(),
|
|
61
|
+
});
|
|
62
|
+
exports.SetBlockResultSchema = joi_1.default.object({
|
|
63
|
+
changed: joi_1.default.boolean().required(),
|
|
64
|
+
nbtchanged: joi_1.default.boolean().required(),
|
|
58
65
|
});
|
|
59
|
-
exports.SetBlockResultSchema = joi_1.default.valid(null);
|
|
60
66
|
exports.BatchSetBlockTaskSchema = joi_1.default.object({
|
|
61
67
|
x: joi_1.default.number().required(),
|
|
62
68
|
y: joi_1.default.number().required(),
|
|
@@ -65,6 +71,7 @@ exports.BatchSetBlockTaskSchema = joi_1.default.object({
|
|
|
65
71
|
id: joi_1.default.number().required(),
|
|
66
72
|
metadata: joi_1.default.number().optional(),
|
|
67
73
|
flag: joi_1.default.number().optional(),
|
|
74
|
+
nbt: joi_1.default.string().optional(),
|
|
68
75
|
});
|
|
69
76
|
exports.BatchSetBlockSubmitResultSchema = joi_1.default.object({
|
|
70
77
|
id: joi_1.default.string().required(),
|
|
@@ -83,6 +90,8 @@ exports.BatchSetBlockJobResultSchema = joi_1.default.object({
|
|
|
83
90
|
completed: joi_1.default.number().required(),
|
|
84
91
|
success: joi_1.default.number().required(),
|
|
85
92
|
failed: joi_1.default.number().required(),
|
|
93
|
+
changed: joi_1.default.number().required(),
|
|
94
|
+
nbtchanged: joi_1.default.number().required(),
|
|
86
95
|
status: exports.BatchSetBlockJobStatusSchema.required(),
|
|
87
96
|
createTime: joi_1.default.number().required(),
|
|
88
97
|
finishTime: joi_1.default.number().optional(),
|
|
@@ -3,6 +3,7 @@ import type { EntitiesByDimension, Entity } from "../types/entity";
|
|
|
3
3
|
export declare const EntityBaseSchema: Joi.ObjectSchema<any>;
|
|
4
4
|
export declare const PotionEffectSchema: Joi.ObjectSchema<any>;
|
|
5
5
|
export declare const EntityLivingBaseInfoSchema: Joi.ObjectSchema<any>;
|
|
6
|
+
export declare const PlayerAbilitiesSchema: Joi.ObjectSchema<any>;
|
|
6
7
|
export declare const PlayerInfoSchema: Joi.ObjectSchema<any>;
|
|
7
8
|
export declare const EntitySchema: Joi.ObjectSchema<Entity>;
|
|
8
9
|
export declare const EntitySummarySchema: Joi.ObjectSchema<any>;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.EntitiesByDimensionSchema = exports.EntitySummarySchema = exports.EntitySchema = exports.PlayerInfoSchema = exports.EntityLivingBaseInfoSchema = exports.PotionEffectSchema = exports.EntityBaseSchema = void 0;
|
|
6
|
+
exports.EntitiesByDimensionSchema = exports.EntitySummarySchema = exports.EntitySchema = exports.PlayerInfoSchema = exports.PlayerAbilitiesSchema = exports.EntityLivingBaseInfoSchema = exports.PotionEffectSchema = exports.EntityBaseSchema = void 0;
|
|
7
7
|
const joi_1 = __importDefault(require("joi"));
|
|
8
8
|
const common_1 = require("./common");
|
|
9
9
|
const item_1 = require("./item");
|
|
@@ -85,10 +85,20 @@ exports.EntityLivingBaseInfoSchema = joi_1.default.object({
|
|
|
85
85
|
lastAttackerId: joi_1.default.number().optional(),
|
|
86
86
|
activePotionEffects: joi_1.default.object().pattern(joi_1.default.string(), exports.PotionEffectSchema).optional(),
|
|
87
87
|
});
|
|
88
|
+
exports.PlayerAbilitiesSchema = joi_1.default.object({
|
|
89
|
+
walkSpeed: joi_1.default.number().required(),
|
|
90
|
+
flySpeed: joi_1.default.number().required(),
|
|
91
|
+
flying: joi_1.default.number().required(),
|
|
92
|
+
instabuild: joi_1.default.number().required(),
|
|
93
|
+
mayfly: joi_1.default.number().required(),
|
|
94
|
+
invulnerable: joi_1.default.number().required(),
|
|
95
|
+
mayBuild: joi_1.default.number().required(),
|
|
96
|
+
});
|
|
88
97
|
exports.PlayerInfoSchema = joi_1.default.object({
|
|
89
98
|
experienceLevel: joi_1.default.number().required(),
|
|
90
99
|
experience: joi_1.default.number().required(),
|
|
91
100
|
experienceTotal: joi_1.default.number().required(),
|
|
101
|
+
abilities: exports.PlayerAbilitiesSchema.required(),
|
|
92
102
|
isSleeping: joi_1.default.boolean().required(),
|
|
93
103
|
isBlocking: joi_1.default.boolean().required(),
|
|
94
104
|
score: joi_1.default.number().required(),
|
|
@@ -97,8 +107,8 @@ exports.PlayerInfoSchema = joi_1.default.object({
|
|
|
97
107
|
saturationLevel: joi_1.default.number().required(),
|
|
98
108
|
}).required(),
|
|
99
109
|
heldItem: item_1.ItemStackSchema.optional(),
|
|
100
|
-
armor: joi_1.default.array().items(joi_1.default.alternatives(item_1.ItemStackSchema, joi_1.default.valid(null))).
|
|
101
|
-
items: joi_1.default.array().items(item_1.ItemStackSchema.append({ slot: joi_1.default.number().required() })).
|
|
110
|
+
armor: joi_1.default.array().items(joi_1.default.alternatives(item_1.ItemStackSchema, joi_1.default.valid(null))).required(),
|
|
111
|
+
items: joi_1.default.array().items(item_1.ItemStackSchema.append({ slot: joi_1.default.number().required() })).required(),
|
|
102
112
|
});
|
|
103
113
|
exports.EntitySchema = joi_1.default.object({
|
|
104
114
|
Entity: exports.EntityBaseSchema.concat(item_1.NBTDataSchema).required(),
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import Joi from "joi";
|
|
2
|
-
import type { Fluid, FluidContainer } from "../types/fluid";
|
|
2
|
+
import type { Fluid, FluidContainer, FluidTank } from "../types/fluid";
|
|
3
3
|
export declare const FluidSchema: Joi.ObjectSchema<Fluid>;
|
|
4
|
+
/** 流体储罐 */
|
|
5
|
+
export declare const FluidTankSchema: Joi.ObjectSchema<FluidTank>;
|
|
4
6
|
export declare const FluidContainerSchema: Joi.ObjectSchema<FluidContainer>;
|
package/dist/validators/fluid.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.FluidContainerSchema = exports.FluidSchema = void 0;
|
|
6
|
+
exports.FluidContainerSchema = exports.FluidTankSchema = exports.FluidSchema = void 0;
|
|
7
7
|
const joi_1 = __importDefault(require("joi"));
|
|
8
8
|
const common_1 = require("./common");
|
|
9
9
|
const item_1 = require("./item");
|
|
@@ -22,6 +22,12 @@ exports.FluidSchema = joi_1.default.object({
|
|
|
22
22
|
gaseous: joi_1.default.boolean().required(),
|
|
23
23
|
block: joi_1.default.number().optional(),
|
|
24
24
|
});
|
|
25
|
+
/** 流体储罐 */
|
|
26
|
+
exports.FluidTankSchema = exports.FluidSchema.append({
|
|
27
|
+
index: joi_1.default.number().required(),
|
|
28
|
+
amount: joi_1.default.number().required(),
|
|
29
|
+
capacity: joi_1.default.number().required(),
|
|
30
|
+
});
|
|
25
31
|
exports.FluidContainerSchema = joi_1.default.object({
|
|
26
32
|
fluid: exports.FluidSchema.optional(),
|
|
27
33
|
amount: joi_1.default.number().optional(),
|
package/dist/validators/gt5.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Joi from "joi";
|
|
2
|
-
import type { GT5BatchJobResult, GT5BatchMachineCoord, GT5BatchSubmitResult, GT5MachineInfo, GT5ScanJobResult } from "../types/gt5";
|
|
2
|
+
import type { GT5BatchJobResult, GT5BatchMachineCoord, GT5BatchSubmitResult, GT5MachineInfo, GT5ScanJobResult, GT5StatusResult } from "../types/gt5";
|
|
3
3
|
export declare const GT5MachineTypeSchema: Joi.StringSchema<string>;
|
|
4
4
|
export declare const GT5ShutDownReasonSchema: Joi.ObjectSchema<any>;
|
|
5
5
|
export declare const GT5MachineIOSchema: Joi.ObjectSchema<any>;
|
|
@@ -12,6 +12,8 @@ export declare const GT5HatchInfoSchema: Joi.ObjectSchema<any>;
|
|
|
12
12
|
export declare const GT5SingleBlockInfoSchema: Joi.ObjectSchema<any>;
|
|
13
13
|
export declare const GT5GeneratorInfoSchema: Joi.ObjectSchema<any>;
|
|
14
14
|
export declare const GT5MachineInfoSchema: Joi.ObjectSchema<GT5MachineInfo>;
|
|
15
|
+
export declare const GT5StatusActionSchema: Joi.StringSchema<string>;
|
|
16
|
+
export declare const GT5StatusResultSchema: Joi.ObjectSchema<GT5StatusResult>;
|
|
15
17
|
export declare const GT5BatchMachineCoordSchema: Joi.ObjectSchema<GT5BatchMachineCoord>;
|
|
16
18
|
export declare const GT5BatchSubmitResultSchema: Joi.ObjectSchema<GT5BatchSubmitResult>;
|
|
17
19
|
export declare const GT5BatchRerunResultSchema: Joi.ObjectSchema<any>;
|
package/dist/validators/gt5.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.GT5ScanJobResultSchema = exports.GT5ScanJobStatusSchema = exports.GT5ScanResultSchema = exports.GT5ScanMachineSchema = exports.GT5ScanSubmitResultSchema = exports.GT5BatchJobResultSchema = exports.GT5BatchJobStatusSchema = exports.GT5BatchRerunResultSchema = exports.GT5BatchSubmitResultSchema = exports.GT5BatchMachineCoordSchema = exports.GT5MachineInfoSchema = exports.GT5GeneratorInfoSchema = exports.GT5SingleBlockInfoSchema = exports.GT5HatchInfoSchema = exports.GT5MultiBlockInfoSchema = exports.GT5HatchesSchema = exports.GT5MaintenanceStateSchema = exports.GT5HatchCoordSchema = exports.GT5MachineStateSchema = exports.GT5MachineIOSchema = exports.GT5ShutDownReasonSchema = exports.GT5MachineTypeSchema = void 0;
|
|
6
|
+
exports.GT5ScanJobResultSchema = exports.GT5ScanJobStatusSchema = exports.GT5ScanResultSchema = exports.GT5ScanMachineSchema = exports.GT5ScanSubmitResultSchema = exports.GT5BatchJobResultSchema = exports.GT5BatchJobStatusSchema = exports.GT5BatchRerunResultSchema = exports.GT5BatchSubmitResultSchema = exports.GT5BatchMachineCoordSchema = exports.GT5StatusResultSchema = exports.GT5StatusActionSchema = exports.GT5MachineInfoSchema = exports.GT5GeneratorInfoSchema = exports.GT5SingleBlockInfoSchema = exports.GT5HatchInfoSchema = exports.GT5MultiBlockInfoSchema = exports.GT5HatchesSchema = exports.GT5MaintenanceStateSchema = exports.GT5HatchCoordSchema = exports.GT5MachineStateSchema = exports.GT5MachineIOSchema = exports.GT5ShutDownReasonSchema = exports.GT5MachineTypeSchema = void 0;
|
|
7
7
|
const joi_1 = __importDefault(require("joi"));
|
|
8
8
|
const common_1 = require("./common");
|
|
9
9
|
const fluid_1 = require("./fluid");
|
|
@@ -120,6 +120,10 @@ exports.GT5MachineInfoSchema = joi_1.default.object({
|
|
|
120
120
|
class: common_1.ClassInfoSchema.optional(),
|
|
121
121
|
nbt: item_1.NBTCompoundSchema.required(),
|
|
122
122
|
}).concat(GT5MachineFieldsSchema);
|
|
123
|
+
exports.GT5StatusActionSchema = joi_1.default.string().valid("start", "stop");
|
|
124
|
+
exports.GT5StatusResultSchema = joi_1.default.object({
|
|
125
|
+
changed: joi_1.default.boolean().required(),
|
|
126
|
+
});
|
|
123
127
|
exports.GT5BatchMachineCoordSchema = joi_1.default.object({
|
|
124
128
|
x: joi_1.default.number().required(),
|
|
125
129
|
y: joi_1.default.number().required(),
|
package/package.json
CHANGED