1010 * ```
1111 */
1212declare module "@minecraft/server-editor" {
13- import { AfterEvents , Player , System , Vector3 } from "@minecraft/server" ;
13+ import { WorldAfterEvents , BlockType , Player , System , Vector3 } from "@minecraft/server" ;
1414 import { Extension , ExtensionContext , Selection , ExtensionOptionalParameters , Logger } from "@minecraft/server-editor-bindings" ;
1515 export * from "@minecraft/server-editor-bindings" ;
1616 class BaseControl {
@@ -28,13 +28,13 @@ declare module "@minecraft/server-editor" {
2828 }
2929 export interface ToolParams {
3030 name ?: string ;
31- displayString ?: string ;
32- displayStringLocId ?: string ;
31+ displayAltText ?: string ;
32+ displayStringId ?: string ;
3333 icon ?: string ;
34- tooltip ?: string ;
35- tooltipLocId ?: string ;
34+ tooltipAltText ?: string ;
35+ tooltipStringId ?: string ;
3636 }
37- class EventToken < H extends keyof AfterEvents = keyof AfterEvents , K extends AfterEvents [ H ] = AfterEvents [ H ] > {
37+ class EventToken < H extends keyof WorldAfterEvents = keyof WorldAfterEvents , K extends WorldAfterEvents [ H ] = WorldAfterEvents [ H ] > {
3838 constructor ( _event : K ) ;
3939 unsubscribe ( ) : void ;
4040 }
@@ -126,7 +126,7 @@ declare module "@minecraft/server-editor" {
126126 }
127127 export interface MenuProps {
128128 name ?: string ;
129- displayStringLocId ?: string ;
129+ displayStringId ?: string ;
130130 }
131131 class Menu extends BaseControl {
132132 constructor ( props : any , _dispatcher : any , _actionId : any , _parent : any ) ;
@@ -139,7 +139,7 @@ declare module "@minecraft/server-editor" {
139139 private _name : string ;
140140 get id ( ) : string ;
141141 get submenu ( ) : Menu [ ] ;
142- get displayStringLocId ( ) : string ;
142+ get displayStringId ( ) : string ;
143143 get name ( ) : string ;
144144 set name ( value : string ) ;
145145 dispose ( ) : void ;
@@ -189,14 +189,14 @@ declare module "@minecraft/server-editor" {
189189 removePropertyPane ( paneToRemove : PropertyPane ) : boolean ;
190190 hide ( ) : void ;
191191 show ( ) : void ;
192- addString ( obj : Record < string , any > , property : string , options : PaneOptions ) : PropertyItem ;
193- addBool ( obj : Record < string , any > , property : string , options : BoolPaneOptions ) : PropertyItem ;
194- addNumber ( obj : Record < string , any > , property : string , options : NumberPaneOptions ) : PropertyItem ;
195- addBlockPicker ( obj : Record < string , any > , property : string , options : BlockPickerPaneOptions ) : PropertyItem ;
196- addButton ( action : Record < string , any > , options : ButtonPaneOptions ) : PropertyItem ;
197- addDropdown < T > ( obj : Record < string , any > , property : string , options : DropdownPaneOptions < T > ) : PropertyItem ;
192+ addString < K extends string , T extends Record < K , string > & Record < string , any > > ( obj : T , property : K , options : PaneOptions ) : PropertyItem ;
193+ addBool < K extends string , T extends Record < K , boolean > & Record < string , any > > ( obj : T , property : K , options : BoolPaneOptions < T , K > ) : PropertyItem ;
194+ addNumber < K extends string , T extends Record < K , number > & Record < string , any > > ( obj : T , property : K , options : NumberPaneOptions < T , K > ) : PropertyItem ;
195+ addBlockPicker < K extends string , T extends Record < K , BlockType > & Record < string , any > > ( obj : T , property : K , options : BlockPickerPaneOptions ) : PropertyItem ;
196+ addButton ( action : Action < ActionTypes > , options : ButtonPaneOptions ) : PropertyItem ;
197+ addDropdown < T , K extends string , H extends Record < K , T > & Record < string , any > > ( obj : H , property : K , options : DropdownPaneOptions < T , H , K > ) : PropertyItem ;
198198 addDivider ( ) : PropertyItem ;
199- addVec3 ( obj : Record < string , any > , property : string , options : Vec3PaneOptions ) : PropertyItem ;
199+ addVector3 < K extends string , T extends Record < K , Vector3 > & Record < string , any > > ( obj : T , property : K , options : Vec3PaneOptions ) : PropertyItem ;
200200 }
201201 class StatusBarItem extends BaseControl {
202202 private _id : string ;
@@ -297,24 +297,24 @@ declare module "@minecraft/server-editor" {
297297 visible ?: boolean ;
298298 width ?: number ;
299299 }
300- export interface BoolPaneOptions extends PaneOptions {
301- onChange ?: ( _obj : object , _property : string , _oldValue : boolean , _newValue : boolean ) => void ;
300+ export interface BoolPaneOptions < T , K > extends PaneOptions {
301+ onChange ?: ( _obj : T , _property : K , _oldValue : boolean , _newValue : boolean ) => void ;
302302 }
303303 export interface BlockPickerPaneOptions extends PaneOptions {
304304 allowedBlocks ?: string [ ] ;
305305 }
306306 export interface ButtonPaneOptions extends PaneOptions {
307307 variant ?: string ;
308308 }
309- export interface DropdownPaneOptions < T > extends PaneOptions {
310- onChange ?: ( _obj : object , _property : string , _oldValue : T , _newValue : T ) => void ;
309+ export interface DropdownPaneOptions < T , H , K > extends PaneOptions {
310+ onChange ?: ( _obj : H , _property : K , _oldValue : T , _newValue : T ) => void ;
311311 dropdownItems : DropdownItem < T > [ ] ;
312312 }
313- export interface NumberPaneOptions extends PaneOptions {
313+ export interface NumberPaneOptions < T , K > extends PaneOptions {
314314 min ?: number ;
315315 max ?: number ;
316316 showSlider ?: boolean ;
317- onChange ?: ( _obj : object , _property : string , _oldValue : number , _newValue : number ) => void ;
317+ onChange ?: ( _obj : T , _property : K , _oldValue : number , _newValue : number ) => void ;
318318 }
319319 export interface Vec3PaneOptions extends PaneOptions {
320320 minX : number ;
@@ -329,7 +329,7 @@ declare module "@minecraft/server-editor" {
329329 * Represents a UI session for a given player
330330 * @internal
331331 */
332- class PlayerUISession {
332+ class PlayerUISession < T = unknown > {
333333 private _builtInUIManager : BuiltInUIManagerImpl ;
334334 private _actionManager : ActionManagerImpl ;
335335 private _modalToolContainer : ModalToolContainer ;
@@ -341,7 +341,7 @@ declare module "@minecraft/server-editor" {
341341 private _inputManager : GlobalInputManager ;
342342 private _logger : Logger ;
343343 private createPropertyPaneInternal ( options : PaneOptions , parentPaneId : string ) : PropertyPane ;
344- scratchStorage ?: Record < string , any > ;
344+ scratchStorage ?: T ;
345345 teardown ( ) : void ;
346346 get toolRail ( ) : ModalToolContainer ;
347347 createMenu ( props : MenuProps ) : Menu ;
@@ -369,7 +369,7 @@ declare module "@minecraft/server-editor" {
369369 * @beta
370370 */
371371 export class BedrockEventSubscriptionCache {
372- constructor ( mEvents : AfterEvents ) ;
372+ constructor ( mEvents : WorldAfterEvents ) ;
373373 /**
374374 * Subcribes to a bedrock event using the key of the desired event. When subscribed, the event handler
375375 * is both returned, but also cached internally for unsubscription. This means the caller of the subscription
@@ -379,9 +379,9 @@ declare module "@minecraft/server-editor" {
379379 * @param event - The event on the bedrock APIs to which to subscribe
380380 * @param params - The parameters to the subscription method for the event. Auto complete will display this for you
381381 */
382- subscribeToBedrockEvent < T extends keyof AfterEvents > ( event : T , ...params : Parameters < AfterEvents [ T ] [ "subscribe" ] > ) : ReturnType < AfterEvents [ T ] [ "subscribe" ] > ;
382+ subscribeToBedrockEvent < T extends keyof WorldAfterEvents > ( event : T , ...params : Parameters < WorldAfterEvents [ T ] [ "subscribe" ] > ) : ReturnType < WorldAfterEvents [ T ] [ "subscribe" ] > ;
383383 teardown ( ) : void ;
384- private mEvents : AfterEvents ;
384+ private mEvents : WorldAfterEvents ;
385385 private subscribedEvents : object ;
386386 }
387387 /**
@@ -604,7 +604,7 @@ declare module "@minecraft/server-editor" {
604604 * Takes the input object and bind it to the pane.
605605 * @beta
606606 */
607- export function createPaneBindingObject < T > ( propertyPane : PropertyPane , target : T ) : T ;
607+ export function bindDataSource < T > ( propertyPane : PropertyPane , target : T ) : T ;
608608 /**
609609 * Executes an operation over a selection via chunks to allow splitting operation over multiple game ticks
610610 * @param selection - the selection to iterator over
@@ -632,7 +632,7 @@ declare module "@minecraft/server-editor" {
632632 /**
633633 * Interface for internal PlayerUISession class
634634 */
635- export interface IPlayerUISession extends PlayerUISession {
635+ export interface IPlayerUISession < T = unknown > extends PlayerUISession < T > {
636636 }
637637 /**
638638 * Interface for internal ModalTool class
0 commit comments