@shirokasoke/webapi-sdk 2.9.0-1.2
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 +95 -0
- package/dist/client.d.ts +682 -0
- package/dist/client.js +793 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +23 -0
- package/dist/types/ae2.d.ts +241 -0
- package/dist/types/ae2.js +2 -0
- package/dist/types/block.d.ts +97 -0
- package/dist/types/block.js +2 -0
- package/dist/types/chunk.d.ts +58 -0
- package/dist/types/chunk.js +2 -0
- package/dist/types/common.d.ts +33 -0
- package/dist/types/common.js +2 -0
- package/dist/types/entity.d.ts +132 -0
- package/dist/types/entity.js +2 -0
- package/dist/types/fluid.d.ts +34 -0
- package/dist/types/fluid.js +2 -0
- package/dist/types/fmp.d.ts +33 -0
- package/dist/types/fmp.js +2 -0
- package/dist/types/gt5.d.ts +306 -0
- package/dist/types/gt5.js +2 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.js +29 -0
- package/dist/types/item.d.ts +45 -0
- package/dist/types/item.js +2 -0
- package/dist/types/rawInfo.d.ts +25 -0
- package/dist/types/rawInfo.js +2 -0
- package/dist/types/recipe.d.ts +114 -0
- package/dist/types/recipe.js +2 -0
- package/dist/types/threeD.d.ts +43 -0
- package/dist/types/threeD.js +2 -0
- package/dist/types/world.d.ts +58 -0
- package/dist/types/world.js +2 -0
- package/dist/utils/ae2.d.ts +42 -0
- package/dist/utils/ae2.js +89 -0
- package/dist/validators/ae2.d.ts +85 -0
- package/dist/validators/ae2.js +234 -0
- package/dist/validators/block.d.ts +12 -0
- package/dist/validators/block.js +101 -0
- package/dist/validators/chunk.d.ts +9 -0
- package/dist/validators/chunk.js +65 -0
- package/dist/validators/common.d.ts +8 -0
- package/dist/validators/common.js +38 -0
- package/dist/validators/entity.d.ts +10 -0
- package/dist/validators/entity.js +133 -0
- package/dist/validators/fluid.d.ts +6 -0
- package/dist/validators/fluid.js +36 -0
- package/dist/validators/fmp.d.ts +4 -0
- package/dist/validators/fmp.js +40 -0
- package/dist/validators/gt5.d.ts +35 -0
- package/dist/validators/gt5.js +259 -0
- package/dist/validators/index.d.ts +13 -0
- package/dist/validators/index.js +29 -0
- package/dist/validators/item.d.ts +14 -0
- package/dist/validators/item.js +39 -0
- package/dist/validators/rawInfo.d.ts +6 -0
- package/dist/validators/rawInfo.js +31 -0
- package/dist/validators/recipe.d.ts +30 -0
- package/dist/validators/recipe.js +83 -0
- package/dist/validators/threeD.d.ts +8 -0
- package/dist/validators/threeD.js +40 -0
- package/dist/validators/world.d.ts +5 -0
- package/dist/validators/world.js +65 -0
- package/package.json +42 -0
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.WebApiError = exports.WebApiClient = void 0;
|
|
18
|
+
var client_1 = require("./client");
|
|
19
|
+
Object.defineProperty(exports, "WebApiClient", { enumerable: true, get: function () { return client_1.WebApiClient; } });
|
|
20
|
+
Object.defineProperty(exports, "WebApiError", { enumerable: true, get: function () { return client_1.WebApiError; } });
|
|
21
|
+
__exportStar(require("./types"), exports);
|
|
22
|
+
__exportStar(require("./validators"), exports);
|
|
23
|
+
__exportStar(require("./utils/ae2"), exports);
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import type { ApiErrorResponse, ClassInfo } from "./common";
|
|
2
|
+
import type { Fluid } from "./fluid";
|
|
3
|
+
import type { ItemStack } from "./item";
|
|
4
|
+
export type AEStack = (ItemStack | Fluid) & {
|
|
5
|
+
stackSize: number;
|
|
6
|
+
};
|
|
7
|
+
export interface AEStackProviders {
|
|
8
|
+
providers: Array<{
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
z: number;
|
|
12
|
+
dimension: number;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
export interface AENode {
|
|
16
|
+
active: boolean;
|
|
17
|
+
meetsChannel: boolean;
|
|
18
|
+
playerID: number;
|
|
19
|
+
machineClass?: ClassInfo;
|
|
20
|
+
isPart: boolean;
|
|
21
|
+
isIActionHost: boolean;
|
|
22
|
+
location?: {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
z: number;
|
|
26
|
+
dimension: number;
|
|
27
|
+
};
|
|
28
|
+
idlePowerUsage: number;
|
|
29
|
+
flags: string[];
|
|
30
|
+
}
|
|
31
|
+
export interface AE2Pattern extends ItemStack {
|
|
32
|
+
crafting: boolean;
|
|
33
|
+
substitute: boolean;
|
|
34
|
+
beSubstitute: boolean;
|
|
35
|
+
author?: string;
|
|
36
|
+
inputs?: (ItemStack | null)[];
|
|
37
|
+
outputs?: (ItemStack | null)[];
|
|
38
|
+
isCraftable?: boolean;
|
|
39
|
+
priority?: number;
|
|
40
|
+
canSubstitute?: boolean;
|
|
41
|
+
canBeSubstitute?: boolean;
|
|
42
|
+
condensedInputs?: AEStack[];
|
|
43
|
+
condensedOutputs?: AEStack[];
|
|
44
|
+
patternParseError?: string;
|
|
45
|
+
}
|
|
46
|
+
/** `appeng.api.networking.crafting.CraftingAllowMode` 枚举名 */
|
|
47
|
+
export type AECraftingAllowMode = "YES" | "NO" | "ONLY_PLAYERS" | string;
|
|
48
|
+
/**
|
|
49
|
+
* `appeng.util.ScheduledReason` 枚举名,表示任务的调度原因。
|
|
50
|
+
* 类型侧保留开放联合
|
|
51
|
+
*/
|
|
52
|
+
export type AECPUScheduledReason = "UNDEFINED" | "SOMETHING_STUCK" | "BLOCKING_MODE" | "LOCK_MODE" | "NO_TARGET" | "NOT_ENOUGH_INGREDIENTS" | "SAME_NETWORK" | "UNSUPPORTED_STACK" | (string & {});
|
|
53
|
+
/** 合成 CPU 中正在进行的单个并行合成任务 */
|
|
54
|
+
export interface AECPUTask {
|
|
55
|
+
/** 剩余执行次数 */
|
|
56
|
+
remaining: number;
|
|
57
|
+
/** 任务调度原因(ScheduledReason 枚举名) */
|
|
58
|
+
scheduledReason: AECPUScheduledReason;
|
|
59
|
+
inputs: AEStack[];
|
|
60
|
+
pattern: AE2Pattern;
|
|
61
|
+
outputs: Array<AEStack & AEStackProviders>;
|
|
62
|
+
}
|
|
63
|
+
export interface AECPU {
|
|
64
|
+
name: string;
|
|
65
|
+
busy: boolean;
|
|
66
|
+
availableStorage: number;
|
|
67
|
+
usedStorage: number;
|
|
68
|
+
coProcessors: number;
|
|
69
|
+
remainingItemCount: number;
|
|
70
|
+
startItemCount: number;
|
|
71
|
+
elapsedTime: number;
|
|
72
|
+
/** `CraftingAllowMode` 枚举名 */
|
|
73
|
+
craftingAllowMode: AECraftingAllowMode;
|
|
74
|
+
/** 是否有任务处于等待中 */
|
|
75
|
+
waiting: boolean;
|
|
76
|
+
/** 是否已挂起 */
|
|
77
|
+
suspended: boolean;
|
|
78
|
+
/** 是否处于缺少原料模式 */
|
|
79
|
+
missingMode: boolean;
|
|
80
|
+
finalOutput?: AEStack;
|
|
81
|
+
/** 等待缺失的原料(服务端仅在非空时输出) */
|
|
82
|
+
waitingForMissing?: AEStack[];
|
|
83
|
+
tasks?: AECPUTask[];
|
|
84
|
+
tasking?: Array<AEStack & AEStackProviders>;
|
|
85
|
+
tasksError?: string;
|
|
86
|
+
}
|
|
87
|
+
export interface AEMEInterface {
|
|
88
|
+
display: boolean;
|
|
89
|
+
name: string;
|
|
90
|
+
rawName: string | null;
|
|
91
|
+
active: boolean;
|
|
92
|
+
allowsPatternOptimization: boolean;
|
|
93
|
+
playerID: number;
|
|
94
|
+
location: {
|
|
95
|
+
x: number;
|
|
96
|
+
y: number;
|
|
97
|
+
z: number;
|
|
98
|
+
dimension: number;
|
|
99
|
+
};
|
|
100
|
+
patterns: Array<AE2Pattern & {
|
|
101
|
+
slot: number;
|
|
102
|
+
}>;
|
|
103
|
+
}
|
|
104
|
+
export interface AECraftingTaskBody {
|
|
105
|
+
/** 物品 ID;当 Type 为 "fluid" 时表示流体 ID */
|
|
106
|
+
id: number;
|
|
107
|
+
/** 合成数量(流体时为 mB) */
|
|
108
|
+
Count: number;
|
|
109
|
+
/** 堆类型,缺省或非 "fluid" 时按物品处理 */
|
|
110
|
+
Type?: "item" | "fluid";
|
|
111
|
+
Damage?: number;
|
|
112
|
+
tag?: string;
|
|
113
|
+
cpu?: string;
|
|
114
|
+
}
|
|
115
|
+
/** `appeng.crafting.v2.resolvers.CraftingTask.State` 枚举名 */
|
|
116
|
+
export type AECraftingTaskState = "NEEDS_MORE_WORK" | "SUCCESS" | "FAILURE";
|
|
117
|
+
/** `appeng.crafting.v2.CraftingRequest.SubstitutionMode` 枚举名 */
|
|
118
|
+
export type AECraftingSubstitutionMode = "PRECISE_FRESH" | "PRECISE" | "ACCEPT_FUZZY";
|
|
119
|
+
/**
|
|
120
|
+
* 合成树中的单个任务
|
|
121
|
+
*
|
|
122
|
+
* `type` 为任务类名,常见取值:
|
|
123
|
+
* - `ExtractItemTask`:从 ME 网络直接提取(真实路径)
|
|
124
|
+
* - `EmitableItemTask`:发射器供给
|
|
125
|
+
* - `CraftFromPatternTask`:按样板合成(递归拆出子材料请求)
|
|
126
|
+
* - `IgnoreMissingItemTask`:IGNORE_MISSING 模式下假定稍后补齐
|
|
127
|
+
* - `ConjureItemTask`:材料不足时"无中生有"的模拟任务,**即缺失物品**
|
|
128
|
+
* - `CheckOtherResolversTask`:计算器内部调度任务
|
|
129
|
+
*/
|
|
130
|
+
export interface AECraftingTaskNode {
|
|
131
|
+
type: string;
|
|
132
|
+
state: AECraftingTaskState;
|
|
133
|
+
/** 是否仅为模拟(`isSimulated`):true 表示该任务供应的物品网络中实际不存在 */
|
|
134
|
+
simulated: boolean;
|
|
135
|
+
priority: number;
|
|
136
|
+
/** `task.toString()`,如 `ConjureItemTask{fulfilled=32, ...}`,fulfilled 即缺口数量 */
|
|
137
|
+
detail: string;
|
|
138
|
+
}
|
|
139
|
+
/** 合成树中单个请求的解析器条目 */
|
|
140
|
+
export interface AECraftingResolverNode {
|
|
141
|
+
type: string;
|
|
142
|
+
state: AECraftingTaskState;
|
|
143
|
+
/** 是否仅为模拟:true 表示该解析器通过"无中生有"满足请求,其 `resolved` 即缺失数量 */
|
|
144
|
+
simulated: boolean;
|
|
145
|
+
/** 任务 `toString()` */
|
|
146
|
+
detail: string;
|
|
147
|
+
/** 该解析器实际提供的数量(服务端 `entry.resolvedStack.getStackSize()`,物品为个数、流体为 mB) */
|
|
148
|
+
resolved: number;
|
|
149
|
+
}
|
|
150
|
+
/** 合成树中的单个请求节点 */
|
|
151
|
+
export interface AECraftingRequestNode {
|
|
152
|
+
stack: AEStack;
|
|
153
|
+
substitutionMode: AECraftingSubstitutionMode;
|
|
154
|
+
/** `remainingToProcess`:仍未被满足的数量,>0 表示该请求仍有缺口 */
|
|
155
|
+
remaining: number;
|
|
156
|
+
byteCost: number;
|
|
157
|
+
/** `wasSimulated`:该请求(含子树)是否被模拟满足 */
|
|
158
|
+
simulated: boolean;
|
|
159
|
+
/** `incomplete`:是否因超出合成步骤上限被截断 */
|
|
160
|
+
incomplete: boolean;
|
|
161
|
+
/** `request.toString()` */
|
|
162
|
+
detail: string;
|
|
163
|
+
/** 满足该请求的任务链 */
|
|
164
|
+
resolvers: AECraftingResolverNode[];
|
|
165
|
+
children?: AECraftingRequestNode[];
|
|
166
|
+
/** 子请求超过最大递归深度(256)被截断的数量 */
|
|
167
|
+
childrenTruncated?: number;
|
|
168
|
+
}
|
|
169
|
+
/** 合成树:`requests` 为自根请求展开的请求树,`tasks` 为按执行顺序的任务列表 */
|
|
170
|
+
export interface AECraftingJobTree {
|
|
171
|
+
requests: AECraftingRequestNode[];
|
|
172
|
+
tasks: AECraftingTaskNode[];
|
|
173
|
+
}
|
|
174
|
+
export interface AECraftingTaskResult {
|
|
175
|
+
bytes: number;
|
|
176
|
+
cpu: string;
|
|
177
|
+
output: ItemStack & {
|
|
178
|
+
stackSize: number;
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* 合成树
|
|
182
|
+
*/
|
|
183
|
+
job?: AECraftingJobTree | null;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* AE合成任务提交失败响应体
|
|
187
|
+
*
|
|
188
|
+
* 材料不足或无法合成时,`body` 携带失败时的合成树,可配合 `analyzeAECraftingJobTree` 分析缺失物品
|
|
189
|
+
*/
|
|
190
|
+
export interface AECraftingTaskErrorBody extends ApiErrorResponse {
|
|
191
|
+
body?: AECraftingJobTree | null;
|
|
192
|
+
}
|
|
193
|
+
export interface AECPUCancelBody {
|
|
194
|
+
name?: string;
|
|
195
|
+
id?: number;
|
|
196
|
+
}
|
|
197
|
+
export interface AECPUCancelResult {
|
|
198
|
+
cpu: string;
|
|
199
|
+
wasBusy: boolean;
|
|
200
|
+
}
|
|
201
|
+
/** AE CPU 暂停/恢复请求体,与取消任务一致:按名称或序号定位 CPU */
|
|
202
|
+
export type AECPUSuspendBody = AECPUCancelBody;
|
|
203
|
+
export interface AECPUSuspendResult {
|
|
204
|
+
cpu: string;
|
|
205
|
+
wasBusy: boolean;
|
|
206
|
+
/** 本次操作后的挂起状态(POST 暂停为 true,DELETE 恢复为 false) */
|
|
207
|
+
Suspended: boolean;
|
|
208
|
+
}
|
|
209
|
+
/** AE 网络库存堆:物品(type 为 "item")或流体(type 为 "fluid"),可通过 type 判别收窄 */
|
|
210
|
+
export type AEItemStack = (ItemStack & {
|
|
211
|
+
type: "item";
|
|
212
|
+
stackSize: number;
|
|
213
|
+
Craftable: boolean;
|
|
214
|
+
}) | (Fluid & {
|
|
215
|
+
type: "fluid";
|
|
216
|
+
stackSize: number;
|
|
217
|
+
Craftable: boolean;
|
|
218
|
+
});
|
|
219
|
+
export interface AEItemCellStatus {
|
|
220
|
+
all: number;
|
|
221
|
+
green: number;
|
|
222
|
+
blue: number;
|
|
223
|
+
orange: number;
|
|
224
|
+
red: number;
|
|
225
|
+
}
|
|
226
|
+
export interface AEItemsResult {
|
|
227
|
+
items: AEItemStack[];
|
|
228
|
+
totalBytes: number;
|
|
229
|
+
usedBytes: number;
|
|
230
|
+
totalTypes: number;
|
|
231
|
+
usedTypes: number;
|
|
232
|
+
cellStatus: AEItemCellStatus;
|
|
233
|
+
fluidTotalBytes: number;
|
|
234
|
+
fluidUsedBytes: number;
|
|
235
|
+
fluidTotalTypes: number;
|
|
236
|
+
fluidUsedTypes: number;
|
|
237
|
+
fluidCellStatus: AEItemCellStatus;
|
|
238
|
+
}
|
|
239
|
+
export interface AEHitResult {
|
|
240
|
+
message: string;
|
|
241
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { ClassInfo } from "./common";
|
|
2
|
+
import type { FluidTank } from "./fluid";
|
|
3
|
+
import type { ItemStack, NBTCompound } from "./item";
|
|
4
|
+
export interface Material {
|
|
5
|
+
isLiquid: boolean;
|
|
6
|
+
isSolid: boolean;
|
|
7
|
+
blocksMovement: boolean;
|
|
8
|
+
isOpaque: boolean;
|
|
9
|
+
isFlammable: boolean;
|
|
10
|
+
isReplaceable: boolean;
|
|
11
|
+
requiresNoTool: boolean;
|
|
12
|
+
mobilityFlag: number;
|
|
13
|
+
isAdventureModeExempt: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface Block {
|
|
16
|
+
class?: ClassInfo;
|
|
17
|
+
id: number;
|
|
18
|
+
registryName: string;
|
|
19
|
+
unlocalizedName: string;
|
|
20
|
+
localizedName: string;
|
|
21
|
+
resistance: number | "Infinity";
|
|
22
|
+
lightLevel: number;
|
|
23
|
+
isOpaqueCube: boolean;
|
|
24
|
+
isNormalCube: boolean;
|
|
25
|
+
slipperiness: number;
|
|
26
|
+
renderType: number;
|
|
27
|
+
material: Material;
|
|
28
|
+
/** 仅在 blocks.json / 纹理导出中出现 */
|
|
29
|
+
meta?: number;
|
|
30
|
+
fileName?: string;
|
|
31
|
+
blockColor?: number;
|
|
32
|
+
}
|
|
33
|
+
export interface BlockDetail {
|
|
34
|
+
block: Block & {
|
|
35
|
+
hardness: number;
|
|
36
|
+
isReplaceable: boolean;
|
|
37
|
+
isPassable: boolean;
|
|
38
|
+
};
|
|
39
|
+
coordinates: import("./common").Coordinates;
|
|
40
|
+
metadata: number;
|
|
41
|
+
isAir: boolean;
|
|
42
|
+
tileEntity?: {
|
|
43
|
+
nbt: NBTCompound;
|
|
44
|
+
class?: ClassInfo;
|
|
45
|
+
inventorySize?: number;
|
|
46
|
+
items?: Array<ItemStack & {
|
|
47
|
+
slot: number;
|
|
48
|
+
}>;
|
|
49
|
+
fluids?: FluidTank[];
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export interface SetBlockBody {
|
|
53
|
+
id: number;
|
|
54
|
+
metadataIn?: number;
|
|
55
|
+
flag?: number;
|
|
56
|
+
nbt?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface SetBlockResult {
|
|
59
|
+
changed: boolean;
|
|
60
|
+
nbtchanged: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface BatchSetBlockTask {
|
|
63
|
+
x: number;
|
|
64
|
+
y: number;
|
|
65
|
+
z: number;
|
|
66
|
+
dim?: number;
|
|
67
|
+
id: number;
|
|
68
|
+
metadata?: number;
|
|
69
|
+
flag?: number;
|
|
70
|
+
nbt?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface BatchSetBlockSubmitResult {
|
|
73
|
+
id: string;
|
|
74
|
+
total: number;
|
|
75
|
+
}
|
|
76
|
+
export type BatchSetBlockJobStatus = "pending" | "running" | "completed";
|
|
77
|
+
export interface BatchSetBlockFailure {
|
|
78
|
+
x: number;
|
|
79
|
+
y: number;
|
|
80
|
+
z: number;
|
|
81
|
+
reason: string;
|
|
82
|
+
}
|
|
83
|
+
export interface BatchSetBlockJobResult {
|
|
84
|
+
id: string;
|
|
85
|
+
total: number;
|
|
86
|
+
completed: number;
|
|
87
|
+
success: number;
|
|
88
|
+
failed: number;
|
|
89
|
+
changed: number;
|
|
90
|
+
nbtchanged: number;
|
|
91
|
+
status: BatchSetBlockJobStatus;
|
|
92
|
+
createTime: number;
|
|
93
|
+
finishTime?: number;
|
|
94
|
+
durationMs?: number;
|
|
95
|
+
failures?: BatchSetBlockFailure[];
|
|
96
|
+
failuresTruncated?: number;
|
|
97
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { ClassInfo } from "./common";
|
|
2
|
+
import type { Entity } from "./entity";
|
|
3
|
+
export interface Chunk {
|
|
4
|
+
class?: ClassInfo;
|
|
5
|
+
chunkX: number;
|
|
6
|
+
chunkZ: number;
|
|
7
|
+
xStart: number;
|
|
8
|
+
zStart: number;
|
|
9
|
+
xEnd: number;
|
|
10
|
+
zEnd: number;
|
|
11
|
+
lastSaveTime: number;
|
|
12
|
+
isTerrainPopulated: boolean;
|
|
13
|
+
isLightPopulated: boolean;
|
|
14
|
+
isModified: boolean;
|
|
15
|
+
hasEntities: boolean;
|
|
16
|
+
isChunkLoaded: boolean;
|
|
17
|
+
sendUpdates: boolean;
|
|
18
|
+
pollution: number;
|
|
19
|
+
tileEntityCount: number;
|
|
20
|
+
entityCount?: number;
|
|
21
|
+
entityList?: Entity[][];
|
|
22
|
+
inhabitedTime: number;
|
|
23
|
+
}
|
|
24
|
+
export interface ChunkWithDimension extends Chunk {
|
|
25
|
+
dimension: number;
|
|
26
|
+
}
|
|
27
|
+
export interface ChunksByDimension {
|
|
28
|
+
name: string;
|
|
29
|
+
class?: ClassInfo;
|
|
30
|
+
chunks: Chunk[];
|
|
31
|
+
count: number;
|
|
32
|
+
}
|
|
33
|
+
export interface ChunkLoadInfo {
|
|
34
|
+
ticketKey: string;
|
|
35
|
+
chunkX: number;
|
|
36
|
+
chunkZ: number;
|
|
37
|
+
minX: number;
|
|
38
|
+
maxX: number;
|
|
39
|
+
minZ: number;
|
|
40
|
+
maxZ: number;
|
|
41
|
+
dimension: number;
|
|
42
|
+
startTime: number;
|
|
43
|
+
durationSec: number;
|
|
44
|
+
remainingSec: number;
|
|
45
|
+
isActive: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface ChunkForceList {
|
|
48
|
+
totalLoaded: number;
|
|
49
|
+
chunks: ChunkLoadInfo[];
|
|
50
|
+
}
|
|
51
|
+
export interface ChunkLoadResult extends ChunkLoadInfo {
|
|
52
|
+
action: "load" | "unload";
|
|
53
|
+
}
|
|
54
|
+
export interface ChunkMapCell {
|
|
55
|
+
name: string;
|
|
56
|
+
meta: number;
|
|
57
|
+
y: number;
|
|
58
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface ClassInfo {
|
|
2
|
+
package?: string;
|
|
3
|
+
location?: string;
|
|
4
|
+
extends?: string[];
|
|
5
|
+
implements?: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface Coordinates {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
z: number;
|
|
11
|
+
dimension: number;
|
|
12
|
+
}
|
|
13
|
+
export interface ApiSuccessResponse<T> {
|
|
14
|
+
success: true;
|
|
15
|
+
data: T;
|
|
16
|
+
}
|
|
17
|
+
export interface ApiErrorResponse {
|
|
18
|
+
success: false;
|
|
19
|
+
message: string;
|
|
20
|
+
/** 路由描述 */
|
|
21
|
+
desc?: string;
|
|
22
|
+
stack?: string | null;
|
|
23
|
+
/**
|
|
24
|
+
* 失败时附带的业务数据
|
|
25
|
+
*/
|
|
26
|
+
body?: unknown;
|
|
27
|
+
}
|
|
28
|
+
export type ApiResponse<T> = ApiSuccessResponse<T> | ApiErrorResponse;
|
|
29
|
+
export interface RootInfo {
|
|
30
|
+
modid: string;
|
|
31
|
+
version: string;
|
|
32
|
+
buildTime?: number;
|
|
33
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { ClassInfo } from "./common";
|
|
2
|
+
import type { ItemStack, NBTData } from "./item";
|
|
3
|
+
export interface EntityBase {
|
|
4
|
+
name: string;
|
|
5
|
+
entityId: number;
|
|
6
|
+
uniqueId: string;
|
|
7
|
+
dimension: number;
|
|
8
|
+
posX: number;
|
|
9
|
+
posY: number;
|
|
10
|
+
posZ: number;
|
|
11
|
+
prevPosX?: number;
|
|
12
|
+
prevPosY?: number;
|
|
13
|
+
prevPosZ?: number;
|
|
14
|
+
motionX: number;
|
|
15
|
+
motionY: number;
|
|
16
|
+
motionZ: number;
|
|
17
|
+
rotationYaw: number;
|
|
18
|
+
rotationPitch: number;
|
|
19
|
+
prevRotationYaw?: number;
|
|
20
|
+
prevRotationPitch?: number;
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
yOffset: number;
|
|
24
|
+
stepHeight: number;
|
|
25
|
+
boundingBoxMinX?: number;
|
|
26
|
+
boundingBoxMinY?: number;
|
|
27
|
+
boundingBoxMinZ?: number;
|
|
28
|
+
boundingBoxMaxX?: number;
|
|
29
|
+
boundingBoxMaxY?: number;
|
|
30
|
+
boundingBoxMaxZ?: number;
|
|
31
|
+
onGround: boolean;
|
|
32
|
+
isCollided: boolean;
|
|
33
|
+
isCollidedHorizontally: boolean;
|
|
34
|
+
isCollidedVertically: boolean;
|
|
35
|
+
isDead: boolean;
|
|
36
|
+
isAirBorne: boolean;
|
|
37
|
+
inWater: boolean;
|
|
38
|
+
fallDistance: number;
|
|
39
|
+
ticksExisted: number;
|
|
40
|
+
fireResistance: number;
|
|
41
|
+
hurtResistantTime: number;
|
|
42
|
+
chunkCoordX: number;
|
|
43
|
+
chunkCoordY: number;
|
|
44
|
+
chunkCoordZ: number;
|
|
45
|
+
RidingEntity: string | null;
|
|
46
|
+
RiddenByEntity: string | null;
|
|
47
|
+
}
|
|
48
|
+
export interface PotionEffect {
|
|
49
|
+
name: string;
|
|
50
|
+
duration: number;
|
|
51
|
+
amplifier: number;
|
|
52
|
+
isAmbient: boolean;
|
|
53
|
+
}
|
|
54
|
+
export interface EntityLivingBaseInfo {
|
|
55
|
+
health: number;
|
|
56
|
+
maxHealth: number;
|
|
57
|
+
absorptionAmount: number;
|
|
58
|
+
prevHealth?: number;
|
|
59
|
+
TotalArmor: number;
|
|
60
|
+
items?: ItemStack[];
|
|
61
|
+
hurtTime: number;
|
|
62
|
+
maxHurtTime: number;
|
|
63
|
+
attackTime: number;
|
|
64
|
+
deathTime: number;
|
|
65
|
+
attackedAtYaw: number;
|
|
66
|
+
arrowCountInEntity: number;
|
|
67
|
+
arrowHitTimer: number;
|
|
68
|
+
entityAge: number;
|
|
69
|
+
jumpMovementFactor: number;
|
|
70
|
+
isOnLadder: boolean;
|
|
71
|
+
canBreatheUnderwater: boolean;
|
|
72
|
+
maxHurtResistantTime: number;
|
|
73
|
+
cameraPitch?: number;
|
|
74
|
+
prevCameraPitch?: number;
|
|
75
|
+
attributes?: Record<string, {
|
|
76
|
+
baseValue: number;
|
|
77
|
+
currentValue: number;
|
|
78
|
+
}>;
|
|
79
|
+
creatureAttribute: string;
|
|
80
|
+
revengeTargetId?: number;
|
|
81
|
+
lastAttackerId?: number;
|
|
82
|
+
activePotionEffects?: Record<string, PotionEffect>;
|
|
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
|
+
}
|
|
98
|
+
export interface PlayerInfo {
|
|
99
|
+
experienceLevel: number;
|
|
100
|
+
experience: number;
|
|
101
|
+
experienceTotal: number;
|
|
102
|
+
abilities: PlayerAbilities;
|
|
103
|
+
isSleeping: boolean;
|
|
104
|
+
isBlocking: boolean;
|
|
105
|
+
score: number;
|
|
106
|
+
food: {
|
|
107
|
+
foodLevel: number;
|
|
108
|
+
saturationLevel: number;
|
|
109
|
+
};
|
|
110
|
+
/** 主手物品,未持有物品时不输出 */
|
|
111
|
+
heldItem?: ItemStack;
|
|
112
|
+
/** 4 格盔甲槽,空槽为 null */
|
|
113
|
+
armor: (ItemStack | null)[];
|
|
114
|
+
/** 主背包中的非空物品 */
|
|
115
|
+
items: Array<ItemStack & {
|
|
116
|
+
slot: number;
|
|
117
|
+
}>;
|
|
118
|
+
}
|
|
119
|
+
export interface Entity {
|
|
120
|
+
Entity: EntityBase & Partial<NBTData>;
|
|
121
|
+
EntityLivingBase?: EntityLivingBaseInfo;
|
|
122
|
+
Player?: PlayerInfo;
|
|
123
|
+
class?: ClassInfo;
|
|
124
|
+
}
|
|
125
|
+
/** getEntities 返回的精简实体(服务端强制 all=false) */
|
|
126
|
+
export interface EntitySummary {
|
|
127
|
+
Entity: Pick<EntityBase, "name" | "entityId" | "uniqueId" | "dimension" | "posX" | "posY" | "posZ">;
|
|
128
|
+
}
|
|
129
|
+
export interface EntitiesByDimension {
|
|
130
|
+
WorldName: string;
|
|
131
|
+
loadedEntityList: EntitySummary[];
|
|
132
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ClassInfo } from "./common";
|
|
2
|
+
import type { ItemStack } from "./item";
|
|
3
|
+
export interface Fluid {
|
|
4
|
+
class?: ClassInfo;
|
|
5
|
+
id: number;
|
|
6
|
+
name: string;
|
|
7
|
+
registryName: string;
|
|
8
|
+
unlocalizedName: string;
|
|
9
|
+
localizedName?: string;
|
|
10
|
+
color: number;
|
|
11
|
+
luminosity: number;
|
|
12
|
+
density: number;
|
|
13
|
+
temperature: number;
|
|
14
|
+
viscosity: number;
|
|
15
|
+
gaseous: boolean;
|
|
16
|
+
block?: number;
|
|
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
|
+
}
|
|
29
|
+
export interface FluidContainer {
|
|
30
|
+
fluid?: Fluid;
|
|
31
|
+
amount?: number;
|
|
32
|
+
filledContainer?: ItemStack;
|
|
33
|
+
emptyContainer?: ItemStack;
|
|
34
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ClassInfo } from "./common";
|
|
2
|
+
import type { ItemStack } from "./item";
|
|
3
|
+
export interface Cuboid6Bounds {
|
|
4
|
+
minX: number;
|
|
5
|
+
minY: number;
|
|
6
|
+
minZ: number;
|
|
7
|
+
maxX: number;
|
|
8
|
+
maxY: number;
|
|
9
|
+
maxZ: number;
|
|
10
|
+
}
|
|
11
|
+
export interface FMPPart {
|
|
12
|
+
class?: ClassInfo;
|
|
13
|
+
type: string;
|
|
14
|
+
lightValue: number;
|
|
15
|
+
doesTick: boolean;
|
|
16
|
+
bounds?: Cuboid6Bounds;
|
|
17
|
+
collisionBoxes: Cuboid6Bounds[];
|
|
18
|
+
drops?: ItemStack[];
|
|
19
|
+
ae2?: {
|
|
20
|
+
color: string;
|
|
21
|
+
isEmpty: boolean;
|
|
22
|
+
lightValue: number;
|
|
23
|
+
parts: Array<{
|
|
24
|
+
direction: string;
|
|
25
|
+
item?: ItemStack;
|
|
26
|
+
}>;
|
|
27
|
+
facades: Array<{
|
|
28
|
+
direction: string;
|
|
29
|
+
item?: ItemStack;
|
|
30
|
+
}>;
|
|
31
|
+
error?: string;
|
|
32
|
+
};
|
|
33
|
+
}
|