@minecraft/server 2.11.0-beta.1.26.50-preview.27 → 2.12.0-beta.1.26.60-preview.21

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 +260 -4
  2. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -16,7 +16,7 @@
16
16
  * ```json
17
17
  * {
18
18
  * "module_name": "@minecraft/server",
19
- * "version": "2.11.0-beta"
19
+ * "version": "2.12.0-beta"
20
20
  * }
21
21
  * ```
22
22
  *
@@ -89,6 +89,10 @@ export enum BlockComponentTypes {
89
89
  *
90
90
  */
91
91
  PrecipitationInteractions = 'minecraft:precipitation_interactions',
92
+ /**
93
+ * @beta
94
+ */
95
+ RecipeCrafting = 'minecraft:recipe_crafting',
92
96
  /**
93
97
  * @remarks
94
98
  * Represents a block that can play a record.
@@ -3186,12 +3190,14 @@ export type BlockComponentTypeMap = {
3186
3190
  'minecraft:movable': BlockMovableComponent;
3187
3191
  'minecraft:piston': BlockPistonComponent;
3188
3192
  'minecraft:precipitation_interactions': BlockPrecipitationInteractionsComponent;
3193
+ 'minecraft:recipe_crafting': BlockRecipeCraftingComponent;
3189
3194
  'minecraft:record_player': BlockRecordPlayerComponent;
3190
3195
  'minecraft:redstone_producer': BlockRedstoneProducerComponent;
3191
3196
  'minecraft:sign': BlockSignComponent;
3192
3197
  movable: BlockMovableComponent;
3193
3198
  piston: BlockPistonComponent;
3194
3199
  precipitation_interactions: BlockPrecipitationInteractionsComponent;
3200
+ recipe_crafting: BlockRecipeCraftingComponent;
3195
3201
  record_player: BlockRecordPlayerComponent;
3196
3202
  redstone_producer: BlockRedstoneProducerComponent;
3197
3203
  sign: BlockSignComponent;
@@ -6007,6 +6013,41 @@ export class BlockPrecipitationInteractionsComponent extends BlockComponent {
6007
6013
  obstructsRain(): boolean;
6008
6014
  }
6009
6015
 
6016
+ /**
6017
+ * @beta
6018
+ * Represents a block component that provides access to recipe
6019
+ * crafting.
6020
+ */
6021
+ // @ts-ignore Class inheritance allowed for native defined classes
6022
+ export class BlockRecipeCraftingComponent extends BlockComponent {
6023
+ private constructor();
6024
+ /**
6025
+ * @remarks
6026
+ * Returns an array of all players currently interacting with
6027
+ * this block.
6028
+ *
6029
+ */
6030
+ readonly players: Player[];
6031
+ static readonly componentId = 'minecraft:recipe_crafting';
6032
+ /**
6033
+ * @remarks
6034
+ * Gets the recipe crafting context for a player interacting
6035
+ * with this block.
6036
+ *
6037
+ * @param player
6038
+ * The player for whom to retrieve the crafting context.
6039
+ * @returns
6040
+ * The current recipe crafting context for the player, or
6041
+ * undefined if the player isn't crafting.
6042
+ * @throws This function can throw errors.
6043
+ *
6044
+ * {@link minecraftcommon.EngineError}
6045
+ *
6046
+ * {@link InvalidEntityError}
6047
+ */
6048
+ getCraftingContext(player: Player): RecipeCraftingContext | undefined;
6049
+ }
6050
+
6010
6051
  /**
6011
6052
  * Represents a block that can play a record.
6012
6053
  */
@@ -9017,7 +9058,7 @@ export class Dimension {
9017
9058
  */
9018
9059
  spawnParticle(effectName: string, location: Vector3, molangVariables?: MolangVariableMap): void;
9019
9060
  /**
9020
- * @beta
9061
+ * @rc
9021
9062
  * @remarks
9022
9063
  * Spawns an experience orb at a specified location in the
9023
9064
  * dimension.
@@ -18997,6 +19038,72 @@ export class PlayerCancelBreakingBlockAfterEventSignal {
18997
19038
  unsubscribe(callback: (arg0: PlayerCancelBreakingBlockAfterEvent) => void): void;
18998
19039
  }
18999
19040
 
19041
+ /**
19042
+ * @beta
19043
+ * Contains information regarding a player crafting a recipe.
19044
+ */
19045
+ export class PlayerCraftRecipeAfterEvent {
19046
+ private constructor();
19047
+ /**
19048
+ * @remarks
19049
+ * The block where the recipe was crafted, if applicable.
19050
+ *
19051
+ */
19052
+ readonly block?: Block;
19053
+ /**
19054
+ * @remarks
19055
+ * The item stack crafted by the player.
19056
+ *
19057
+ */
19058
+ readonly itemStack?: ItemStack;
19059
+ /**
19060
+ * @remarks
19061
+ * The player who crafted the recipe.
19062
+ *
19063
+ */
19064
+ readonly player: Player;
19065
+ }
19066
+
19067
+ /**
19068
+ * @beta
19069
+ * Manages callbacks that are connected to when a player crafts
19070
+ * a recipe.
19071
+ */
19072
+ export class PlayerCraftRecipeAfterEventSignal {
19073
+ private constructor();
19074
+ /**
19075
+ * @remarks
19076
+ * Adds a callback that will be called when a player crafts a
19077
+ * recipe.
19078
+ *
19079
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
19080
+ *
19081
+ * @privilege early-execution-allowed - This function can be called in early-execution mode.
19082
+ *
19083
+ * @param callback
19084
+ * Function callback that is called when this event fires.
19085
+ * @param options
19086
+ * Additional filtering options for the event subscription.
19087
+ */
19088
+ subscribe(
19089
+ callback: (arg0: PlayerCraftRecipeAfterEvent) => void,
19090
+ options?: PlayerCraftRecipeEventOptions,
19091
+ ): (arg0: PlayerCraftRecipeAfterEvent) => void;
19092
+ /**
19093
+ * @remarks
19094
+ * Removes a callback from being called when a player crafts a
19095
+ * recipe.
19096
+ *
19097
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
19098
+ *
19099
+ * @privilege early-execution-allowed - This function can be called in early-execution mode.
19100
+ *
19101
+ * @param callback
19102
+ * The callback to remove from the event subscription.
19103
+ */
19104
+ unsubscribe(callback: (arg0: PlayerCraftRecipeAfterEvent) => void): void;
19105
+ }
19106
+
19000
19107
  /**
19001
19108
  * Represents the players cursor inventory. Used when moving
19002
19109
  * items between between containers in the inventory UI. Not
@@ -21356,6 +21463,104 @@ export class RandomRegionalDifficultyChanceCondition extends LootItemCondition {
21356
21463
  readonly maxChance: number;
21357
21464
  }
21358
21465
 
21466
+ /**
21467
+ * @beta
21468
+ * Provides access to the slots and recipe of a players active
21469
+ * crafting UI ie. stonecutter.
21470
+ */
21471
+ export class RecipeCraftingContext {
21472
+ private constructor();
21473
+ /**
21474
+ * @remarks
21475
+ * The amount of addressable input slots for getInputItem and
21476
+ * setInputItem.
21477
+ *
21478
+ * @throws This property can throw when used.
21479
+ *
21480
+ * {@link minecraftcommon.EngineError}
21481
+ */
21482
+ readonly inputSlotCount: number;
21483
+ /**
21484
+ * @remarks
21485
+ * Whether this recipe crafting context is valid. Invalidates
21486
+ * when the player closes the crafting UI or leaves.
21487
+ *
21488
+ */
21489
+ readonly isValid: boolean;
21490
+ /**
21491
+ * @remarks
21492
+ * The identifiers of the recipes that are valid for the
21493
+ * current input items.
21494
+ *
21495
+ * @throws This property can throw when used.
21496
+ *
21497
+ * {@link minecraftcommon.EngineError}
21498
+ */
21499
+ readonly validRecipes: string[];
21500
+ /**
21501
+ * @remarks
21502
+ * Gets the item in the provided input slot.
21503
+ *
21504
+ * @param slot
21505
+ * The zero-based input slot index.
21506
+ * @returns
21507
+ * The item stack in the input slot, or undefined if the slot
21508
+ * is empty.
21509
+ * @throws This function can throw errors.
21510
+ *
21511
+ * {@link minecraftcommon.ArgumentOutOfBoundsError}
21512
+ *
21513
+ * {@link minecraftcommon.EngineError}
21514
+ */
21515
+ getInputItem(slot: number): ItemStack | undefined;
21516
+ /**
21517
+ * @remarks
21518
+ * Gets the item produced by the currently selected recipe.
21519
+ *
21520
+ * @returns
21521
+ * The output item stack, or undefined if there is no output.
21522
+ * @throws This function can throw errors.
21523
+ *
21524
+ * {@link minecraftcommon.ArgumentOutOfBoundsError}
21525
+ *
21526
+ * {@link minecraftcommon.EngineError}
21527
+ */
21528
+ getOutputItem(): ItemStack | undefined;
21529
+ /**
21530
+ * @remarks
21531
+ * Sets or clears an item in an input slot.
21532
+ *
21533
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
21534
+ *
21535
+ * @param slot
21536
+ * The zero-based input slot index.
21537
+ * @param item
21538
+ * The item stack to place in the slot, or undefined to clear
21539
+ * the slot.
21540
+ * @throws This function can throw errors.
21541
+ *
21542
+ * {@link minecraftcommon.ArgumentOutOfBoundsError}
21543
+ *
21544
+ * {@link minecraftcommon.EngineError}
21545
+ */
21546
+ setInputItem(slot: number, item?: ItemStack): void;
21547
+ /**
21548
+ * @remarks
21549
+ * Selects a recipe for the current crafting operation.
21550
+ *
21551
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
21552
+ *
21553
+ * @param recipeId
21554
+ * The identifier of a valid recipe to select.
21555
+ * @throws This function can throw errors.
21556
+ *
21557
+ * {@link minecraftcommon.EngineError}
21558
+ *
21559
+ * {@link InvalidRecipeError}
21560
+ */
21561
+ setSelectedRecipe(recipeId: string): void;
21562
+ }
21563
+
21359
21564
  /**
21360
21565
  * Contains objectives and participants for the scoreboard.
21361
21566
  * @example updateScoreboard.ts
@@ -23476,7 +23681,7 @@ export class TextPrimitive extends PrimitiveShape {
23476
23681
  */
23477
23682
  depthTest: boolean;
23478
23683
  /**
23479
- * @beta
23684
+ * @rc
23480
23685
  * @remarks
23481
23686
  * This value determines the gap between lines for the
23482
23687
  * TextPrimitive. By default the line gap height is 0.
@@ -25001,6 +25206,15 @@ export class WorldAfterEvents {
25001
25206
  *
25002
25207
  */
25003
25208
  readonly playerCancelBreakingBlock: PlayerCancelBreakingBlockAfterEventSignal;
25209
+ /**
25210
+ * @beta
25211
+ * @remarks
25212
+ * This event fires when a player crafts a recipe.
25213
+ *
25214
+ * @privilege early-execution-readable - This property can be read in early-execution mode.
25215
+ *
25216
+ */
25217
+ readonly playerCraftRecipe: PlayerCraftRecipeAfterEventSignal;
25004
25218
  /**
25005
25219
  * @remarks
25006
25220
  * Fires when a player moved to a different dimension.
@@ -28021,6 +28235,31 @@ export interface PlayerBreakingBlockEventOptions {
28021
28235
  playerFilter?: EntityFilter;
28022
28236
  }
28023
28237
 
28238
+ /**
28239
+ * @beta
28240
+ * Contains options for filtering player craft recipe events.
28241
+ */
28242
+ export interface PlayerCraftRecipeEventOptions {
28243
+ /**
28244
+ * @remarks
28245
+ * Filter for the block where the recipe is crafted.
28246
+ *
28247
+ */
28248
+ blockFilter?: BlockFilter;
28249
+ /**
28250
+ * @remarks
28251
+ * Filter for the item crafted by the player.
28252
+ *
28253
+ */
28254
+ itemFilter?: ItemFilter;
28255
+ /**
28256
+ * @remarks
28257
+ * Filter for the player crafting the recipe.
28258
+ *
28259
+ */
28260
+ playerFilter?: EntityFilter;
28261
+ }
28262
+
28024
28263
  /**
28025
28264
  * Additional options for how a sound plays for a player.
28026
28265
  */
@@ -29169,7 +29408,7 @@ export interface WorldClockTimeMarkerEventOptions {
29169
29408
  */
29170
29409
  export interface WorldSoundOptions {
29171
29410
  /**
29172
- * @beta
29411
+ * @rc
29173
29412
  */
29174
29413
  isBroadcast?: boolean;
29175
29414
  /**
@@ -29479,6 +29718,23 @@ export class InvalidPotionEffectTypeError extends Error {
29479
29718
  private constructor();
29480
29719
  }
29481
29720
 
29721
+ /**
29722
+ * @beta
29723
+ * Thrown when an invalid recipe identifier is used.
29724
+ */
29725
+ // @ts-ignore Class inheritance allowed for native defined classes
29726
+ export class InvalidRecipeError extends Error {
29727
+ private constructor();
29728
+ /**
29729
+ * @remarks
29730
+ * The identifier of the invalid recipe.
29731
+ *
29732
+ * @privilege early-execution-readable - This property can be read in early-execution mode.
29733
+ *
29734
+ */
29735
+ readonly recipeId: string;
29736
+ }
29737
+
29482
29738
  /**
29483
29739
  * Thrown when a Structure is invalid. A structure becomes
29484
29740
  * invalid when it is deleted.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft/server",
3
- "version": "2.11.0-beta.1.26.50-preview.27",
3
+ "version": "2.12.0-beta.1.26.60-preview.21",
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.50-preview.27"
17
+ "@minecraft/vanilla-data": ">=1.20.70 || 1.26.60-preview.21"
18
18
  },
19
19
  "license": "MIT"
20
20
  }