@minecraft/server 2.12.0-rc.1.26.70-preview.23 → 2.12.0-rc.1.26.70-preview.24

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.
Files changed (2) hide show
  1. package/index.d.ts +493 -1
  2. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -83,6 +83,14 @@ export enum BlockComponentTypes {
83
83
  *
84
84
  */
85
85
  PrecipitationInteractions = 'minecraft:precipitation_interactions',
86
+ /**
87
+ * @rc
88
+ */
89
+ RecipeCrafting = 'minecraft:recipe_crafting',
90
+ /**
91
+ * @rc
92
+ */
93
+ RecipeProcessing = 'minecraft:recipe_processing',
86
94
  /**
87
95
  * @remarks
88
96
  * Represents a block that can play a record.
@@ -3124,6 +3132,8 @@ export type BlockComponentTypeMap = {
3124
3132
  'minecraft:movable': BlockMovableComponent;
3125
3133
  'minecraft:piston': BlockPistonComponent;
3126
3134
  'minecraft:precipitation_interactions': BlockPrecipitationInteractionsComponent;
3135
+ 'minecraft:recipe_crafting': BlockRecipeCraftingComponent;
3136
+ 'minecraft:recipe_processing': BlockRecipeProcessingComponent;
3127
3137
  'minecraft:record_player': BlockRecordPlayerComponent;
3128
3138
  'minecraft:redstone_producer': BlockRedstoneProducerComponent;
3129
3139
  'minecraft:sign': BlockSignComponent;
@@ -3131,6 +3141,8 @@ export type BlockComponentTypeMap = {
3131
3141
  movable: BlockMovableComponent;
3132
3142
  piston: BlockPistonComponent;
3133
3143
  precipitation_interactions: BlockPrecipitationInteractionsComponent;
3144
+ recipe_crafting: BlockRecipeCraftingComponent;
3145
+ recipe_processing: BlockRecipeProcessingComponent;
3134
3146
  record_player: BlockRecordPlayerComponent;
3135
3147
  redstone_producer: BlockRedstoneProducerComponent;
3136
3148
  sign: BlockSignComponent;
@@ -5567,7 +5579,7 @@ export class BlockPermutation {
5567
5579
  * Gets a state for the permutation.
5568
5580
  *
5569
5581
  * @param stateName
5570
- * Name of the block state who's value is to be returned.
5582
+ * Name of the block state whose value is to be returned.
5571
5583
  * @returns
5572
5584
  * Returns the state if the permutation has it, else
5573
5585
  * `undefined`.
@@ -5804,6 +5816,139 @@ export class BlockPrecipitationInteractionsComponent extends BlockComponent {
5804
5816
  obstructsRain(): boolean;
5805
5817
  }
5806
5818
 
5819
+ /**
5820
+ * @rc
5821
+ * Represents a block component that provides access to recipe
5822
+ * crafting.
5823
+ */
5824
+ // @ts-ignore Class inheritance allowed for native defined classes
5825
+ export class BlockRecipeCraftingComponent extends BlockComponent {
5826
+ private constructor();
5827
+ /**
5828
+ * @remarks
5829
+ * Returns an array of all players currently interacting with
5830
+ * this block.
5831
+ *
5832
+ */
5833
+ readonly players: Player[];
5834
+ static readonly componentId = 'minecraft:recipe_crafting';
5835
+ /**
5836
+ * @remarks
5837
+ * Gets the recipe crafting context for a player interacting
5838
+ * with this block.
5839
+ *
5840
+ * @param player
5841
+ * The player for whom to retrieve the crafting context.
5842
+ * @returns
5843
+ * The current recipe crafting context for the player, or
5844
+ * undefined if the player isn't crafting.
5845
+ * @throws This function can throw errors.
5846
+ *
5847
+ * {@link minecraftcommon.EngineError}
5848
+ *
5849
+ * {@link InvalidEntityError}
5850
+ */
5851
+ getCraftingContext(player: Player): RecipeCraftingContext | undefined;
5852
+ }
5853
+
5854
+ /**
5855
+ * @rc
5856
+ * Represents a block component that provides access to recipe
5857
+ * processing inputs and output.
5858
+ */
5859
+ // @ts-ignore Class inheritance allowed for native defined classes
5860
+ export class BlockRecipeProcessingComponent extends BlockComponent {
5861
+ private constructor();
5862
+ /**
5863
+ * @remarks
5864
+ * The number of addressable input slots for getInputItem,
5865
+ * setInputItem, setInputSlotEnabled, and getInputSlotEnabled.
5866
+ *
5867
+ * @throws This property can throw when used.
5868
+ *
5869
+ * {@link InvalidBlockComponentError}
5870
+ */
5871
+ readonly inputSlotCount: number;
5872
+ static readonly componentId = 'minecraft:recipe_processing';
5873
+ /**
5874
+ * @remarks
5875
+ * Gets the item in the provided input slot.
5876
+ *
5877
+ * @param slot
5878
+ * The zero-based input slot index.
5879
+ * @returns
5880
+ * The item stack in the input slot, or undefined if the slot
5881
+ * is empty.
5882
+ * @throws This function can throw errors.
5883
+ *
5884
+ * {@link minecraftcommon.ArgumentOutOfBoundsError}
5885
+ *
5886
+ * {@link InvalidBlockComponentError}
5887
+ */
5888
+ getInputItem(slot: number): ItemStack | undefined;
5889
+ /**
5890
+ * @remarks
5891
+ * Gets whether an input slot is enabled for recipe processing.
5892
+ *
5893
+ * @param slot
5894
+ * The zero-based input slot index.
5895
+ * @returns
5896
+ * Whether the input slot is enabled.
5897
+ * @throws This function can throw errors.
5898
+ *
5899
+ * {@link minecraftcommon.ArgumentOutOfBoundsError}
5900
+ *
5901
+ * {@link InvalidBlockComponentError}
5902
+ *
5903
+ * {@link minecraftcommon.UnsupportedFunctionalityError}
5904
+ */
5905
+ getInputSlotEnabled(slot: number): boolean;
5906
+ /**
5907
+ * @remarks
5908
+ * Gets the item produced by the current recipe processing
5909
+ * inputs.
5910
+ *
5911
+ * @returns
5912
+ * The output item stack, or undefined if the current inputs do
5913
+ * not produce an item.
5914
+ * @throws This function can throw errors.
5915
+ *
5916
+ * {@link InvalidBlockComponentError}
5917
+ */
5918
+ getOutputItem(): ItemStack | undefined;
5919
+ /**
5920
+ * @remarks
5921
+ * Sets or clears an item in an input slot.
5922
+ *
5923
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
5924
+ *
5925
+ * @param slot
5926
+ * The zero-based input slot index.
5927
+ * @param item
5928
+ * The item stack to place in the slot, or undefined to clear
5929
+ * the slot.
5930
+ * @throws This function can throw errors.
5931
+ *
5932
+ * {@link minecraftcommon.ArgumentOutOfBoundsError}
5933
+ *
5934
+ * {@link InvalidBlockComponentError}
5935
+ */
5936
+ setInputItem(slot: number, item?: ItemStack): void;
5937
+ /**
5938
+ * @remarks
5939
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
5940
+ *
5941
+ * @throws This function can throw errors.
5942
+ *
5943
+ * {@link minecraftcommon.ArgumentOutOfBoundsError}
5944
+ *
5945
+ * {@link InvalidBlockComponentError}
5946
+ *
5947
+ * {@link minecraftcommon.UnsupportedFunctionalityError}
5948
+ */
5949
+ setInputSlotEnabled(slot: number, enabled: boolean): void;
5950
+ }
5951
+
5807
5952
  /**
5808
5953
  * Represents a block that can play a record.
5809
5954
  */
@@ -18261,6 +18406,72 @@ export class PlayerCancelBreakingBlockAfterEventSignal {
18261
18406
  unsubscribe(callback: (arg0: PlayerCancelBreakingBlockAfterEvent) => void): void;
18262
18407
  }
18263
18408
 
18409
+ /**
18410
+ * @rc
18411
+ * Contains information regarding a player crafting a recipe.
18412
+ */
18413
+ export class PlayerCraftRecipeAfterEvent {
18414
+ private constructor();
18415
+ /**
18416
+ * @remarks
18417
+ * The block where the recipe was crafted, if applicable.
18418
+ *
18419
+ */
18420
+ readonly block?: Block;
18421
+ /**
18422
+ * @remarks
18423
+ * The item stack crafted by the player.
18424
+ *
18425
+ */
18426
+ readonly itemStack?: ItemStack;
18427
+ /**
18428
+ * @remarks
18429
+ * The player who crafted the recipe.
18430
+ *
18431
+ */
18432
+ readonly player: Player;
18433
+ }
18434
+
18435
+ /**
18436
+ * @rc
18437
+ * Manages callbacks that are connected to when a player crafts
18438
+ * a recipe.
18439
+ */
18440
+ export class PlayerCraftRecipeAfterEventSignal {
18441
+ private constructor();
18442
+ /**
18443
+ * @remarks
18444
+ * Adds a callback that will be called when a player crafts a
18445
+ * recipe.
18446
+ *
18447
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
18448
+ *
18449
+ * @privilege early-execution-allowed - This function can be called in early-execution mode.
18450
+ *
18451
+ * @param callback
18452
+ * Function callback that is called when this event fires.
18453
+ * @param options
18454
+ * Additional filtering options for the event subscription.
18455
+ */
18456
+ subscribe(
18457
+ callback: (arg0: PlayerCraftRecipeAfterEvent) => void,
18458
+ options?: PlayerCraftRecipeEventOptions,
18459
+ ): (arg0: PlayerCraftRecipeAfterEvent) => void;
18460
+ /**
18461
+ * @remarks
18462
+ * Removes a callback from being called when a player crafts a
18463
+ * recipe.
18464
+ *
18465
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
18466
+ *
18467
+ * @privilege early-execution-allowed - This function can be called in early-execution mode.
18468
+ *
18469
+ * @param callback
18470
+ * The callback to remove from the event subscription.
18471
+ */
18472
+ unsubscribe(callback: (arg0: PlayerCraftRecipeAfterEvent) => void): void;
18473
+ }
18474
+
18264
18475
  /**
18265
18476
  * Represents the players cursor inventory. Used when moving
18266
18477
  * items between between containers in the inventory UI. Not
@@ -18288,6 +18499,118 @@ export class PlayerCursorInventoryComponent extends EntityComponent {
18288
18499
  clear(): void;
18289
18500
  }
18290
18501
 
18502
+ /**
18503
+ * @rc
18504
+ * Contains information about an item moved from a container to
18505
+ * a player's cursor.
18506
+ */
18507
+ export class PlayerCursorItemGrabAfterEvent {
18508
+ private constructor();
18509
+ /**
18510
+ * @remarks
18511
+ * The item stack moved to the player's cursor.
18512
+ *
18513
+ */
18514
+ readonly item: ItemStack;
18515
+ /**
18516
+ * @remarks
18517
+ * The player whose cursor item changed.
18518
+ *
18519
+ */
18520
+ readonly player: Player;
18521
+ }
18522
+
18523
+ /**
18524
+ * @rc
18525
+ * Manages callbacks for items grabbed from a container to a
18526
+ * player's cursor.
18527
+ */
18528
+ export class PlayerCursorItemGrabAfterEventSignal {
18529
+ private constructor();
18530
+ /**
18531
+ * @remarks
18532
+ * Adds a callback that is called when a player grabs an item
18533
+ * from a container to their cursor.
18534
+ *
18535
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
18536
+ *
18537
+ * @privilege early-execution-allowed - This function can be called in early-execution mode.
18538
+ *
18539
+ * @param callback
18540
+ * The callback function invoked when the event fires.
18541
+ */
18542
+ subscribe(callback: (arg0: PlayerCursorItemGrabAfterEvent) => void): (arg0: PlayerCursorItemGrabAfterEvent) => void;
18543
+ /**
18544
+ * @remarks
18545
+ * Removes a previously registered event callback.
18546
+ *
18547
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
18548
+ *
18549
+ * @privilege early-execution-allowed - This function can be called in early-execution mode.
18550
+ *
18551
+ * @param callback
18552
+ * The callback function to remove.
18553
+ */
18554
+ unsubscribe(callback: (arg0: PlayerCursorItemGrabAfterEvent) => void): void;
18555
+ }
18556
+
18557
+ /**
18558
+ * @rc
18559
+ * Contains information about an item moved from a player's
18560
+ * cursor to a container.
18561
+ */
18562
+ export class PlayerCursorItemReleaseAfterEvent {
18563
+ private constructor();
18564
+ /**
18565
+ * @remarks
18566
+ * The item stack from the player's cursor.
18567
+ *
18568
+ */
18569
+ readonly item: ItemStack;
18570
+ /**
18571
+ * @remarks
18572
+ * The player whose cursor item changed.
18573
+ *
18574
+ */
18575
+ readonly player: Player;
18576
+ }
18577
+
18578
+ /**
18579
+ * @rc
18580
+ * Manages callbacks for items released from a player's cursor
18581
+ * to a container.
18582
+ */
18583
+ export class PlayerCursorItemReleaseAfterEventSignal {
18584
+ private constructor();
18585
+ /**
18586
+ * @remarks
18587
+ * Adds a callback that is called when a player releases an
18588
+ * item from their cursor to a container.
18589
+ *
18590
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
18591
+ *
18592
+ * @privilege early-execution-allowed - This function can be called in early-execution mode.
18593
+ *
18594
+ * @param callback
18595
+ * The callback function invoked when the event fires.
18596
+ */
18597
+ subscribe(
18598
+ callback: (arg0: PlayerCursorItemReleaseAfterEvent) => void,
18599
+ ): (arg0: PlayerCursorItemReleaseAfterEvent) => void;
18600
+ /**
18601
+ * @remarks
18602
+ * Removes a previously registered event callback.
18603
+ *
18604
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
18605
+ *
18606
+ * @privilege early-execution-allowed - This function can be called in early-execution mode.
18607
+ *
18608
+ * @param callback
18609
+ * The callback function to remove.
18610
+ */
18611
+ unsubscribe(callback: (arg0: PlayerCursorItemReleaseAfterEvent) => void): void;
18612
+ }
18613
+
18291
18614
  /**
18292
18615
  * Contains information related to changes to a player's
18293
18616
  * dimension having been changed.
@@ -20466,6 +20789,104 @@ export class RandomRegionalDifficultyChanceCondition extends LootItemCondition {
20466
20789
  readonly maxChance: number;
20467
20790
  }
20468
20791
 
20792
+ /**
20793
+ * @rc
20794
+ * Provides access to the slots and recipe of a players active
20795
+ * crafting UI ie. stonecutter.
20796
+ */
20797
+ export class RecipeCraftingContext {
20798
+ private constructor();
20799
+ /**
20800
+ * @remarks
20801
+ * The amount of addressable input slots for getInputItem and
20802
+ * setInputItem.
20803
+ *
20804
+ * @throws This property can throw when used.
20805
+ *
20806
+ * {@link minecraftcommon.EngineError}
20807
+ */
20808
+ readonly inputSlotCount: number;
20809
+ /**
20810
+ * @remarks
20811
+ * Whether this recipe crafting context is valid. Invalidates
20812
+ * when the player closes the crafting UI or leaves.
20813
+ *
20814
+ */
20815
+ readonly isValid: boolean;
20816
+ /**
20817
+ * @remarks
20818
+ * The identifiers of the recipes that are valid for the
20819
+ * current input items.
20820
+ *
20821
+ * @throws This property can throw when used.
20822
+ *
20823
+ * {@link minecraftcommon.EngineError}
20824
+ */
20825
+ readonly validRecipes: string[];
20826
+ /**
20827
+ * @remarks
20828
+ * Gets the item in the provided input slot.
20829
+ *
20830
+ * @param slot
20831
+ * The zero-based input slot index.
20832
+ * @returns
20833
+ * The item stack in the input slot, or undefined if the slot
20834
+ * is empty.
20835
+ * @throws This function can throw errors.
20836
+ *
20837
+ * {@link minecraftcommon.ArgumentOutOfBoundsError}
20838
+ *
20839
+ * {@link minecraftcommon.EngineError}
20840
+ */
20841
+ getInputItem(slot: number): ItemStack | undefined;
20842
+ /**
20843
+ * @remarks
20844
+ * Gets the item produced by the currently selected recipe.
20845
+ *
20846
+ * @returns
20847
+ * The output item stack, or undefined if there is no output.
20848
+ * @throws This function can throw errors.
20849
+ *
20850
+ * {@link minecraftcommon.ArgumentOutOfBoundsError}
20851
+ *
20852
+ * {@link minecraftcommon.EngineError}
20853
+ */
20854
+ getOutputItem(): ItemStack | undefined;
20855
+ /**
20856
+ * @remarks
20857
+ * Sets or clears an item in an input slot.
20858
+ *
20859
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
20860
+ *
20861
+ * @param slot
20862
+ * The zero-based input slot index.
20863
+ * @param item
20864
+ * The item stack to place in the slot, or undefined to clear
20865
+ * the slot.
20866
+ * @throws This function can throw errors.
20867
+ *
20868
+ * {@link minecraftcommon.ArgumentOutOfBoundsError}
20869
+ *
20870
+ * {@link minecraftcommon.EngineError}
20871
+ */
20872
+ setInputItem(slot: number, item?: ItemStack): void;
20873
+ /**
20874
+ * @remarks
20875
+ * Selects a recipe for the current crafting operation.
20876
+ *
20877
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
20878
+ *
20879
+ * @param recipeId
20880
+ * The identifier of a valid recipe to select.
20881
+ * @throws This function can throw errors.
20882
+ *
20883
+ * {@link minecraftcommon.EngineError}
20884
+ *
20885
+ * {@link InvalidRecipeError}
20886
+ */
20887
+ setSelectedRecipe(recipeId: string): void;
20888
+ }
20889
+
20469
20890
  /**
20470
20891
  * Contains objectives and participants for the scoreboard.
20471
20892
  * @example updateScoreboard.ts
@@ -23912,6 +24333,35 @@ export class WorldAfterEvents {
23912
24333
  *
23913
24334
  */
23914
24335
  readonly playerCancelBreakingBlock: PlayerCancelBreakingBlockAfterEventSignal;
24336
+ /**
24337
+ * @rc
24338
+ * @remarks
24339
+ * This event fires when a player crafts a recipe.
24340
+ *
24341
+ * @privilege early-execution-readable - This property can be read in early-execution mode.
24342
+ *
24343
+ */
24344
+ readonly playerCraftRecipe: PlayerCraftRecipeAfterEventSignal;
24345
+ /**
24346
+ * @rc
24347
+ * @remarks
24348
+ * Event signal that fires when a player grabs an item from a
24349
+ * container to their cursor.
24350
+ *
24351
+ * @privilege early-execution-readable - This property can be read in early-execution mode.
24352
+ *
24353
+ */
24354
+ readonly playerCursorItemGrab: PlayerCursorItemGrabAfterEventSignal;
24355
+ /**
24356
+ * @rc
24357
+ * @remarks
24358
+ * Event signal that fires when a player releases an item from
24359
+ * their cursor into a container.
24360
+ *
24361
+ * @privilege early-execution-readable - This property can be read in early-execution mode.
24362
+ *
24363
+ */
24364
+ readonly playerCursorItemRelease: PlayerCursorItemReleaseAfterEventSignal;
23915
24365
  /**
23916
24366
  * @remarks
23917
24367
  * Fires when a player moved to a different dimension.
@@ -26931,6 +27381,31 @@ export interface PlayerBreakingBlockEventOptions {
26931
27381
  playerFilter?: EntityFilter;
26932
27382
  }
26933
27383
 
27384
+ /**
27385
+ * @rc
27386
+ * Contains options for filtering player craft recipe events.
27387
+ */
27388
+ export interface PlayerCraftRecipeEventOptions {
27389
+ /**
27390
+ * @remarks
27391
+ * Filter for the block where the recipe is crafted.
27392
+ *
27393
+ */
27394
+ blockFilter?: BlockFilter;
27395
+ /**
27396
+ * @remarks
27397
+ * Filter for the item crafted by the player.
27398
+ *
27399
+ */
27400
+ itemFilter?: ItemFilter;
27401
+ /**
27402
+ * @remarks
27403
+ * Filter for the player crafting the recipe.
27404
+ *
27405
+ */
27406
+ playerFilter?: EntityFilter;
27407
+ }
27408
+
26934
27409
  /**
26935
27410
  * Additional options for how a sound plays for a player.
26936
27411
  */
@@ -28383,6 +28858,23 @@ export class InvalidPotionEffectTypeError extends Error {
28383
28858
  private constructor();
28384
28859
  }
28385
28860
 
28861
+ /**
28862
+ * @rc
28863
+ * Thrown when an invalid recipe identifier is used.
28864
+ */
28865
+ // @ts-ignore Class inheritance allowed for native defined classes
28866
+ export class InvalidRecipeError extends Error {
28867
+ private constructor();
28868
+ /**
28869
+ * @remarks
28870
+ * The identifier of the invalid recipe.
28871
+ *
28872
+ * @privilege early-execution-readable - This property can be read in early-execution mode.
28873
+ *
28874
+ */
28875
+ readonly recipeId: string;
28876
+ }
28877
+
28386
28878
  /**
28387
28879
  * Thrown when a Structure is invalid. A structure becomes
28388
28880
  * invalid when it is deleted.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft/server",
3
- "version": "2.12.0-rc.1.26.70-preview.23",
3
+ "version": "2.12.0-rc.1.26.70-preview.24",
4
4
  "description": "",
5
5
  "contributors": [
6
6
  {
@@ -14,7 +14,7 @@
14
14
  ],
15
15
  "peerDependencies": {
16
16
  "@minecraft/common": "^1.2.0",
17
- "@minecraft/vanilla-data": ">=1.20.70 || 1.26.70-preview.23"
17
+ "@minecraft/vanilla-data": ">=1.20.70 || 1.26.70-preview.24"
18
18
  },
19
19
  "license": "MIT"
20
20
  }