@minecraft/server 2.2.0-beta.1.21.100-preview.21 → 2.2.0-beta.1.21.100-preview.22
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/index.d.ts +291 -0
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -132,6 +132,35 @@ export enum BlockVolumeIntersection {
|
|
|
132
132
|
Intersects = 2,
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
/**
|
|
136
|
+
* @beta
|
|
137
|
+
* An enum of error reasons relating to using {@link
|
|
138
|
+
* ItemBookComponent}.
|
|
139
|
+
*/
|
|
140
|
+
export enum BookErrorReason {
|
|
141
|
+
/**
|
|
142
|
+
* @remarks
|
|
143
|
+
* The requested page content exceeds the max page length of
|
|
144
|
+
* 256.
|
|
145
|
+
*
|
|
146
|
+
*/
|
|
147
|
+
ExceedsMaxPageLength = 'ExceedsMaxPageLength',
|
|
148
|
+
/**
|
|
149
|
+
* @remarks
|
|
150
|
+
* The page could not be created as it would exceed the max
|
|
151
|
+
* page count of 50.
|
|
152
|
+
*
|
|
153
|
+
*/
|
|
154
|
+
ExceedsMaxPages = 'ExceedsMaxPages',
|
|
155
|
+
/**
|
|
156
|
+
* @remarks
|
|
157
|
+
* The title being signed exceeds the maximum title length of
|
|
158
|
+
* 16.
|
|
159
|
+
*
|
|
160
|
+
*/
|
|
161
|
+
ExceedsTitleLength = 'ExceedsTitleLength',
|
|
162
|
+
}
|
|
163
|
+
|
|
135
164
|
/**
|
|
136
165
|
* The state of a button on a keyboard, controller, or touch
|
|
137
166
|
* interface.
|
|
@@ -2037,6 +2066,13 @@ export enum InputPermissionCategory {
|
|
|
2037
2066
|
* function ItemStack.getComponent.
|
|
2038
2067
|
*/
|
|
2039
2068
|
export enum ItemComponentTypes {
|
|
2069
|
+
/**
|
|
2070
|
+
* @beta
|
|
2071
|
+
* @remarks
|
|
2072
|
+
* The minecraft:book component.
|
|
2073
|
+
*
|
|
2074
|
+
*/
|
|
2075
|
+
Book = 'minecraft:book',
|
|
2040
2076
|
Compostable = 'minecraft:compostable',
|
|
2041
2077
|
/**
|
|
2042
2078
|
* @remarks
|
|
@@ -2983,6 +3019,7 @@ export type ItemComponentReturnType<T extends string> = T extends keyof ItemComp
|
|
|
2983
3019
|
: ItemCustomComponentInstance;
|
|
2984
3020
|
|
|
2985
3021
|
export type ItemComponentTypeMap = {
|
|
3022
|
+
book: ItemBookComponent;
|
|
2986
3023
|
compostable: ItemCompostableComponent;
|
|
2987
3024
|
cooldown: ItemCooldownComponent;
|
|
2988
3025
|
durability: ItemDurabilityComponent;
|
|
@@ -2990,6 +3027,7 @@ export type ItemComponentTypeMap = {
|
|
|
2990
3027
|
enchantable: ItemEnchantableComponent;
|
|
2991
3028
|
food: ItemFoodComponent;
|
|
2992
3029
|
inventory: ItemInventoryComponent;
|
|
3030
|
+
'minecraft:book': ItemBookComponent;
|
|
2993
3031
|
'minecraft:compostable': ItemCompostableComponent;
|
|
2994
3032
|
'minecraft:cooldown': ItemCooldownComponent;
|
|
2995
3033
|
'minecraft:durability': ItemDurabilityComponent;
|
|
@@ -12232,6 +12270,214 @@ export class InputInfo {
|
|
|
12232
12270
|
getMovementVector(): Vector2;
|
|
12233
12271
|
}
|
|
12234
12272
|
|
|
12273
|
+
/**
|
|
12274
|
+
* @beta
|
|
12275
|
+
* When present on an item, this item is a book item. Can
|
|
12276
|
+
* access and modify the contents of the book and sign it.
|
|
12277
|
+
*/
|
|
12278
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
12279
|
+
export class ItemBookComponent extends ItemComponent {
|
|
12280
|
+
private constructor();
|
|
12281
|
+
/**
|
|
12282
|
+
* @remarks
|
|
12283
|
+
* The name of the author of the book if it is signed,
|
|
12284
|
+
* otherwise undefined.
|
|
12285
|
+
*
|
|
12286
|
+
* @throws This property can throw when used.
|
|
12287
|
+
*
|
|
12288
|
+
* {@link InvalidItemStackError}
|
|
12289
|
+
*/
|
|
12290
|
+
readonly author?: string;
|
|
12291
|
+
/**
|
|
12292
|
+
* @remarks
|
|
12293
|
+
* The contents of pages in the book that are in string format.
|
|
12294
|
+
* Entries not in string format will be undefined.
|
|
12295
|
+
*
|
|
12296
|
+
* @throws This property can throw when used.
|
|
12297
|
+
*
|
|
12298
|
+
* {@link InvalidItemStackError}
|
|
12299
|
+
*/
|
|
12300
|
+
readonly contents: (string | undefined)[];
|
|
12301
|
+
/**
|
|
12302
|
+
* @remarks
|
|
12303
|
+
* Determines whether the book has been signed or not.
|
|
12304
|
+
*
|
|
12305
|
+
* @throws This property can throw when used.
|
|
12306
|
+
*
|
|
12307
|
+
* {@link InvalidItemStackError}
|
|
12308
|
+
*/
|
|
12309
|
+
readonly isSigned: boolean;
|
|
12310
|
+
/**
|
|
12311
|
+
* @remarks
|
|
12312
|
+
* The amount of pages the book has.
|
|
12313
|
+
*
|
|
12314
|
+
* @throws This property can throw when used.
|
|
12315
|
+
*
|
|
12316
|
+
* {@link InvalidItemStackError}
|
|
12317
|
+
*/
|
|
12318
|
+
readonly pageCount: number;
|
|
12319
|
+
/**
|
|
12320
|
+
* @remarks
|
|
12321
|
+
* The contents of pages in the book that are in {@link
|
|
12322
|
+
* RawMessage} format. Entries not in {@link RawMessage} format
|
|
12323
|
+
* will be undefined.
|
|
12324
|
+
*
|
|
12325
|
+
* @throws This property can throw when used.
|
|
12326
|
+
*
|
|
12327
|
+
* {@link InvalidItemStackError}
|
|
12328
|
+
*/
|
|
12329
|
+
readonly rawContents: (RawMessage | undefined)[];
|
|
12330
|
+
/**
|
|
12331
|
+
* @remarks
|
|
12332
|
+
* The title of the book if it is signed, otherwise undefined.
|
|
12333
|
+
*
|
|
12334
|
+
* @throws This property can throw when used.
|
|
12335
|
+
*
|
|
12336
|
+
* {@link InvalidItemStackError}
|
|
12337
|
+
*/
|
|
12338
|
+
readonly title?: string;
|
|
12339
|
+
static readonly componentId = 'minecraft:book';
|
|
12340
|
+
/**
|
|
12341
|
+
* @remarks
|
|
12342
|
+
* Gets the string format content of a page for a given index.
|
|
12343
|
+
*
|
|
12344
|
+
* @param pageIndex
|
|
12345
|
+
* The index of the page.
|
|
12346
|
+
* @returns
|
|
12347
|
+
* The content of the page if a valid index is provided and it
|
|
12348
|
+
* is in string format, otherwise returns undefined.
|
|
12349
|
+
* @throws This function can throw errors.
|
|
12350
|
+
*
|
|
12351
|
+
* {@link InvalidItemStackError}
|
|
12352
|
+
*/
|
|
12353
|
+
getPageContent(pageIndex: number): string | undefined;
|
|
12354
|
+
/**
|
|
12355
|
+
* @remarks
|
|
12356
|
+
* Gets the {@link RawMessage} format content of a page for a
|
|
12357
|
+
* given index.
|
|
12358
|
+
*
|
|
12359
|
+
* @param pageIndex
|
|
12360
|
+
* The index of the page.
|
|
12361
|
+
* @returns
|
|
12362
|
+
* The content of the page if a valid index is provided and it
|
|
12363
|
+
* is in {@link RawMessage} format, otherwise returns
|
|
12364
|
+
* undefined.
|
|
12365
|
+
* @throws This function can throw errors.
|
|
12366
|
+
*
|
|
12367
|
+
* {@link InvalidItemStackError}
|
|
12368
|
+
*/
|
|
12369
|
+
getRawPageContent(pageIndex: number): RawMessage | undefined;
|
|
12370
|
+
/**
|
|
12371
|
+
* @remarks
|
|
12372
|
+
* Inserts a page at a given index. Empty pages will be created
|
|
12373
|
+
* if the index is greater than the current book size.
|
|
12374
|
+
* Pages have a maximum limit of 256 characters for strings as
|
|
12375
|
+
* well as the JSON representation of a {@link RawMessage}.
|
|
12376
|
+
* Books have a maximum limit of 50 pages.
|
|
12377
|
+
*
|
|
12378
|
+
* This function can't be called in read-only mode.
|
|
12379
|
+
*
|
|
12380
|
+
* @param pageIndex
|
|
12381
|
+
* The index of the page.
|
|
12382
|
+
* @param content
|
|
12383
|
+
* The content to set for the page. Can be a single string or
|
|
12384
|
+
* {@link RawMessage} or an array of strings and/or {@link
|
|
12385
|
+
* RawMessage}s
|
|
12386
|
+
* @throws This function can throw errors.
|
|
12387
|
+
*
|
|
12388
|
+
* {@link BookError}
|
|
12389
|
+
*
|
|
12390
|
+
* {@link BookPageContentError}
|
|
12391
|
+
*
|
|
12392
|
+
* {@link InvalidItemStackError}
|
|
12393
|
+
*/
|
|
12394
|
+
insertPage(pageIndex: number, content: (RawMessage | string)[] | RawMessage | string): void;
|
|
12395
|
+
/**
|
|
12396
|
+
* @remarks
|
|
12397
|
+
* Removes a page at a given index. Existing pages following
|
|
12398
|
+
* this page will be moved backward to fill the empty space.
|
|
12399
|
+
*
|
|
12400
|
+
* This function can't be called in read-only mode.
|
|
12401
|
+
*
|
|
12402
|
+
* @param pageIndex
|
|
12403
|
+
* The index of the page.
|
|
12404
|
+
* @throws This function can throw errors.
|
|
12405
|
+
*
|
|
12406
|
+
* {@link InvalidItemStackError}
|
|
12407
|
+
*/
|
|
12408
|
+
removePage(pageIndex: number): void;
|
|
12409
|
+
/**
|
|
12410
|
+
* @remarks
|
|
12411
|
+
* Sets the contents of the book's pages. Pre-existing pages
|
|
12412
|
+
* will be cleared.
|
|
12413
|
+
* Pages have a maximum limit of 256 characters for strings as
|
|
12414
|
+
* well as the JSON representation of a {@link RawMessage}.
|
|
12415
|
+
* Books have a maximum limit of 50 pages.
|
|
12416
|
+
*
|
|
12417
|
+
* This function can't be called in read-only mode.
|
|
12418
|
+
*
|
|
12419
|
+
* @param contents
|
|
12420
|
+
* An array of each page's contents. Each page can be a single
|
|
12421
|
+
* string or {@link RawMessage} or an array of strings and/or
|
|
12422
|
+
* {@link RawMessage}s.
|
|
12423
|
+
* @throws This function can throw errors.
|
|
12424
|
+
*
|
|
12425
|
+
* {@link BookError}
|
|
12426
|
+
*
|
|
12427
|
+
* {@link BookPageContentError}
|
|
12428
|
+
*
|
|
12429
|
+
* {@link InvalidItemStackError}
|
|
12430
|
+
*/
|
|
12431
|
+
setContents(contents: ((RawMessage | string)[] | RawMessage | string)[]): void;
|
|
12432
|
+
/**
|
|
12433
|
+
* @remarks
|
|
12434
|
+
* Sets or creates the content of a specific page. Empty pages
|
|
12435
|
+
* will be created if the index is greater than the current
|
|
12436
|
+
* book size.
|
|
12437
|
+
* Pages have a maximum limit of 256 characters for strings as
|
|
12438
|
+
* well as the JSON representation of a {@link RawMessage}.
|
|
12439
|
+
* Books have a maximum limit of 50 pages.
|
|
12440
|
+
*
|
|
12441
|
+
* This function can't be called in read-only mode.
|
|
12442
|
+
*
|
|
12443
|
+
* @param pageIndex
|
|
12444
|
+
* The index of the page.
|
|
12445
|
+
* @param content
|
|
12446
|
+
* The content to set for the page. Can be a single string or
|
|
12447
|
+
* {@link RawMessage} or an array of strings and/or {@link
|
|
12448
|
+
* RawMessage}s
|
|
12449
|
+
* @throws This function can throw errors.
|
|
12450
|
+
*
|
|
12451
|
+
* {@link BookError}
|
|
12452
|
+
*
|
|
12453
|
+
* {@link BookPageContentError}
|
|
12454
|
+
*
|
|
12455
|
+
* {@link InvalidItemStackError}
|
|
12456
|
+
*/
|
|
12457
|
+
setPageContent(pageIndex: number, content: (RawMessage | string)[] | RawMessage | string): void;
|
|
12458
|
+
/**
|
|
12459
|
+
* @remarks
|
|
12460
|
+
* Signs a book giving it a title and author name. Once signed
|
|
12461
|
+
* players can no longer directly edit the book.
|
|
12462
|
+
* Titles have a maximum character limit of 16.
|
|
12463
|
+
*
|
|
12464
|
+
* This function can't be called in read-only mode.
|
|
12465
|
+
*
|
|
12466
|
+
* @param title
|
|
12467
|
+
* The title to give the book.
|
|
12468
|
+
* @param author
|
|
12469
|
+
* The name of the book's author.
|
|
12470
|
+
* @throws This function can throw errors.
|
|
12471
|
+
*
|
|
12472
|
+
* {@link BookError}
|
|
12473
|
+
*
|
|
12474
|
+
* {@link InvalidEntityError}
|
|
12475
|
+
*
|
|
12476
|
+
* {@link InvalidItemStackError}
|
|
12477
|
+
*/
|
|
12478
|
+
signBook(title: string, author: string): void;
|
|
12479
|
+
}
|
|
12480
|
+
|
|
12235
12481
|
/**
|
|
12236
12482
|
* Contains information related to a chargeable item completing
|
|
12237
12483
|
* being charged.
|
|
@@ -21877,6 +22123,51 @@ export class BlockCustomComponentReloadVersionError extends Error {
|
|
|
21877
22123
|
private constructor();
|
|
21878
22124
|
}
|
|
21879
22125
|
|
|
22126
|
+
/**
|
|
22127
|
+
* @beta
|
|
22128
|
+
* Errors that can be thrown when using {@link
|
|
22129
|
+
* ItemBookComponent}.
|
|
22130
|
+
*/
|
|
22131
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
22132
|
+
export class BookError extends Error {
|
|
22133
|
+
private constructor();
|
|
22134
|
+
/**
|
|
22135
|
+
* @remarks
|
|
22136
|
+
* The reason for the error.
|
|
22137
|
+
*
|
|
22138
|
+
* This property can be read in early-execution mode.
|
|
22139
|
+
*
|
|
22140
|
+
*/
|
|
22141
|
+
reason: BookErrorReason;
|
|
22142
|
+
}
|
|
22143
|
+
|
|
22144
|
+
/**
|
|
22145
|
+
* @beta
|
|
22146
|
+
* The error called if page content being set on an {@link
|
|
22147
|
+
* ItemBookComponent} are invalid ie. exceeding the maximum
|
|
22148
|
+
* page length.
|
|
22149
|
+
*/
|
|
22150
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
22151
|
+
export class BookPageContentError extends Error {
|
|
22152
|
+
private constructor();
|
|
22153
|
+
/**
|
|
22154
|
+
* @remarks
|
|
22155
|
+
* The index of the page requested to be modified.
|
|
22156
|
+
*
|
|
22157
|
+
* This property can be read in early-execution mode.
|
|
22158
|
+
*
|
|
22159
|
+
*/
|
|
22160
|
+
pageIndex: number;
|
|
22161
|
+
/**
|
|
22162
|
+
* @remarks
|
|
22163
|
+
* The reason for the error.
|
|
22164
|
+
*
|
|
22165
|
+
* This property can be read in early-execution mode.
|
|
22166
|
+
*
|
|
22167
|
+
*/
|
|
22168
|
+
reason: BookErrorReason;
|
|
22169
|
+
}
|
|
22170
|
+
|
|
21880
22171
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
21881
22172
|
export class CommandError extends Error {
|
|
21882
22173
|
private constructor();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@minecraft/server",
|
|
3
|
-
"version": "2.2.0-beta.1.21.100-preview.
|
|
3
|
+
"version": "2.2.0-beta.1.21.100-preview.22",
|
|
4
4
|
"description": "",
|
|
5
5
|
"contributors": [
|
|
6
6
|
{
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"@minecraft/common": "^1.1.0"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@minecraft/vanilla-data": ">=1.20.70"
|
|
19
|
+
"@minecraft/vanilla-data": ">=1.20.70 || 1.21.100-preview.22"
|
|
20
20
|
},
|
|
21
21
|
"license": "MIT"
|
|
22
22
|
}
|