diff --git a/core-engine/BlockState.d.ts b/core-engine/BlockState.d.ts index f09aad6ad..f1a9b485d 100644 --- a/core-engine/BlockState.d.ts +++ b/core-engine/BlockState.d.ts @@ -104,15 +104,10 @@ declare class BlockState implements Tile { */ getNamedStatesScriptable(): { [key: string]: number }; - /** - * @returns String representation of the following object. - */ - toString(): string; - /** * @returns Whether the following object is equal to given, * according to different parameters. */ equals(object: any): boolean; -} \ No newline at end of file +} diff --git a/core-engine/Callback.d.ts b/core-engine/Callback.d.ts index a21570ca7..ab349d796 100644 --- a/core-engine/Callback.d.ts +++ b/core-engine/Callback.d.ts @@ -846,7 +846,7 @@ declare namespace Callback { * @param byUser if `true`, container was closed by user, * from the code otherwise */ - (container: UI.Container, window: com.zhekasmirnov.innercore.api.mod.ui.window.IWindow, byUser: boolean): void + (container: UI.Container, window: UI.IWindow, byUser: boolean): void } function addCallback(name: "ContainerClosed", func: ContainerClosedFunction, priority?: number): void; @@ -859,7 +859,7 @@ declare namespace Callback { * @param container container that was opened * @param window window that was loaded in the container */ - (container: UI.Container, window: com.zhekasmirnov.innercore.api.mod.ui.window.IWindow): void + (container: UI.Container, window: UI.IWindow): void } function addCallback(name: "ContainerOpened", func: ContainerOpenedFunction, priority?: number): void; @@ -886,7 +886,7 @@ declare namespace Callback { /** * @param window window that was opened */ - (window: com.zhekasmirnov.innercore.api.mod.ui.window.IWindow): void; + (window: UI.IWindow): void; } function addCallback(name: "CustomWindowOpened", func: CustomWindowFunction, priority?: number): void; diff --git a/core-engine/Config.d.ts b/core-engine/Config.d.ts index 14717d7d9..b300b4fe6 100644 --- a/core-engine/Config.d.ts +++ b/core-engine/Config.d.ts @@ -1,15 +1,131 @@ /** * Json configuration file reading/writing utility. */ -declare class Config extends com.zhekasmirnov.innercore.mod.build.Config { - static class: java.lang.Class; +declare class Config { + /** + * Creates new {@link Config} instance using specified file. + * @param file {@link java.io.File} instance of the file to use + */ + constructor(file: java.io.File); + /** + * Creates new {@link Config} instance using specified file. + * @param path path to configuration file + */ + constructor(path: string); + /** + * @since 2.2.1b96 + */ + getPath(): string; + /** + * @since 2.2.1b96 + */ + reload(): void; + /** + * Writes configuration JSON to the file. + */ + save(): void; + /** + * @returns Read-only ArrayList instance containing + * all the names in the current config file. + */ + getNames(): java.util.ArrayList; + /** + * Gets property from the config. + * @param name option name, supports multi-layer calls, separated by **'.'** + * @returns Config instance with current config as parent if the + * property is object, {@link org.json.JSONArray} instance if the property is an + * array, raw type if the property is of that raw type, `null` otherwise. + * + * @example + * ```ts + * config.get("generation.ore_copper.max_height"); + * ``` + */ + get>(name: string): T; + /** + * Same as {@link Config.get}. + */ + access>(name: string): T; + /** + * @param name option name, supports multi-layer calls, separated by **'.'** + * @returns Boolean config value specified in config or false if no value was + * specified. + */ + getBool(name: string): boolean; + /** + * @param name option name, supports multi-layer calls, separated by **'.'** + * @returns Number object instance, containing numeric value by given name + * from the config, or `0` if no value was specified. + */ + getNumber(name: string): java.lang.Number; + /** + * @param name option name, supports multi-layer calls, separated by **'.'** + * @returns Integer of value by given name from the config, or `0` if no value was specified. + */ + getInteger(name: string): number; + /** + * @param name option name, supports multi-layer calls, separated by **'.'** + * @returns Floating-point number of value by given name from the config, or `0.0` if no value was specified. + */ + getFloat(name: string): number; + /** + * @param name option name, supports multi-layer calls, separated by **'.'** + * @returns Double number of value by given name from the config, or `0.0` if no value was specified. + */ + getDouble(name: string): number; + /** + * @param name option name, supports multi-layer calls, separated by **'.'** + * @returns String by given name from the config, or `null` if no value was specified. + */ + getString(name: string): Nullable; + /** + * Sets config value. Do not use {@link org.json.JSONObject} instances to create + * nested objects, consider using dot-separated names instead. + * @param name option name, supports multi-layer calls, separated by **'.'** + * @param val value, may be {@link org.json.JSONArray} instance, + * {@link org.json.JSONObject} instance or raw data type + */ + set(name: string, val: T): boolean; + /** + * @param path option name, supports multi-layer calls, separated by **'.'** + * @returns Editable {@link Config.ConfigValue} instance that can be used + * to manipulate this config option separately. + */ + getValue(path: string): Nullable; + /** + * Ensures that config has all the properties the data pattern contains, if + * not, puts default values to match the pattern. + * @param jsonstr string representation of JSON object representing the data pattern + */ + checkAndRestore(jsonstr: string): void; + /** + * Ensures that config has all the properties the data pattern contains, if + * not, puts default values to match the pattern. + * @param jsonobj javascript object representing the data pattern checkAndRestore + */ + checkAndRestore(jsonobj: Scriptable): void; + /** + * Ensures that config has all the properties the data pattern contains, if + * not, puts default values to match the pattern. + * @param json {@link org.json.JSONObject} instance to be used as data pattern + */ + checkAndRestore(json: org.json.JSONObject): void; } declare namespace Config { /** - * Class representing config value with it's path withing Config object. + * Class representing config value with it's path withing {@link Config} object. */ - class ConfigValue extends com.zhekasmirnov.innercore.mod.build.Config.ConfigValue { - static class: java.lang.Class; + class ConfigValue { + /** + * Sets config value and saves configuration file. + * @param value value, may be {@link org.json.JSONArray} instance, + * {@link org.json.JSONObject} instance or raw data type. + */ + set(value: T): void; + /** + * @returns Config value, result is the same as the result of {@link Config.get} call. + */ + get>(): T; } -} \ No newline at end of file +} diff --git a/core-engine/ItemContainer.d.ts b/core-engine/ItemContainer.d.ts index bafac0711..1ba425388 100644 --- a/core-engine/ItemContainer.d.ts +++ b/core-engine/ItemContainer.d.ts @@ -1,21 +1,415 @@ +declare namespace ItemContainer { + type PrimitiveTypes = string | number | boolean; + type PacketData = { + [key: string]: PrimitiveTypes; + }; + + interface BindingValidator { + (container: ItemContainer, str: string, obj: any, time: number): any; + } + interface ClientEventListener { + (container: ItemContainer, window: UI.IWindow, scriptable: any, obj: any): void; + } + interface ClientOnCloseListener { + (container: ItemContainer): void; + } + interface ClientOnOpenListener { + (container: ItemContainer, str: string): void; + } + interface DirtySlotListener { + (container: ItemContainer, str: string, slot: ItemContainerSlot): void; + } + interface ServerEventListener { + (container: ItemContainer, client: NetworkClient, obj: any): void; + } + interface ServerOnCloseListener { + (container: ItemContainer, client: NetworkClient): void; + } + interface ServerOnOpenListener { + (container: ItemContainer, client: NetworkClient, screenName: string): void; + } + interface Transaction { + (container: ItemContainer, str: string): void; + } + interface TransferPolicy { + (container: ItemContainer, str: string, id: number, count: number, data: number, extra: Nullable, time: number): number; + } + interface UiScreenFactory { + (container: ItemContainer, screen: string): UI.IWindow; + } +} + /** * Backwards compatibility. */ -declare type TransferPolicy = com.zhekasmirnov.apparatus.api.container.ItemContainerFuncs.TransferPolicy; +declare type TransferPolicy = ItemContainer.TransferPolicy; + +declare interface ItemContainerUiHandler extends UI.UiAbstractContainer { + getWindow(): UI.IWindow; + getParent(): ItemContainer; + handleBindingDirty(elementName: string, bindingName: string): void; + applyAllBindingsFromMap(): void; + setBindingByComposedName(name: string, value: ItemContainer.PrimitiveTypes): void; + receiveBindingsFromServer(bindings: org.json.JSONObject): void; +} /** * Type of TileEntity container that supports multiplayer. */ -declare class ItemContainer extends com.zhekasmirnov.apparatus.api.container.ItemContainer { - static class: java.lang.Class; +declare class ItemContainer implements Recipes.WorkbenchField { + readonly isServer: boolean; + readonly slots: {[key: string]: ItemContainerSlot}; + readonly transactionLock: any; + static loadClass(): void; + static registerScreenFactory(factoryName: string, factory: ItemContainer.UiScreenFactory): void; + static addClientEventListener(typeName: string, packetName: string, listener: ItemContainer.ClientEventListener): void; + static addClientOpenListener(typeName: string, listener: ItemContainer.ClientOnOpenListener): void; + static addClientCloseListener(typeName: string, listener: ItemContainer.ClientOnCloseListener): void; + static getClientContainerInstance(name: string): Nullable; /** * Constructs a new {@link ItemContainer} object. */ constructor(); /** - * Constructs a new {@link ItemContainer} object from given deprecated {@link UI.Container} object. + * Constructs a new {@link ItemContainer} object from given + * deprecated {@link UI.Container} object. */ constructor(legacyContainer: UI.Container); + getNetworkEntity(): NetworkEntity; + getNetworkName(): string; + getUiAdapter(): ItemContainerUiHandler; + getWindow(): UI.IWindow; + getWindowContent(): UI.WindowContent; + removeEntity(): void; + /** + * Sets container's parent object, for {@link TileEntity}'s + * container it should be it reference, otherwise you can pass any + * value to be used in your code later. + * @param parent an object to be set as container's parent + */ + setParent(parent: Nullable | any): void; + /** + * @returns Tile if the following container is part of it, + * and `null` otherwise. + */ + getParent(): Nullable | any; + + setGlobalAddTransferPolicy(policy: ItemContainer.TransferPolicy): ItemContainer; + setGlobalGetTransferPolicy(policy: ItemContainer.TransferPolicy): ItemContainer; + setSlotAddTransferPolicy(slotName: string, policy: ItemContainer.TransferPolicy): ItemContainer; + setSlotGetTransferPolicy(slotName: string, policy: ItemContainer.TransferPolicy): ItemContainer; + setGlobalDirtySlotListener(listener: ItemContainer.DirtySlotListener): ItemContainer; + setDirtySlotListener(listener: ItemContainer.DirtySlotListener): void; + sealSlot(slotName: string): void; + sealAllSlots(): void; + getAddTransferPolicy(slot: string): ItemContainer.TransferPolicy; + getGetTransferPolicy(slot: string): ItemContainer.TransferPolicy; + setGlobalBindingValidator(validator: ItemContainer.BindingValidator): void; + setBindingValidator(composedBindingName: string, validator: ItemContainer.BindingValidator): void; + getBindingValidator(composedBindingName: string): ItemContainer.BindingValidator; + runTransaction(transaction: ItemContainer.Transaction): void; + /** + * Gets the slot by it's name. If a slot with specified name doesn't + * exists, creates an empty one with specified name. + * @param name slot name + * @returns Contents of the slot in a {@link ItemContainerSlot} object. + * You can modify it to change the contents of the slot. + */ + getSlot(name: string): ItemContainerSlot; + /** + * @deprecated Use {@link ItemContainer.getSlot} instead. + */ + getFullSlot(name: string): ItemContainerSlot; + markSlotDirty(name: string): void; + markAllSlotsDirty(): void; + /** + * Sets slot's content by it's name from given slot object. If a slot with specified + * name doesn't exist, a new slot with specified name and item will be created. + * @param name slot name + * @param slot {@link ItemContainerSlot} object to specify slot contents + */ + setSlot(name: string, slot: ItemContainerSlot): void; + /** + * Set slot's content by it's name. If a slot with specified name doesn't + * exists, creates new with specified name and item. + * @param name slot name + */ + setSlot(name: string, id: number, count: number, data: number): void; + /** + * Set slot's content by it's name. If a slot with specified name doesn't + * exists, creates new with specified name and item. + * @param name slot name + * @param extra item extra data + */ + setSlot(name: string, id: number, count: number, data: number, extra: Nullable): void; + addToSlot(name: string, id: number, count: number, data: number, extra: Nullable, player: number): number; + getFromSlot(name: string, id: number, count: number, data: number, extra: Nullable, player: number): number; + /** + * Sends changes in container to all clients. + * Needs to be used every time when something changes in container. + */ + sendChanges(): void; + dropAt(region: BlockSource, x: number, y: number, z: number): void; + /** + * Validates all the slots in the container. + */ + validateAll(): void; + /** + * Validates slot contents. If the data value is less then 0, it becomes + * 0, if ID is 0 or count is less then or equals to zero, slot is reset + * to an empty one. + * @param name slot name + */ + validateSlot(name: string): void; + /** + * Clears slot's contents. + * @param name slot name + */ + clearSlot(name: string): void; + /** + * Drops slot's contents on the specified coordinates and clears the + * slot. + * @param name slot name + */ + dropSlot(region: BlockSource, name: string, x: number, y: number, z: number): void; + /** + * Sends event to move specified amount of items from the player inventory slot by given index + * to container slot by given name. This event is sent from client to server, + * so you should use it only on the client side, for example, in custom slot element touch events, etc. + * @param inventorySlot numeric index of the inventory slot, from where to retrieve the item + * @param slotName string name of the container slot, where to put taken item + * @param amount item count to be retrieved from inventory slot + */ + sendInventoryToSlotTransaction(inventorySlot: number, slotName: string, amount: number): void; + handleInventoryToSlotTransaction(player: number, inventorySlot: number, slotName: string, amount: number): void; + /** + * Sends event to move specified amount of items from one container slot to another by given names. + * This event is sent from client to server, so you should use it only on the client side, + * for example, in custom slot element touch events, etc. + * @param slot1 string name of the container slot, from where to retrieve item + * @param slot2 string name of the container slot, where to put taken item + * @param amount item count to be retrieved from container slot + */ + sendSlotToSlotTransaction(slot1: string, slot2: string, amount: number): void; + handleSlotToSlotTransaction(player: number, slot1: string, slot2: string, amount: number): void; + /** + * Sends event to move specified amount of items from the container slot by given name + * to player's inventory. The index of the inventory slot, where to put item, can't be specified, + * because it's decided by {@link ItemContainer} automatically, and you just don't need to do this. + * This event is sent from client to server, so you should use it only on the client side, + * for example, in custom slot element touch events, etc. + * @param slot string name of the container slot, from where to retrieve item + * @param amount item count to be retrieved from container slot + */ + sendSlotToInventoryTransaction(slot: string, amount: number): void; + handleSlotToInventoryTransaction(player: number, slotName: string, inventorySlot: number, amount: number): void; + sendDirtyClientBinding(key: string, value: ItemContainer.PrimitiveTypes): void; + handleDirtyBindingsPacket(client: NetworkClient, packet: org.json.JSONObject): void; + setBinding(composedBindingName: string, value: ItemContainer.PrimitiveTypes): void; + setClientBinding(composedBindingName: string, value: ItemContainer.PrimitiveTypes): void; + getBinding(composedBindingName: string): ItemContainer.PrimitiveTypes; + setBinding(elementName: string, bindingName: string, value: ItemContainer.PrimitiveTypes): void; + setClientBinding(elementName: string, bindingName: string, value: ItemContainer.PrimitiveTypes): void; + getBinding(elementName: string, bindingName: string): ItemContainer.PrimitiveTypes; + /** + * Sets "value" binding value for the element. Used to set scales values. + * @param elementName element name + * @param value value to be set for the element + */ + setScale(elementName: string, value: number): void; + setClientScale(elementName: string, value: number): void; + /** + * @param elementName element name + * @returns Value with "value" binding, e.g. scale value, or `null` if no + * element with specified name exist. + */ + getValue(elementName: string, value: number): Nullable; + /** + * Sets "text" binding value for the element. Used to set element's text. + * @param elementName element name + * @param text value to be set for the element + */ + setText(elementName: string, text: string | number): void; + setClientText(elementName: string, text: string): void; + /** + * @param elementName element name + * @returns Value "text" binding, usually the text displayed on the + * element, or `null` if no element with specified name exist. + */ + getText(elementName: string): Nullable; + setClientContainerTypeName(type: string): void; + getClientContainerTypeName(): string; + addServerEventListener(name: string, listener: ItemContainer.ServerEventListener): void; + addServerOpenListener(listener: ItemContainer.ServerOnOpenListener): void; + addServerCloseListener(listener: ItemContainer.ServerOnCloseListener): void; + /** + * Sends packet from client container copy to server. + */ + sendEvent(name: string, data: ItemContainer.PacketData | string): void; + /** + * Sends packet from server container copy to client. + */ + sendEvent(client: NetworkClient, name: string, data: ItemContainer.PacketData | string): void; + /** + * Sends packet from server container. + * @remarks + * Available only in server container events! + */ + sendResponseEvent(name: string, data: ItemContainer.PacketData | string): void; + /** + * Opens UI for client. + * @param client client in which UI will be open + * @param screenName name of the screen to open + */ + openFor(client: NetworkClient, screenName: string): void; + /** + * Closes UI for client. + * @param client client in which UI will be open + */ + closeFor(client: NetworkClient): void; + /** + * Closes UI for all clients + */ + close(): void; + sendClosed(): void; + /** + * @since 2.2.0b82 + */ + setGlobalSlotSavingEnabled(enabled: boolean): void; + /** + * @since 2.2.0b82 + */ + isGlobalSlotSavingEnabled(): boolean; + /** + * @since 2.2.0b82 + */ + setSlotSavingEnabled(name: string, enabled: boolean): void; + /** + * @since 2.2.0b82 + */ + resetSlotSavingEnabled(name: string): void; + /** + * @since 2.2.0b82 + */ + isSlotSavingEnabled(name: string): boolean; + /** + * @returns `false` if container supports multiplayer, `true` otherwise. + */ + isLegacyContainer(): false; + /** + * @since 2.2.0b82 + */ + asLegacyContainer(allSlots: boolean): UI.Container; + asLegacyContainer(): UI.Container; + setWorkbenchFieldPrefix(prefix: string): void; + /** + * @since 2.2.1b106 + */ + setWorkbenchFieldSize(workbenchFieldSize: number): void; + /** + * @param slot slot index + * @returns Workbench slot instance by slot index. + */ + getFieldSlot(slot: number): UI.AbstractSlot; + /** + * @since 2.2.1b108 + */ + getFieldSlot(x: number, y: number): UI.AbstractSlot; + /** + * @returns JS array of all slots. + */ + asScriptableField(): UI.AbstractSlot[]; + /** + * @since 2.2.1b106 + */ + getWorkbenchFieldSize(): number; } -declare class ItemContainerSlot extends com.zhekasmirnov.apparatus.api.container.ItemContainerSlot {} +declare class ItemContainerSlot implements UI.AbstractSlot { + count: number; + data: number; + extra: Nullable; + id: number; + constructor(id: number, count: number, data: number); + constructor(id: number, count: number, data: number, extra: Nullable); + constructor(item: ItemInstance); + constructor(json: org.json.JSONObject, convert: boolean); + constructor(); + /** + * @returns Slot name. + */ + getName(): string; + /** + * @returns Container linked to the slot. + */ + getContainer(): ItemContainer; + /** + * @returns Following {@link ItemContainerSlot} as {@link ItemInstance} object. + */ + asScriptable(): ItemInstance; + /** + * @returns Following {@link ItemContainerSlot} as {@link org.json.JSONObject} instance. + */ + asJson(): org.json.JSONObject; + /** + * @returns Whether the slot is empty or not. + */ + isEmpty(): boolean; + /** + * Refreshes slot in UI. + */ + markDirty(): void; + /** + * Clears slot contents. + */ + clear(): void; + /** + * Resets slot if it's ID or count equals `0`. + */ + validate(): void; + /** + * Drops slot contents in given world at given coords. + */ + dropAt(region: BlockSource, x: number, y: number, z: number): void; + /** + * Sets slot contents. + */ + setSlot(id: number, count: number, data: number): void; + /** + * Sets slot contents. + */ + setSlot(id: number, count: number, data: number, extra: Nullable): void; + /** + * Sets slot contents. + */ + set(id: number, count: number, data: number, extra: Nullable): void; + /** + * @since 2.2.0b82 + */ + resetSavingEnabled(): void; + /** + * @since 2.2.0b82 + */ + setSavingEnabled(enabled: boolean): void; + /** + * @since 2.2.0b82 + */ + isSavingEnabled(): boolean; + /** + * @returns Numeric ID of the item in slot. + */ + getId(): number; + /** + * @returns Count of the item in slot. + */ + getCount(): number; + /** + * @returns Data of the item in slot. + */ + getData(): number; + /** + * @returns Extra data object of the item in slot, + * or `null` if it is not present in the given item. + */ + getExtra(): Nullable; +} diff --git a/core-engine/ItemExtraData.d.ts b/core-engine/ItemExtraData.d.ts index 418c63c99..6bd24a9b8 100644 --- a/core-engine/ItemExtraData.d.ts +++ b/core-engine/ItemExtraData.d.ts @@ -2,8 +2,7 @@ * Class representing item extra data. Used to store additional information * about item other then just item ID and data. */ -declare class ItemExtraData extends com.zhekasmirnov.innercore.api.NativeItemInstanceExtra { - static class: java.lang.Class; +declare class ItemExtraData { /** * Creates an empty {@link ItemExtraData} instance. */ @@ -12,5 +11,180 @@ declare class ItemExtraData extends com.zhekasmirnov.innercore.api.NativeItemIns * Creates a copy of current {@link ItemExtraData} instance with the same contents. */ constructor(extraData?: ItemExtraData); + /** + * Creates an {@link ItemExtraData} Java object instance + * from given native item extra data object pointer, + * represented as 64-bit integer (long). + */ + constructor(pointer: number); + + asJson(): org.json.JSONObject; + /** + * Creates a copy of current {@link ItemExtraData} object. + * @returns A created copy of the data. + */ + copy(): ItemExtraData; + getValue(): number; + /** + * @returns `true`, if item extra exists and is not empty. + */ + isEmpty(): boolean; + applyTo(item: ItemInstance): void; + /** + * @returns `true` if the item is enchanted, `false` otherwise. + */ + isEnchanted(): boolean; + /** + * Adds a new enchantment to the item. + * @param type enchantment ID, one of the {@link EEnchantment} constants + * @param level enchantment level, generally between 1 and 5 + */ + addEnchant(type: number, level: number): void; + /** + * @param type enchantment ID, one of the {@link EEnchantment} constants + * @returns Level of the specified enchantment. + */ + getEnchantLevel(type: number): number; + /** + * Removes enchantments by it's ID. + * @param type enchantment ID, one of the {@link EEnchantment} constants + */ + removeEnchant(type: number): void; + /** + * Removes all the enchantments of the item. + */ + removeAllEnchants(): void; + /** + * @returns Amount of enchantments applied to the item. + */ + getEnchantCount(): number; + /** + * @param id enchantment ID, one of the {@link EEnchantment} constants + * @param level enchantment level, generally between 1 and 5 + * @returns Enchantment name by it's ID and level. + * @since 2.2.1b94 (not worked before) + */ + getEnchantName(id: number, level: number): string; + getRawEnchants(): number[][]; + getEnchants(): { [id: number]: number }; + /** + * @returns All enchantments names separated by line breaks. + */ + getAllEnchantNames(): string; + getAllCustomData(): string; + setAllCustomData(data: string): void; + /** + * @returns Item's custom name. + */ + getCustomName(): string; + /** + * Sets item's custom name. + */ + setCustomName(name: string): void; + /** + * @returns Compound tag for the specified item. + * @since 2.0.5b44 + */ + getCompoundTag(): Nullable; + /** + * Sets compound tag for the specified item. + * @since 2.0.5b44 + */ + setCompoundTag(ent: number, tag: NBT.CompoundTag): void; + /** + * @returns Reference to itself to be used in sequential calls. + */ + putObject(name: string, value: any): ItemExtraData; + /** + * Puts some custom string parameter to the extra data of the item. + * @param name parameter name + * @param value parameter value + * @returns Reference to itself to be used in sequential calls. + */ + putString(name: string, value: string): ItemExtraData; + /** + * Puts some custom integer parameter to the extra data of the item. + * @param name parameter name + * @param int parameter value + * @returns Reference to itself to be used in sequential calls. + */ + putInt(name: string, int: number): ItemExtraData; + /** + * Puts some custom long integer parameter to the extra data of the item. + * @param name parameter name + * @param long parameter value + * @returns Reference to itself to be used in sequential calls. + */ + putLong(name: string, long: number): ItemExtraData; + /** + * Puts some custom floating point number parameter to the extra data of the item. + * @param name parameter name + * @param float parameter value + * @returns Reference to itself to be used in sequential calls. + */ + putFloat(name: string, float: number): ItemExtraData; + /** + * Puts some custom boolean parameter to the extra data of the item. + * @param name parameter name + * @param bool parameter value + * @returns Reference to itself to be used in sequential calls. + */ + putBoolean(name: string, bool: boolean): ItemExtraData; + /** + * @param name parameter name + * @param fallback default value to be returned if item extra data doesn't + * contain a parameter with specified name + * @returns Custom string parameter value if extra data of the item contains + * one, fallback value otherwise. If fallback was not specified, `null` is returned. + */ + getString(name: string, fallback?: string): Nullable; + /** + * @param name parameter name + * @param fallback default value to be returned if item extra data doesn't + * contain a parameter with specified name + * @returns Custom integer parameter value if extra data of the item contains + * one, fallback value otherwise. If fallback was not specified, `null` is returned. + */ + getInt(name: string, fallback?: number): Nullable; + /** + * @param name parameter name + * @param fallback default value to be returned if item extra data doesn't + * contain a parameter with specified name + * @returns Custom long integer parameter value if extra data of the item contains + * one, fallback value otherwise. If fallback was not specified, `null` is returned. + */ + getLong(name: string, fallback?: number): Nullable; + /** + * @param name parameter name + * @param fallback default value to be returned if item extra data doesn't + * contain a parameter with specified name + * @returns Custom float parameter value if extra data of the item contains + * one, fallback value otherwise. If fallback was not specified, `null` is returned. + */ + getFloat(name: string, fallback?: number): Nullable; + /** + * @param name parameter name + * @param fallback default value to be returned if item extra data doesn't + * contain a parameter with specified name + * @returns Custom boolean parameter value if extra data of the item contains + * one, fallback value otherwise. If fallback was not specified, `null` is returned. + */ + getBoolean(name: string, fallback?: boolean): Nullable; + /** + * @returns Reference to itself to be used in sequential calls. + */ + putSerializable(name: string, serializableObject: any): ItemExtraData; + getSerializable(name: string): any; + /** + * Removes all custom parameters from item extra data. + */ + removeCustomData(): void; + isFinalizableInstance(): boolean; + static unwrapObject(extra: any): Nullable; + static unwrapValue(extra: any): number; + static getValueOrNullPtr(extra: ItemExtraData): number; + static getExtraOrNull(pointer: number): Nullable; + static cloneExtra(extra: Nullable): Nullable; + static fromJson(json: org.json.JSONObject): Nullable; } diff --git a/core-engine/ItemModel.d.ts b/core-engine/ItemModel.d.ts index 2f675bfd5..fde639b96 100644 --- a/core-engine/ItemModel.d.ts +++ b/core-engine/ItemModel.d.ts @@ -271,7 +271,7 @@ declare interface ItemModel { getCacheKey(): string; - updateForBlockVariant(variant: com.zhekasmirnov.innercore.api.unlimited.BlockVariant): void; + updateForBlockVariant(variant: any): void; getItemRenderMesh(count: number, randomize: boolean): RenderMesh; diff --git a/core-engine/Recipes.d.ts b/core-engine/Recipes.d.ts index 4f0e775dc..5aacace1f 100644 --- a/core-engine/Recipes.d.ts +++ b/core-engine/Recipes.d.ts @@ -226,7 +226,7 @@ declare namespace Recipes { /** * Constructs a new Workbench UI handler. - * @param target target {@link com.zhekasmirnov.innercore.api.mod.ui.window.WindowContent.elements WindowContent.elements} section + * @param target target {@link UI.WindowContent.elements} section * @param targetCon target container * @param field workbench field */ @@ -457,7 +457,7 @@ declare namespace Recipes { * @param result recipe result item instance */ interface CraftingFunction { - (api: WorkbenchFieldAPI, field: com.zhekasmirnov.innercore.api.mod.ui.container.Slot[], result: ItemInstance, player: number): void + (api: WorkbenchFieldAPI, field: UI.Slot[], result: ItemInstance, player: number): void } /** @@ -468,17 +468,17 @@ declare namespace Recipes { * @param slot slot index * @returns Workbench slot instance by slot index. */ - getFieldSlot(slot: number): com.zhekasmirnov.innercore.api.mod.ui.container.AbstractSlot; + getFieldSlot(slot: number): UI.AbstractSlot; /** * @since 2.2.1b108 */ - getFieldSlot(x: number, y: number): com.zhekasmirnov.innercore.api.mod.ui.container.AbstractSlot; + getFieldSlot(x: number, y: number): UI.AbstractSlot; /** * @returns JS array of all slots. */ - asScriptableField(): com.zhekasmirnov.innercore.api.mod.ui.container.Slot[]; + asScriptableField(): UI.AbstractSlot[]; /** * @since 2.2.1b106 @@ -495,7 +495,7 @@ declare namespace Recipes { * @param slot slot index * @returns Workbench slot instance by slot index. */ - getFieldSlot(slot: number): com.zhekasmirnov.innercore.api.mod.ui.container.Slot; + getFieldSlot(slot: number): UI.Slot; /** * Decreases item count in the specified slot, if possible. @@ -522,20 +522,26 @@ declare namespace Recipes { /** * Crafting recipe entry. */ - interface RecipeEntry extends java.lang.Object { + interface RecipeEntry { + readonly data: number; + readonly id: number; + + getMask(): string; + getCodeByItem(id: number, data: number): number; + getCode(): number; /** * @param slot slot to compare with * @returns `true` if recipe entry matches the slot. */ - isMatching(slot: com.zhekasmirnov.innercore.api.mod.ui.container.Slot): boolean; + isMatching(slot: UI.AbstractSlot): boolean; /** * @param slot slot to compare with * @returns `true` if recipe entry matches the slot. * @since 2.2.1b108 */ - isMatching(slot: Nullable): boolean; + isMatching(slot: Nullable): boolean; /** * @param entry entry to compare with @@ -545,4 +551,3 @@ declare namespace Recipes { } } - diff --git a/core-engine/Render.d.ts b/core-engine/Render.d.ts index ec444f7b8..c2e63eaea 100644 --- a/core-engine/Render.d.ts +++ b/core-engine/Render.d.ts @@ -2,12 +2,15 @@ * Class that is used to give mobs, animations and blocks custom shape. */ declare class Render { - isEmpty: boolean; - isChangeable: boolean; - renderer: Nullable; - model: Nullable; - parts: { [key: string]: Render.ModelPart }; - renderId: number; + readonly isEmpty: boolean; + readonly isChangeable: boolean; + readonly renderer: Nullable; + readonly model: Nullable; + /** + * @internal + */ + readonly parts: { [key: string]: Render.ModelPart }; + readonly renderId: number; /** * Creates a new Render instance with specified parameters. @@ -18,18 +21,18 @@ declare class Render { constructor(parameters?: Render.RenderParameters | string | number); /** - * @deprecated Use {@link Render.getId getId} instead. + * @returns Render identifier that can be used to set render to the mob, + * animation or block. */ getID(): number; - /** - * @deprecated Use {@link Render.getId getId} instead. + * @returns Render identifier that can be used to set render to the mob, + * animation or block. */ getRenderType(): number; - /** - * @returns Render identifier that can be used to set render to the mob, animation - * or block. + * @returns Render identifier that can be used to set render to the mob, + * animation or block. */ getId(): number; @@ -93,13 +96,31 @@ declare class Render { * @internal */ _setPartRecursive(part: Render.ModelPart, data: Render.PartElement[], coords: Vector): void; + + /** + * @deprecated Unavailable feature, renderers must be saved independently. + */ fromCache(data: Render.Cache): void; + /** + * @deprecated Unavailable feature, renderers must be saved independently. + */ toCache(): Render.Cache; + /** + * @deprecated Unavailable feature, renderers must be saved independently. + */ saveState(name: string, isLocal: boolean): void; + /** + * @deprecated Unavailable feature, renderers must be saved independently. + */ loadState(name: string, isLocal: boolean): void; + /** + * @deprecated Unavailable feature, renderers must be saved independently. + */ loadInitialState(name: string): void; + /** + * @deprecated Unavailable feature, renderers must be saved independently. + */ saveToNext(name: string, isLocal: boolean): void; - /** * @deprecated Does nothing, not required anymore. */ @@ -117,6 +138,7 @@ declare namespace Render { interface RenderParameters { /** * Name of the cached Render object to be used. + * @deprecated Unavailable feature, renderers must be saved independently. */ name?: string; /** @@ -163,17 +185,64 @@ declare namespace Render { children?: PartElement[] } + /** + * @deprecated Unavailable feature, renderers must be saved independently. + */ + interface Cache { + renderer: Nullable, + renderId: number, + model: Nullable, + isChangeable: boolean, + parts: { [key: string]: ModelPart } + } + /** * Interface used to perform transformation on the specified render object. */ - interface Transform extends com.zhekasmirnov.innercore.api.NativeRenderer.Transform { + interface Transform { + /** + * Clears all the transformations applied to the render. + * @returns Reference to itself to be used in sequential calls. + */ + clear(): Transform; + /** + * @returns Reference to itself to be used in sequential calls. + */ + lock(): Transform; + /** + * Performs arbitrary matrix transformations on the render. + * @returns Reference to itself to be used in sequential calls. + */ + matrix(m00: number, m01: number, m02: number, m03: number, + m10: number, m11: number, m12: number, m13: number, + m20: number, m21: number, m22: number, m23: number, + m30: number, m31: number, m32: number, m33: number): Transform; + /** + * Rotates render along three axes. + * @returns Reference to itself to be used in sequential calls. + */ + rotate(rotX: number, rotY: number, rotZ: number): Transform; + /** + * Scales render along the three axes. + * @returns Reference to itself to be used in sequential calls. + */ + scale(scaleX: number, scaleY: number, scaleZ: number): Transform; /** * Scales the render along all the three axes. Applicable only to the * {@link Animation}'s transformations. * @returns Reference to itself to be used in sequential calls. - * @deprecated Consider using {@link Render.Transform.scale Transform.scale} instead. + * @deprecated Consider using {@link Render.Transform.scale} instead. */ scaleLegacy(scale: number): Transform; + /** + * Translates render along three axes. + * @returns Reference to itself to be used in sequential calls. + */ + translate(x: number, y: number, z: number): Transform; + /** + * @returns Reference to itself to be used in sequential calls. + */ + unlock(): Transform; } /** @@ -213,15 +282,123 @@ declare namespace Render { rotation?: Vector | [number, number, number]; } - interface Model extends com.zhekasmirnov.innercore.api.NativeRenderer.Model {} - interface ModelPart extends com.zhekasmirnov.innercore.api.NativeRenderer.ModelPart {} - interface Renderer extends com.zhekasmirnov.innercore.api.NativeRenderer.Renderer {} + interface Model { + /** + * Clears all parts of the model. + */ + clearAllParts(): void; + /** + * @param partName part name + * @returns Part by it's name or null if part doesn't exist. + */ + getPart(partName: string): Nullable; + /** + * @param partName part name + * @returns `true` if part with specified name exists in the model, + * `false` otherwise. + */ + hasPart(partName: string): boolean; + /** + * Resets the model + */ + reset(): void; + } - interface Cache { - renderer: Nullable, - renderId: number, - model: Nullable, - isChangeable: boolean, - parts: { [key: string]: ModelPart } + interface ModelPart { + /** + * Adds a new box to the part on the specified coordinates (relative to + * the part's coordinates) of the specified size (width, height, length). + */ + addBox(x: number, y: number, z: number, w: number, h: number, l: number): void; + /** + * Adds a new box to the part on the specified coordinates (relative to + * the part's coordinates) of the specified size (width, height, length). + * @param add additional size to be added from all the six sizes of the + * box + */ + addBox(x: number, y: number, z: number, w: number, h: number, l: number, add: number): void; + /** + * Creates a new part with specified name. If a part with specified name + * already exists, returns the existing part. + * @param name name of the part to create or return + */ + addPart(name: string): ModelPart; + /** + * Clears the contents of the part. + */ + clear(): void; + /** + * @returns Mesh specified via {@link Render.ModelPart.setMesh} call or `null`, + * if this part doesn't contain mesh. + */ + getMesh(): Nullable; + /** + * Specifies {@link RenderMesh} to be used as a part. + */ + setMesh(mesh: Nullable): void; + /** + * Specifies part default offset. + */ + setOffset(offsetX: number, offsetY: number, offsetZ: number): void; + /** + * Specifies part rotation. + */ + setRotation(rotationX: number, rotationY: number, rotationZ: number): void; + /** + * Specifies texture UV offset. + */ + setTextureOffset(u: number, v: number): void; + /** + * Specifies texture UV offset. + */ + setTextureOffset(u: number, v: number): void; + /** + * Specifies texture UV offset. + * @param placeholder deprecated boolean parameter + * @deprecated Use same method without last parameter. + */ + setTextureOffset(u: number, v: number, placeholder: boolean): void; + /** + * Specifies texture size size, use the real texture file size or change + * it to stretch texture. + */ + setTextureSize(w: number, h: number): void; + /** + * Specifies texture size size, use the real texture file size or change + * it to stretch texture. + */ + setTextureSize(w: number, h: number): void; + /** + * Specifies texture size size, use the real texture file size or change + * it to stretch texture. + * @param placeholder deprecated boolean parameter + * @deprecated Use same method without last parameter. + */ + setTextureSize(w: number, h: number, placeholder: boolean): void; + } + + interface FinalizeCallback { + onFinalized(renderer: Renderer): void; + } + interface FinalizeCallbackJS { + (renderer: Renderer): void; + } + + interface Renderer { + isHumanoid: boolean; + transform: Transform; + addFinalizeCallback(callback: FinalizeCallback | FinalizeCallbackJS): void; + getModel(): Model; + getPointer(): number; + getRenderType(): number; + getScale(): number; + release(): void; + setFinalizeable(finalizeable: boolean): void; + setScale(scale: number): void; + setSkin(skin: string): void; + } + + namespace Renderer { + type Transform = Render.Transform; } } diff --git a/core-engine/RenderMesh.d.ts b/core-engine/RenderMesh.d.ts index 770e83f94..2b04f0f22 100644 --- a/core-engine/RenderMesh.d.ts +++ b/core-engine/RenderMesh.d.ts @@ -3,19 +3,229 @@ * display them correctly. Used as block, entity and item models, in animations * and actually anywhere you need some physical shape. */ -declare class RenderMesh extends com.zhekasmirnov.innercore.api.NativeRenderMesh { +declare class RenderMesh { /** * Creates a new {@link RenderMesh} and initializes it from file. - * See {@link com.zhekasmirnov.innercore.api.NativeRenderMesh.importFromFile importFromFile} - * method description for parameters details. + * See {@link RenderMesh.importFromFile} method description for + * parameters details. */ constructor(path: string, type: string, params: Nullable); /** * Creates a new empty {@link RenderMesh}. */ constructor(); + + /** + * Adds new mesh to the current one on the specified coordinates. + * @param mesh {@link RenderMesh} object to be added to current mesh + * @since 2.0.2b23 + */ + addMesh(mesh: RenderMesh): void; + /** + * Adds new mesh to the current one on the specified coordinates + * with specified offset. + * @param mesh {@link RenderMesh} object to be added to current mesh + * @since 2.0.2b23 + */ + addMesh(mesh: RenderMesh, addX: number, addY: number, addZ: number): void; + /** + * Adds new mesh to the current one on the specified coordinates + * with specified offset and scale. + * @param mesh {@link RenderMesh} object to be added to current mesh + * @since 2.0.2b23 + */ + addMesh(mesh: RenderMesh, addX: number, addY: number, addZ: number, scaleX: number, scaleY: number, scaleZ: number): void; + /** + * Adds a new vertex on the specified coordinates. + */ + addVertex(x: number, y: number, z: number): void; + /** + * Adds a new vertex on the specified coordinates. + * @param u x texture offset of the vertex + * @param v y texture offset of the vertex + */ + addVertex(x: number, y: number, z: number, u: number, v: number): void; + /** + * Removes all vertices of the mesh. + */ + clear(): void; + /** + * Creates a copy of current {@link RenderMesh}. + * @since 2.0.2b26 + */ + clone(): RenderMesh; + /** + * Scales the mesh to fit into the specified box. + * @since 2.0.2b26 + */ + fitIn(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number): void; + /** + * Scales the mesh to fit into the specified box. + * @param keepRatio if `true`, the ratio of the dimensions are preserved + * @since 2.0.2b26 + */ + fitIn(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, keepRatio: boolean): void; + /** + * @returns Pointer to the native object instance of the + * following {@link RenderMesh}, represented as long number. + */ + getPtr(): number; + getReadOnlyVertexData(): RenderMesh.ReadOnlyVertexData; + /** + * Imports mesh file using specified path. + * @param path path to the mesh file. Path should be absolute path or + * be relative to the resources folder or to the "models/" folder + * @param type file type to read mesh from. The only currently supported mesh file + * type is "obj" + * @param importParams additional import parameters or null, if not needed + */ + importFromFile(path: string, type: "obj", importParams: Nullable): void; + invalidate(): void; + newGuiRenderMesh(): RenderMesh.GuiRenderMesh; + /** + * Forces Minecraft to rebuild specified {@link RenderMesh} object. + */ + rebuild(): void; + /** + * Resets color applied to the mesh. + * @default 0xfff // white + */ + resetColor(): void; + /** + * Resets texture of the mesh. + */ + resetTexture(): void; + /** + * Rotates the mesh around the specified coordinates. + * @param rotX rotation angle along X axis, in radians + * @param rotY rotation angle along Y axis, in radians + * @param rotZ rotation angle along Z axis, in radians + * @since 2.0.2b26 + */ + rotate(x: number, y: number, z: number, rotX: number, rotY: number, rotZ: number): void; + /** + * Rotates the mesh around the (0, 0, 0) coordinates. + * @param rotX rotation angle along X axis, in radians + * @param rotY rotation angle along Y axis, in radians + * @param rotZ rotation angle along Z axis, in radians + */ + rotate(rotX: number, rotY: number, rotZ: number): void; + /** + * Scales the whole mesh along the three axis. + */ + scale(x: number, y: number, z: number): void; + /** + * Specifies block texture to be used by mesh. + */ + setBlockTexture(textureName: string, textureMeta: number): void; + /** + * Specifies color to be applied to the next vertices. If the color is not white and + * the texture is applied to mesh, texture's colors will be affected. + */ + setColor(r: number, g: number, b: number): void; + /** + * Specifies color to be applied to the next vertices. If the color is not white and + * the texture is applied to mesh, texture's colors will be affected. + */ + setColor(r: number, g: number, b: number, a: number): void; + /** + * Makes specified {@link RenderMesh} foliage tinted. + * @since 2.0.2b24 + */ + setFoliageTinted(): void; + /** + * Makes specified {@link RenderMesh} foliage tinted. + * @since 2.0.2b25 + */ + setFoliageTinted(leavesType: number): void; + /** + * Makes specified {@link RenderMesh} grass tinted. + * @since 2.0.2b24 + */ + setGrassTinted(): void; + /** + * Sets following {@link RenderMesh} light direction. + */ + setLightDir(x: number, y: number, z: number): void; + setLightIgnore(ignore: boolean, bool2: boolean): void; + setLightParams(float1: number, float2: number, float3: number): void; + /** + * Sets following {@link RenderMesh} light position. + * @since 2.0.2b25 + */ + setLightPos(x: number, y: number, z: number): void; + /** + * Removes any tint from specified {@link RenderMesh}. + * @since 2.0.2b24 + */ + setNoTint(): void; + /** + * Specifies the normal vector for the next vertices. + */ + setNormal(x: number, y: number, z: number): void; + /** + * Makes specified {@link RenderMesh} water tinted. + * @since 2.0.2b24 + */ + setWaterTinted(): void; + /** + * Translates the whole mesh along three axis. + */ + translate(x: number, y: number, z: number): void; } declare namespace RenderMesh { - type ImportParams = com.zhekasmirnov.innercore.api.NativeRenderMesh.ImportParams; + interface ReadOnlyVertexData { + readonly colors: native.Array; + readonly dataSize: number; + readonly indices: native.Array; + readonly uvs: native.Array; + readonly vertices: native.Array; + } + + /** + * Object used in {@link RenderMesh.importFromFile} and + * one of {@link RenderMesh} constructors. Here you can put + * some additional parameters, that will be applied to the mesh, + * when the file is being imported. + */ + interface ImportParams { + /** + * If `true`, all existing vertices of the mesh are deleted + * before the file is imported. + */ + clear?: boolean, + /** + * If `true`, vertex of the texture is inverted. + */ + invertV?: boolean, + /** + * Additional translation along x, y and z axis. + */ + translate?: [number, number, number], + /** + * Additional scale along x, y and z axis. + */ + scale?: [number, number, number], + /** + * If `true`, Minecraft won't be forced to rebuild the following + * {@link RenderMesh} before the file is imported. + */ + noRebuild?: boolean + } + + interface GuiRenderMesh { + rx: number; + ry: number; + rz: number; + x: number; + y: number; + z: number; + draw(gl: javax.microedition.khronos.opengles.GL10): void; + setVertices(vertices: number[]): void; + setIndices(indices: number[]): void; + setTextureCoordinates(textureCoords: number[]): void; + setColors(colors: number[]): void; + loadBitmap(bitmap: android.graphics.Bitmap): void; + } } diff --git a/core-engine/TagRegistry.d.ts b/core-engine/TagRegistry.d.ts index 10c9e0c48..72a7ad62d 100644 --- a/core-engine/TagRegistry.d.ts +++ b/core-engine/TagRegistry.d.ts @@ -62,13 +62,13 @@ * ``` */ declare namespace TagRegistry { - interface GenericTagGroup { + interface TagGroup { readonly name: string; /** * Tag factory determines additional tags, which should * be added for specific object in group. */ - addTagFactory(factory: GenericTagFactory): void; + addTagFactory(factory: TagFactory): void; /** * Appends object to group to use in iterator and * filtering functions like {@link TagGroup.getAllWhere}, etc. @@ -110,7 +110,7 @@ declare namespace TagRegistry { * {@link TagGroup.addCommonObject} and collects objects * matched predicate to list. */ - getAllWhere(predicate: GenericTagPredicate): java.util.List; + getAllWhere(predicate: TagPredicate): java.util.List; /** * Fetches objects which have all of presented tags. */ @@ -121,9 +121,6 @@ declare namespace TagRegistry { getAllWithTag(tag: string): java.util.List; } - interface TagGroup extends GenericTagGroup { - } - /** * Gets or creates a new tag group to append tags * for any objects. @@ -134,9 +131,9 @@ declare namespace TagRegistry { * Gets or creates a new tag group to append tags * for any objects with generic type. */ - function getOrCreateGroup(name: string): GenericTagGroup; + function getOrCreateGroup(name: string): TagGroup; - interface GenericTagFactory { + interface TagFactory { /** * @param obj object from group * @param tags changeable tags collection @@ -144,14 +141,35 @@ declare namespace TagRegistry { (obj: T, tags: java.util.Collection): void; } - interface TagFactory extends GenericTagFactory { - } - /** * Tag factory determines additional tags, which should * be added for specific object in group. */ function addTagFactory(group: string, factory: TagFactory): void; + + interface TagPredicate { + /** + * @param obj object from group + * @param tags collection with all tags + */ + (obj: T, tags: java.util.Collection): boolean; + } + + /** + * Iterates over existing common objects in group added via + * {@link TagGroup.addCommonObject} and collects objects + * matched predicate to list. + */ + function getAllWith(group: string, predicate: TagPredicate): any[]; + /** + * Fetches objects in group which have all of presented tags. + */ + function getAllWithTags(group: string, tags: string[]): any[]; + /** + * Fetches objects in group which has presented tag. + */ + function getAllWithTag(group: string, tag: string): any[]; + /** * Appends object to group to use in iterator and * filtering functions like {@link TagRegistry.getAllWith}, etc. @@ -187,30 +205,4 @@ declare namespace TagRegistry { * property, tags added from {@link TagRegistry.addTagFactory}. */ function getTagsFor(group: string, obj: any): string[]; - - interface GenericTagPredicate { - /** - * @param obj object from group - * @param tags collection with all tags - */ - (obj: T, tags: java.util.Collection): boolean; - } - - interface TagPredicate extends GenericTagPredicate { - } - - /** - * Iterates over existing common objects in group added via - * {@link TagGroup.addCommonObject} and collects objects - * matched predicate to list. - */ - function getAllWith(group: string, predicate: TagPredicate): any[]; - /** - * Fetches objects in group which have all of presented tags. - */ - function getAllWithTags(group: string, tags: string[]): any[]; - /** - * Fetches objects in group which has presented tag. - */ - function getAllWithTag(group: string, tag: string): any[]; } diff --git a/core-engine/UI.AdaptiveWindow.d.ts b/core-engine/UI.AdaptiveWindow.d.ts new file mode 100644 index 000000000..6c97491ae --- /dev/null +++ b/core-engine/UI.AdaptiveWindow.d.ts @@ -0,0 +1,26 @@ +declare namespace UI { + class AdaptiveWindow extends WindowGroup { + /** + * Constructs new {@link UI.AdaptiveWindow} with specified content. + * @param content object containing window description + */ + constructor(content: WindowContent); + /** + * Constructs a new empty {@link UI.AdaptiveWindow}. + */ + constructor(); + setContent(content: WindowContent): void; + /** + * Sets style profile for the current {@link UI.AdaptiveWindow}. + * @param profile 0 for classic profile, 1 for default profile + */ + setProfile(profile: 0 | 1): void; + /** + * Forces {@link UI.AdaptiveWindow} to be displayed using some profile. + * @param profile 0 for classic profile, 1 for default profile or -1 not + * to force any profile. By default forced profile is -1 + */ + setForcedProfile(profile: 0 | 1): void; + open(): void; + } +} diff --git a/core-engine/UI.Container.d.ts b/core-engine/UI.Container.d.ts new file mode 100644 index 000000000..02ce4bc29 --- /dev/null +++ b/core-engine/UI.Container.d.ts @@ -0,0 +1,349 @@ +declare namespace UI { + interface AbstractSlot { + getId(): number; getCount(): number; getData(): number; + getExtra(): Nullable; + set(id: number, count: number, data: number, extra: Nullable): void; + validate(): void; + } + + class Slot implements AbstractSlot { + id: number; + count: number; + data: number; + extra: Nullable; + getClassName(): "slot"; + constructor(id: number, count: number, data: number); + constructor(id: number, count: number, data: number, extra: Nullable); + constructor(parent: ItemInstance); + constructor(); + set(id: number, count: number, data: number): void; + set(id: number, count: number, data: number, extra: Nullable): void; + put(name: string, prop: any): void; + getInt(name: string): number; + validate(): void; + /** + * @deprecated Client only, use {@link BlockSource.spawnDroppedItem} instead. + */ + drop(x: number, y: number, z: number): void; + getTarget(): ItemInstance; + getId(): number; getCount(): number; getData(): number; + getExtraValue(): number; + getExtra(): Nullable; + save(): Slot; + } + + interface UiVisualSlotImpl { + getId(): number; + getCount(): number; + getData(): number; + getExtra(): Nullable; + } + + interface UiAbstractContainer { + addElementInstance(element: IElement, name: string): void; + close(): void; + getBinding(element: string, bindingName: string): Nullable; + getElement(elementName: string): Nullable; + getParent(): any; + getSlotVisualImpl(slotName: string): UiVisualSlotImpl; + handleBindingDirty(element: string, bindingName: string): void; + handleInventoryToSlotTransaction(inventorySlot: number, slot: string, amount: number): void; + handleSlotToInventoryTransaction(slot: string, amount: number): void; + handleSlotToSlotTransaction(slot1: string, slot2: string, amount: number): void; + onWindowClosed(): void; + openAs(window: IWindow): void; + setBinding(element: string, bindingName: string, obj: T): void; + } + + interface OnOpenCloseListener { + /** + * @param container {@link UI.Container} the window was opened in + * @param window an instance of {@link UI.IWindow} that was opened + */ + (container: Container, window: IWindow): void; + } + + type OnOpenCloseListenerJS = OnOpenCloseListener; + + /** + * Containers are used to properly manipulate windows and save slots + * contents and windows state between window opens. Every {@link TileEntity} has + * a built-in container that can be accessed as {@link TileEntity.container}. + * + * @remarks + * This is a legacy container that does not synchronize between clients and server. + * It should be used to store data on one side either server or client. + */ + class Container implements UiAbstractContainer, Recipes.WorkbenchField { + static readonly isContainer: boolean; + /** + * If container is a part of {@link TileEntity}, this field stores reference + * to it, otherwise null. You can also assign any value of any type to + * it using {@link UI.Container.setParent} method or using constructor + * parameter. Consider using {@link UI.Container.getParent} instead of direct + * field access. + */ + parent: Nullable | any; + slots: { + [slotName: string]: Slot + }; + /** + * Same as {@link UI.Container.parent}. + */ + tileEntity: Nullable | any; + /** + * Creates a new instance of {@link UI.Container}. + */ + constructor(); + /** + * Creates a new instance of {@link UI.Container} and initializes it's parent. + * + * See {@link UI.Container.setParent} for details. + */ + constructor(parent: Nullable | any); + /** + * Sets container's parent object, for {@link TileEntity}'s container it + * should be a {@link TileEntity} reference, otherwise you can pass any + * value to be used in your code later. + * @param parent an object to be set as container's parent + */ + setParent(parent: Nullable | any): void; + /** + * Getter for {@link UI.Container.parent} field. + */ + getParent(): Nullable | any; + /** + * Gets the slot by it's name. If a slot with specified name doesn't + * exists, creates an empty one with specified name. + * @param name slot name + * @returns Contents of the slot in a {@link UI.Slot} object. + * You can modify it to change the contents of the slot. + */ + getSlot(name: string): Slot; + /** + * Gets the slot by it's name. If a slot with specified name doesn't + * exists, creates an empty one with specified name. + * @param name slot name + * @returns Contents of the slot in a FullSlot object containing + * more useful methods for slot manipulation. + */ + getFullSlot(name: string): Slot; + getSlotVisualImpl(name: string): UiVisualSlotImpl; + handleInventoryToSlotTransaction(invSlot: number, slotName: string, amount: number): void; + handleSlotToSlotTransaction(from: string, to: string, amount: number): void; + handleSlotToInventoryTransaction(slotName: string, amount: number): void; + /** + * Set slot's content by it's name. If a slot with specified name doesn't + * exists, creates an empty one with specified name and item. + * @param name slot name + */ + setSlot(name: string, id: number, count: number, data: number): void; + /** + * Set slot's content by it's name. If a slot with specified name doesn't + * exists, creates new with specified name and item. + * @param name slot name + * @param extra item extra value; note that it should be an instance of + * {@link ItemExtraData} and not it's numeric ID + */ + setSlot(name: string, id: number, count: number, data: number, extra: Nullable): void; + /** + * Validates slot contents. If the data value is less then `0`, it becomes + * `0`, if ID is `0` or count is less then or equals to zero, slot is reset + * to an empty one. + * @param name slot name + */ + validateSlot(name: string): void; + /** + * Clears slot's contents. + * @param name slot name + */ + clearSlot(name: string): void; + /** + * Drops slot's contents on the specified coordinates + * and clears the slot. + * @param name slot name + * @deprecated Client only, use {@link BlockSource.spawnDroppedItem} instead. + */ + dropSlot(name: string, x: number, y: number, z: number): void; + /** + * Drops the contents of all the slots in the container on the specified + * coordinates and clears them. + * @deprecated Client only, use {@link BlockSource.spawnDroppedItem} instead. + */ + dropAt(x: number, y: number, z: number): void; + /** + * Validates all the slots in the container. + */ + validateAll(): void; + /** + * @returns Currently opened {@link UI.IWindow} + * or `null` if no window is currently opened in the container. + */ + getWindow(): IWindow; + _addElement(element: IElement, name: string): void; + addElementInstance(element: IElement, name: string): void; + _removeElement(name: string): void; + /** + * Opens {@link UI.IWindow} object in the container. + * @param win {@link UI.IWindow} object to be opened + */ + openAs(win: IWindow): void; + /** + * Closes currently opened window. + */ + close(): void; + /** + * Sets an object to be notified when the window is opened. + * @param listener object to be notified when the window is opened + * @since 2.0.4b43 + */ + setOnOpenListener(listener: OnOpenCloseListener): void; + /** + * Sets an object to be notified when the window is closed. + * @param listener object to be notified when the window is closed + */ + setOnCloseListener(listener: OnOpenCloseListener): void; + onWindowClosed(): void; + /** + * @returns `true`, if some window is opened in the container. + */ + isOpened(): boolean; + /** + * Same as {@link getWindow}. + */ + getGuiScreen(): IWindow; + /** + * @returns Window's content object (usually specified in the window's + * constructor) if a window was opened in the container, `null` otherwise. + */ + getGuiContent(): Nullable; + /** + * @returns Window's element by it's name. + * @param name element name + */ + getElement(name: string): Nullable; + /** + * Passes any value to the element. + * @param elementName element name + * @param bindingName binding name, you can access the value from the + * element by this name + * @param val value to be passed to the element + */ + setBinding(elementName: string, bindingName: string, val: any): void; + /** + * Gets any value from the element. + * @param elementName element name + * @param bindingName binding name, you can access the value from the + * element by this name. Some binding names are reserved for additional + * element information, e.g. "element_obj" contains pointer to the + * current object and "element_rect" contains android.graphics.Rect + * object containing drawing rectangle + * @returns Value that was get from the element or `null` if the + * element doesn't exist. + */ + getBinding(elementName: string, bindingName: string): Nullable; + handleBindingDirty(): void; + sendChanges(): void; + /** + * Sets "value" binding value for the element. Used to set scales values. + * @param name element name + * @param value value to be set for the element + */ + setScale(name: string, value: number): void; + /** + * @param name element name + * @returns Value "value" binding, e.g. scale value, or `null` if no + * element with specified name exist. + */ + getValue(name: string): Nullable; + /** + * Sets "text" binding value for the element. Used to set element's text. + * @param name element name + * @param value value to be set for the element + */ + setText(name: string, value: string | number): void; + /** + * + * @param name element name + * @returns Value "text" binding, usually the text displayed on the + * element, or `null` if no element with specified name exist. + */ + getText(name: string): Nullable; + /** + * @param name element name + * @returns `true` if the element is currently hovered. + */ + isElementTouched(name: string): boolean; + /** + * Forces ui elements of the window to refresh. + * @param onCurrentThread if `true`, the drawables will be refreshed + * immediately, otherwise refresh event will be posted; ensure you are + * in the UI thread if you pass `true` as the parameter + * @default onCurrentThread: false + */ + invalidateUIElements(onCurrentThread: boolean): void; + /** + * Forces ui elements of the window to refresh. + */ + invalidateUIElements(): void; + /** + * Forces ui drawables of the window to refresh. + * @param onCurrentThread if `true`, the drawables will be refreshed + * immediately, otherwise refresh event will be posted; ensure you are + * in the UI thread if you pass `true` as the parameter + * @default onCurrentThread: false + */ + invalidateUIDrawing(onCurrentThread: boolean): void; + invalidateUIDrawing(): void; + /** + * Forces ui elements and drawables of the window to refresh. + * @param onCurrentThread if `true`, the drawables will be refreshed + * immediately, otherwise refresh event will be posted; ensure you are + * in the UI thread if you pass `true` as the parameter + * @default onCurrentThread: false + */ + invalidateUI(onCurrentThread: boolean): void; + /** + * Forces ui elements and drawables of the window to refresh. + */ + invalidateUI(): void; + /** + * @deprecated Backwards compatibility. + */ + refreshSlots(): void; + /** + * @deprecated Backwards compatibility. + */ + applyChanges(): void; + /** + * @returns `false` if container supports multiplayer, `true` otherwise. + */ + isLegacyContainer(): boolean; + + /** + * If the container is a custom workbench, you can set the slot prefix + * via this method call. {@link UI.Container.getFieldSlot} + * will get field slot by `prefix + slot` name. + * @param wbsnp custom workbench slot prefix + */ + setWbSlotNamePrefix(wbsnp: string): void; + /** + * @param slot slot index + * @returns Workbench slot instance by slot index. + */ + getFieldSlot(slot: number): Slot; + /** + * @since 2.2.1b108 + */ + getFieldSlot(x: number, y: number): AbstractSlot; + /** + * @returns JS array of all slots. + */ + asScriptableField(): Slot[]; + /** + * @returns `9` + * @since 2.2.1b106 + */ + getWorkbenchFieldSize(): number; + } +} diff --git a/core-engine/UI.Drawing.d.ts b/core-engine/UI.Drawing.d.ts new file mode 100644 index 000000000..1e4f7fe8e --- /dev/null +++ b/core-engine/UI.Drawing.d.ts @@ -0,0 +1,92 @@ +declare namespace UI { + interface IDrawing { + onDraw(canvas: android.graphics.Canvas, scale: number): void; + onSetup(scriptable: object, style: Style): void; + } + + interface ColorDrawing { + type: "background", + color?: number, + mode?: number, + colorMode?: number; + } + + interface DrawColor extends IDrawing { + onSetup(scriptable: ColorDrawing, style: Style): void; + } + + interface CustomDrawing { + type: "custom", + onDraw?: (canvas: android.graphics.Canvas, scale: number) => void; + } + + interface DrawCustom extends IDrawing { + onSetup(scriptable: CustomDrawing, style: Style): void; + } + + interface FrameDrawing { + type: "frame", + bitmap?: string, + sides?: boolean[], + x?: number, + y?: number, + scale?: number, + width?: number, height?: number, + color?: number, + bg?: number; + } + + interface DrawFrame extends IDrawing { + onSetup(scriptable: FrameDrawing, style: Style): void; + } + + interface ImageDrawing { + type: "bitmap", + x?: number, + y?: number, + width?: number, + height?: number, + scale?: number, + bitmap?: string; + } + + interface DrawImage extends IDrawing { + onSetup(scriptable: ImageDrawing, style: Style): void; + } + + interface LineDrawing { + type: "line", + x1?: number, + y1?: number, + x2?: number, + y2?: number, + color?: number, + width?: number; + } + + interface DrawLine extends IDrawing { + onSetup(scriptable: LineDrawing, style: Style): void; + } + + interface TextDrawing { + type: "text", + x?: number, + y?: number, + text?: string, + font?: FontDescription; + } + + interface DrawText extends IDrawing { + onSetup(scriptable: TextDrawing, style: Style): void; + } + + type DrawingElements = ( + ColorDrawing + | CustomDrawing + | FrameDrawing + | ImageDrawing + | LineDrawing + | TextDrawing + ); + type DrawingSet = DrawingElements[]; +} diff --git a/core-engine/UI.Element.d.ts b/core-engine/UI.Element.d.ts new file mode 100644 index 000000000..0d3552e86 --- /dev/null +++ b/core-engine/UI.Element.d.ts @@ -0,0 +1,488 @@ +declare namespace UI { + /** + * Types that can be used to create element texture. + * For static textures it can be string path to texture in assets directory, or {@link android.graphics.Bitmap} instance. + * For animated textures it can be array of string paths to texture in assets directory, or an array of {@link android.graphics.Bitmap} instances. + * Each element in the array represents one of animation frames. + */ + type BitmapTypes = string | string[] | android.graphics.Bitmap | android.graphics.Bitmap[]; + + type TouchEventType = "DOWN" | "UP" | "MOVE" | "CLICK" | "LONG_CLICK" | "CANCEL"; + + interface ITouchEvent { + _x: number; + _y: number; + downX: number; + downY: number; + localX: number; + localY: number; + type: TouchEventType; + x: number; + y: number; + hasMovedSinceLastDown(): boolean; + update(event: android.view.MotionEvent): void; + preparePosition(win: Window, rect: android.graphics.Rect): void; + posAsScriptable(): { x: number, y: number }; + localPosAsScriptable(): { x: number, y: number }; + } + + interface IElementCleaner { + element: IElement; + rect: android.graphics.Rect; + clone(): IElementCleaner; + set(rect: android.graphics.Rect): void; + clean(canvas: android.graphics.Canvas, scale: number): void; + debug(canvas: android.graphics.Canvas, scale: number): void; + } + + interface IScriptableWatcher { + object: object; + isDirty(): boolean; + validate(): void; + invalidate(): void; + setTarget(obj: object): void; + refresh(): void; + } + + /** + * Object where you can specify how the UI element will behave on touch events. + */ + interface UIClickEvent { + /** + * This function will be called when element is short touched. + */ + onClick?: (position: Vector, container: UiAbstractContainer | ItemContainer, tileEntity: Nullable | any, window: IWindow, canvas: android.graphics.Canvas, scale: number) => void; + /** + * This function will be called when element is long touched. + */ + onLongClick?: (position: Vector, container: UiAbstractContainer | ItemContainer, tileEntity: Nullable | any, window: IWindow, canvas: android.graphics.Canvas, scale: number) => void; + } + + /** + * There are 12 types of UI elements given by Inner Core, and you can also create your custom ones. + * Each element type has it's own specific description object. + * These description objects are all inherited from this BasicElementDescription. + * It means that each element must have coords on the GUI by X, Y, and additionally Z axis, + * and also you can specify how the element will behave when touched, in clicker object (optional). + */ + interface UIElement extends Scriptable { + x?: number, + y?: number, + z?: number, + clicker?: UIClickEvent; + } + + /** + * {@inheritDoc UI.UIElement} + */ + type Element = UIElement; + + /** + * This is the base Java abstract class, which are all Inner Core element types inherited from. + * In Java, to create custom element types, you can inherit your element class from this one as well. + * Whereas in JavaScript, you should use "custom" element type in description object, + * where you can specify custom behavior for different events. + * For more information about custom element types in JavaScript, + * see {@link UI.UICustomElement}. + */ + interface IElement { + cleaner: IElementCleaner; + description: object; + descriptionWatcher: IScriptableWatcher; + elementName: string; + elementRect: android.graphics.Rect; + isDirty: boolean; + isTouched: boolean; + window: Window; + x: number; + y: number; + z: number; + onBindingUpdated(str: string, obj: T): void; + onDraw(canvas: android.graphics.Canvas, scale: number): void; + onSetup(descr?: T): void; + /** + * Creates a new {@link UI.Texture} instance + * with specified style applied. + * See {@link UI.Texture.constructor} for parameters description. + */ + createTexture(obj: BitmapTypes): Texture; + /** + * Sets element's position in the window's unit coordinates. + * @param x x position + * @param y y position + */ + setPosition(x: number, y: number): void; + /** + * Sets element's size in the window's unit coordinates. + * @param width element's width + * @param height element's height + */ + setSize(width: number, height: number): void; + getCleanerCopy(): IElementCleaner; + /** + * Passes any value to the element. + * @param bindingName binding name, you can access the value from the + * element by this name + * @param value value to be passed to the element + */ + setBinding(bindingName: string, value: T): void; + /** + * Gets any value from the element. + * @param name binding name, you can access the value from the + * element by this name; some binding names are reserved for additional + * element information, e.g. `"element_obj"` contains pointer to the + * current object and `"element_rect"` contains {@link android.graphics.Rect} + * object containing drawing rectangle + * @returns Value that was get from the element or `null` if the element + * doesn't exist. + */ + getBinding(name: string): Nullable; + setupInitialBindings(container: UiAbstractContainer, elementName: string): void; + onTouchEvent(event: ITouchEvent): void; + onTouchReleased(event: ITouchEvent): void; + isReleased(): boolean; + onRelease(): void; + onReset(): void; + invalidate(): void; + debug(canvas: android.graphics.Canvas, scale: number): void; + } + + interface UICustomElement extends UIElement { + type: "custom", + custom?: { + onSetup?: (element: ICustomElement) => void, + onDraw?: (element: ICustomElement, cvs: android.graphics.Canvas, scale: number) => void, + onTouchReleased?: (element: ICustomElement) => void, + onBindingUpdated?: (element: ICustomElement, name: string, val: T) => void, + onReset?: (element: ICustomElement) => void, + onRelease?: (element: ICustomElement) => void, + onContainerInit?: (element: ICustomElement, container: UiAbstractContainer, elementName: string) => void; + }; + } + + interface ICustomElement extends IElement { + getScope(): object; + onSetup(desc: T): void; + onDraw(canvas: android.graphics.Canvas, scale: number): void; + onTouchReleased(event: ITouchEvent): void; + onBindingUpdated(name: string, val: T): void; + onReset(): void; + onRelease(): void; + setupInitialBindings(container: UiAbstractContainer, elementName: string): void; + } + + interface UIButtonElement extends UIElement { + type: "button" | "closeButton" | "close_button", + scale?: number, + bitmap?: BitmapTypes, + bitmap2?: BitmapTypes; + } + + interface IButtonElement extends IElement { + onSetup(desc: T): void; + onDraw(canvas: android.graphics.Canvas, scale: number): void; + onBindingUpdated(name: string, value: T): void; + } + + type UICloseButtonElement = UIButtonElement; + + interface ICloseButtonElement extends IButtonElement { + onTouchEvent(event: ITouchEvent): void; + } + + interface FrameTextureSides { + up?: boolean, + down?: boolean, + left?: boolean, + right?: boolean; + } + + interface UIFrameElement extends UIElement { + type: "frame", + bitmap?: BitmapTypes, + width?: number, + height?: number, + scale?: number, + color?: number, + sides?: FrameTextureSides; + } + + interface IFrameElement extends IElement { + onSetup(desc: T): void; + onDraw(canvas: android.graphics.Canvas, scale: number): void; + onBindingUpdated(name: string, val: T): void; + onRelease(): void; + } + + interface UIImageElement extends UIElement { + type: "image", + width?: number, height?: number, + scale?: number, + bitmap?: BitmapTypes, + overlay?: BitmapTypes; + } + + interface IImageElement extends IElement { + height: number; + overlay: Texture; + texture: Texture; + textureScale: number; + width: number; + onSetup(desc: T): void; + isAnimated(): boolean; + onDraw(canvas: android.graphics.Canvas, scale: number): void; + onBindingUpdated(name: string, val: T): void; + onRelease(): void; + } + + interface UIScaleElement extends UIElement { + type: "scale", + scale?: number, + direction?: number, + invert?: boolean, + pixelate?: boolean, + bitmap?: string, + width?: number, + height?: number, + background?: string, + backgroundOffset?: { + x?: number, + y?: number; + }, + overlay?: string, + overlayOffset?: { + x?: number, + y?: number; + }, + value?: number; + } + + interface IScaleElement extends IElement { + /* static */ readonly DIRECTION_DOWN: number; + /* static */ readonly DIRECTION_LEFT: number; + /* static */ readonly DIRECTION_RIGHT: number; + /* static */ readonly DIRECTION_UP: number; + onSetup(desc: T): void; + onDraw(canvas: android.graphics.Canvas, scale: number): void; + onBindingUpdated(name: string, val: T): void; + onRelease(): void; + } + + interface UIScrollElement extends UIElement { + type: "scroll", + isInt?: boolean, + width?: number, + length?: number, + min?: number, + max?: number, + divider?: number, + bindingObject?: any, + bindingProperty?: string, + configValue?: Config.ConfigValue, + bitmapHandle?: BitmapTypes, + bitmapHandleHover?: BitmapTypes, + bitmapBg?: string, + bitmapBgHover?: string, + ratio?: number, + onNewValue?: (result: number, container: UiAbstractContainer, element: UIScrollElement) => void; + } + + interface IScrollElement extends IElement { + onSetup(desc: T): void; + onDraw(canvas: android.graphics.Canvas, scale: number): void; + onBindingUpdated(name: string, val: T): void; + onRelease(): void; + onTouchEvent(event: ITouchEvent): void; + } + + interface UISlotElement extends UIElement { + type: "slot", + bitmap?: string, + size?: number, + maxStackSize?: number, + visual?: boolean, + darken?: boolean, + isDarkenAtZero?: boolean, + /** + * @since 2.0.4b42 + */ + text?: string, + source?: ItemInstance, + /** + * @deprecated In 2.0.4b43, not needed anymore. + */ + isTransparentBackground?: boolean, + /** + * @deprecated In 2.0.4b43, not needed anymore. + */ + needClean?: boolean, + /** + * @default 0.82 + * @since 2.2.1b96 + */ + iconScale?: number, + /** + * @default false + * @since 2.2.1b96 + */ + disablePixelPerfect?: boolean, + onItemChanged?: (container: UiAbstractContainer, oldId: number, oldCount: number, oldData: number) => void, + isValid?: (id: number, count: number, data: number, container: Container, item: ItemInstance) => boolean; + } + + interface ISlotElement extends IElement { + background: Texture; + curCount: number; + curData: number; + curExtra: Nullable; + curId: number; + isDarken: boolean; + isDarkenAtZero: boolean; + isVisual: boolean; + maxStackSize: number; + size: number; + slotName: string; + source: UiVisualSlotImpl; + textOverride: Nullable; + onSetup(desc: T): void; + onDraw(canvas: android.graphics.Canvas, scale: number): void; + onBindingUpdated(name: string, val: T): void; + setupInitialBindings(container: UiAbstractContainer, elementName: string): void; + onRelease(): void; + onReset(): void; + getMaxStackSize(): number; + isValidItem(id: number, count: number, data: number, extra: Nullable): boolean; + getMaxItemTransferAmount(slot: ISlotElement): number; + onTouchEvent(event: ITouchEvent): void; + } + + interface UIInvSlotElement extends Omit { + type: "invSlot" | "invslot", + index?: number; + } + + interface IInvSlotElement extends ISlotElement { + onSetup(desc: T): void; + onTouchEvent(event: ITouchEvent): void; + onBindingUpdated(name: string, val: T): void; + setupInitialBindings(container: UiAbstractContainer, elementName: string): void; + } + + interface UISwitchElement extends UIElement { + type: "switch", + bindingObject?: any, + bindingProperty?: string, + configValue?: Config.ConfigValue, + bitmapOn?: BitmapTypes, + bitmapOnHover?: BitmapTypes, + bitmapOff?: BitmapTypes, + bitmapOffHover?: BitmapTypes, + scale?: number, + onNewState?: (val: boolean, container: UiAbstractContainer, element: UISwitchElement) => void; + } + + interface ISwitchElement extends IElement { + onSetup(desc: T): void; + onDraw(canvas: android.graphics.Canvas, scale: number): void; + onBindingUpdated(name: string, val: T): void; + onTouchEvent(event: ITouchEvent): void; + onRelease(): void; + } + + interface UITabElement extends UIElement { + type: "tab", + selectedColor?: number, + deselectedColor?: number, + tabIndex?: number, + isAlwaysSelected?: boolean, + isSelected?: boolean; + } + + interface ITabElement extends IFrameElement { + onSetup(desc: T): void; + onTouchEvent(event: ITouchEvent): void; + onReset(): void; + } + + interface UITextElement extends UIElement { + type: "text", + font?: FontDescription, + multiline?: boolean, + format?: boolean, + formatMaxCharsPerLine?: number, + text?: string; + } + + interface ITextElement extends IElement { + onSetup(desc: T): void; + onDraw(canvas: android.graphics.Canvas, scale: number): void; + onBindingUpdated(name: string, val: T): void; + } + + interface UIFPSTextElement extends Omit { + type: "fps", + interpolate?: boolean, + period?: number; + } + + interface IFPSTextElement extends ITextElement { + onSetup(desc: T): void; + onDraw(canvas: android.graphics.Canvas, scale: number): void; + } + + /** + * Object containing ui elements with key as the name and value as the + * {@link UI.UIElement} instance to be used. + */ + type Elements = ( + UICustomElement + | UIButtonElement + | UICloseButtonElement + | UIFrameElement + | UIImageElement + | UIScaleElement + | UIScrollElement + | UISlotElement + | UISwitchElement + | UITabElement + | UITextElement + | UIFPSTextElement + | UIInvSlotElement + ); + interface ElementSet { + [key: string]: Elements; + } + + /** + * Class used to visualize configuration file contents in a simple way. + */ + class ConfigVisualizer { + /** + * Constructs new {@link UI.ConfigVisualizer} instance with specified elements + * names prefix. + * @param config configuration file to be loaded + * @param prefix elements names prefix used for this visualizer + */ + constructor(config: Config, prefix: string); + /** + * Constructs new {@link UI.ConfigVisualizer} instance with default elements + * names prefix (*config_vis*). + * @param config configuration file to be loaded + */ + constructor(config: Config); + /** + * Removes all elements with current element name prefix. In other + * words, removes all elements that were created by this. + * {@link UI.ConfigVisualizer} instance + * @param elements target {@link UI.WindowContent.elements} section + */ + clearVisualContent(elements: UI.ElementSet): void; + /** + * Creates elements in the window to visualize configuration file. + * @param elements target {@link UI.WindowContent.elements} section + * @param prefs top left position of the first element. Default position + * is (0, 0, 0) + */ + createVisualContent(elements: UI.ElementSet, prefs?: Partial): void; + } +} diff --git a/core-engine/UI.IWindow.d.ts b/core-engine/UI.IWindow.d.ts new file mode 100644 index 000000000..d02f388c4 --- /dev/null +++ b/core-engine/UI.IWindow.d.ts @@ -0,0 +1,454 @@ +declare namespace UI { + /** + * Specifies contents and additional parameters for all types of windows. + */ + interface WindowContent { + /** + * Specifies window's location, used for + * {@link UI.Window}, {@link UI.TabbedWindow} + * and {@link UI.StandartWindow}. + */ + location?: WindowLocationDescription, + /** + * Specifies window's style, an object containing keys as style binding + * names and values as gui texture names corresponding to the binding. + */ + style?: BindingSet, + /** + * Specifies window's style, an object containing keys as style binding + * names and values as gui texture names corresponding to the binding. + * @deprecated Use {@link style} instead. + */ + params?: BindingSet, + /** + * Array of drawings + */ + drawing?: UI.DrawingSet, + /** + * Object containing keys as gui elements names and {@link UI.Elements} + * instances as values. Gui elements are interactive components that are + * used to create interfaces functionality. + */ + elements?: UI.ElementSet; + } + + interface IWindow { + /** + * Closes window without container. Use only if the window was opened + * without container. + */ + close(): void; + /** + * Called up to 66 times a second to update window's content. + * @param time current time in milliseconds + */ + frame(time: number): void; + /** + * @returns New {@link UI.Container} + * that was used to open this window or null, if + * the window wasn't opened in container. + */ + getContainer(): Nullable; + /** + * @returns Window's content object + * (usually specified in the window's constructor). + */ + getContent(): Nullable; + /** + * Gets all the elements in the window. + * @returns HashMap containing string element name as keys and + * element instances as values. + */ + getElements(): java.util.HashMap; + /** + * @returns Object containing current style of the window. + */ + getStyle(): Style; + /** + * Forces ui drawables of the window to refresh. + * @param onCurrentThread if `true`, the drawables will be refreshed + * immediately, otherwise refresh event will be posted; ensure you are + * in the UI thread if you pass `true` as the parameter + * @default onCurrentThread: false + */ + invalidateDrawing(onCurrentThread: boolean): void; + /** + * Forces ui elements of the window to refresh. + * @param onCurrentThread if `true`, the drawables will be refreshed + * immediately, otherwise refresh event will be posted; ensure you are + * in the UI thread if you pass `true` as the parameter + * @default onCurrentThread: false + */ + invalidateElements(onCurrentThread: boolean): void; + /** + * @returns `true` if the window can change it's contents position. + */ + isDynamic(): boolean; + /** + * @returns `true` if the window has an inventory that should be updated. + */ + isInventoryNeeded(): boolean; + /** + * @returns `true` if the window is opened, `false` otherwise. + */ + isOpened(): boolean; + /** + * @returns Whether the window can be closed on pressing back navigation button. + */ + onBackPressed(): boolean; + /** + * Opens window without container. + */ + open(): void; + /** + * Sets container for the current window. Be careful when calling it + * manually. You should prefer opening the window via + * {@link UI.Container.openAs} call. + * @param container {@link UI.Container} + * to be associated with current window or null to associate no container with current window + */ + setContainer(container: Nullable): void; + /** + * Turns debug mode for the window on and off. + * @param debug if `true`, additional debug information will be drawn on + * the window canvas + */ + setDebugEnabled(debug: boolean): void; + } + + /** + * Object used to handle windows opening and closing events. + */ + interface WindowEventListener { + /** + * Called when the window is opened. + * @param window current {@link UI.Window} object + */ + onOpen?: (window: Window) => void; + /** + * Called when the window is closed. + * @param window current {@link UI.Window} object + */ + onClose?: (window: Window) => void; + } + + interface IWindowLocation { + /** + * X coordinate of the window in units. + * @default 0 + */ + x?: number; + /** + * Y coordinate of the window in units. + * @default 0 + */ + y?: number; + /** + * Width of the window in units, by default calculated to match right + * screen bound. + */ + width?: number; + /** + * Height of the window in units, by default calculated to match bottom + * screen bound. + */ + height?: number; + /** + * Defines scrollable window size along the X axis. + */ + scrollX?: number; + /** + * Defines scrollable window size along the Y axis. + */ + scrollY?: number; + } + + /** + * Object representing window location used in window content object and + * {@link UI.WindowLocation} constructor. + */ + interface WindowLocationDescription extends IWindowLocation { + forceScrollX?: boolean, + forceScrollY?: boolean, + /** + * Determines whether the interface needs to be resized based + * on its size or a global unit system should be used. + * @since 2.3.1b115 + */ + globalScale?: boolean, + /** + * Paddings are distances from the window bounds to the elements in the + * window. + */ + padding?: { + top?: number, + bottom?: number, + left?: number, + right?: number; + }; + } + + /** + * {@inheritDoc UI.WindowLocationDescription} + */ + type WindowLocationParams = WindowLocationDescription; + + /** + * Class representing window's location. All coordinates are defined in + * units (given screen's width is 1000 units). + */ + class WindowLocation { + /** + * Constructs new {@link UI.WindowLocation} instance with default position and + * size (fullscreen window). + */ + constructor(); + /** + * Constructs new {@link UI.WindowLocation} instance with specified parameters. + */ + constructor(desc: WindowLocationDescription); + /** + * Constant used to represent bottom padding. + */ + static readonly PADDING_BOTTOM: number; + /** + * Constant used to represent left padding. + */ + static readonly PADDING_LEFT: number; + /** + * Constant used to represent right padding. + */ + static readonly PADDING_RIGHT: number; + /** + * Constant used to represent top padding. + */ + static readonly PADDING_TOP: number; + forceScrollX: boolean; + forceScrollY: boolean; + /** + * Determines whether the interface needs to be resized based + * on its size or a global unit system should be used. + * @since 2.3.1b115 + */ + globalScale: boolean; + /** + * Window height. + */ + height: number; + /** + * Window scale. + */ + scale: number; + /** + * Horizontal window scroll. + */ + scrollX: number; + /** + * Vertical window scroll. + */ + scrollY: number; + /** + * Window width. + */ + width: number; + /** + * Window horizontal position. + */ + x: number; + /** + * Window vertical position. + */ + y: number; + /** + * Window position on layers. + */ + zIndex: number; + /** + * Constructs new {@link UI.WindowLocation} instance with default position and + * size (fullscreen window). + */ + constructor(); + /** + * Constructs new {@link UI.WindowLocation} instance with specified parameters. + * @param params + */ + constructor(params: WindowLocationDescription); + /** + * Sets scrollable window size. Should be greater then window + * width/height for the changes to take effect. + * @param x scrollable window size along the X axis + * @param y scrollable window size along the Y axis + */ + setScroll(x: number, y: number): void; + /** + * Sets the size of the window. + * @param x window's width + * @param y window's height + */ + setSize(x: number, y: number): void; + /** + * @returns Window location as a js object. Note that paddings are not + * included into the object. + */ + asScriptable(): IWindowLocation; + /** + * Creates a copy of current {@link UI.WindowLocation} object. + * @returns Newly created copy of the object. + */ + copy(): WindowLocation; + /** + * Sets window location parameters. + * @param x X coordinate of the window + * @param y Y coordinate of the window + * @param width width of the window + * @param height height of the window + */ + set(x: number, y: number, width: number, height: number): void; + /** + * Sets window location parameters from another {@link UI.WindowLocation}. + * Note that paddings are not copied instance. + * @param location another {@link UI.WindowLocation} instance to copy + * parameters from + */ + set(location: WindowLocation): void; + /** + * Sets window's scroll size to the windows size to remove scroll. + */ + removeScroll(): void; + /** + * Sets padding of the window. + * @param padding one of the {@link UI.WindowLocation.PADDING_TOP}, + * {@link UI.WindowLocation.PADDING_BOTTOM}, {@link UI.WindowLocation.PADDING_LEFT}, + * {@link UI.WindowLocation.PADDING_RIGHT} constants + * @param value value of the padding to be assigned to appropriate + * window bound + */ + setPadding(padding: 0 | 1 | 2 | 3, value: number): void; + /** + * Sets the four paddings of the window for the appropriate bounds. + */ + setPadding(top: number, bottom: number, left: number, right: number): void; + /** + * @returns Unit size (in pixels) in the fullscreen context (` / 1000`). + */ + getScale(): number; + /** + * @returns Unit size (in pixels) in the window's bounds. + */ + getDrawingScale(): number; + /** + * @returns Window's rectangle in the {@link android.graphics.Rect} object. + */ + getRect(): android.graphics.Rect; + showPopupWindow(win: android.widget.PopupWindow): void; + updatePopupWindow(win: android.widget.PopupWindow): void; + getLayoutParams(a1: number, a2: number, a3: number): android.view.WindowManager.LayoutParams; + setupAndShowPopupWindow(win: android.widget.PopupWindow): void; + /** + * Sets window's Z index. Z index determines how the window will be + * displayed when several windows are open. + * @param z window Z index + */ + setZ(z: number): void; + /** + * @returns Window's width in units + * (always 1000 by definition of the unit). + */ + getWindowWidth(): 1000; + /** + * @returns Window's height in units. + */ + getWindowHeight(): number; + /** + * Transforms dimension in fullscreen units to the dimension within + * window's bounds. + * @param val value to be transformed + */ + globalToWindow(val: number): number; + /** + * Transforms dimension within window's bounds to the dimension in + * fullscreen units. + * @param val value to be transformed + */ + windowToGlobal(val: number): number; + } + + /** + * Object representing window style. Window styles allows to customize the + * way your windows look like. + */ + class Style { + /** + * Classic (0.16.*-like) windows style, which also used before + * legacy version. + */ + static readonly CLASSIC: Style; + /** + * Default windows style. + */ + static readonly DEFAULT: Style; + static readonly LEGACY: Style; + /** + * Adds gui texture name to use for the specified window part. + * @param key binding name + * @param name gui texture name + */ + addBinding(key: string, name: string): void; + /** + * Gets texture binding bt it's name. Searches first in the additional + * styles, then in the current style, then in all it's parents. + * @param key binding name + * @param fallback value to return on binding failure + * @returns Ui texture name if current object, additional styles or one + * of the parents contains such a binding name, fallback otherwise. + */ + getBinding(key: string, fallback: string): string; + /** + * Adds an additional style object to the current style. + * @param style additional style object to be added + */ + addStyle(style: Style): void; + /** + * Constructs new {@link UI.Style} object + * with bindings from {@link UI.Style.DEFAULT}. + */ + constructor(); + /** + * Constructs new {@link UI.Style} object + * from given {@link UI.BindingSet} object. + */ + constructor(bindings: BindingSet); + /** + * @returns A copy of the current style. Only style bindings of the + * current style are copied, no parent/additional styles are copied. + */ + copy(): Style; + /** + * Specifies parent style object for the current style. + * @param style style to be set as parent + */ + inherit(style: Style): void; + /** + * Adds all values from given {@link UI.BindingSet} object. + */ + addAllBindings(bindings: BindingSet): void; + /** + * @returns Collection containing all binding names + * from the current style object. + */ + getAllBindingNames(): java.util.Collection; + /** + * If name is a style value (starts with `"style:"`), returns + * corresponding gui texture name, else returns input string. + * @param name style value or bitmap name + */ + getBitmapName(name: string): string; + getIntProperty(name: string, fallback: number): number; + getFloatProperty(name: string, fallback: number): number; + getDoubleProperty(name: string, fallback: number): number; + getStringProperty(name: string, fallback: string): string; + getBooleanProperty(name: string, fallback: boolean): boolean; + setProperty(name: string, value: any): void; + static getBitmapByDescription(style: Style, description: string): IBitmapWrap; + } +} diff --git a/core-engine/UI.StandardWindow.d.ts b/core-engine/UI.StandardWindow.d.ts new file mode 100644 index 000000000..80aa239a7 --- /dev/null +++ b/core-engine/UI.StandardWindow.d.ts @@ -0,0 +1,206 @@ +declare namespace UI { + interface StandardWindowBackgroundDescription { + /** + * If `true`, default window is created. + */ + standard?: boolean, + /** + * If `true`, default window is created. + * @deprecated Use {@link standard} instead. + */ + standart?: boolean, + /** + * Background color integer value, produced by + * {@link android.graphics.Color} class. + * @default 0xfff // white + */ + color?: number, + /** + * Background bitmap texture name. If the bitmap size doesn't + * match the screen size, bitmap will be stretched to fit. + */ + bitmap?: string, + /** + * Specifies window's frame parameters. + */ + frame?: { + /** + * Frame bitmap scale. + * @default 3 + */ + scale?: number, + /** + * Frame bitmap gui texture name. Defaults to *"frame"* + * style binding or, if not specified, to + * *"default_frame_8"* gui texture + */ + bitmap?: string, + }; + } + + interface StandardWindowHeaderTextDescription { + /** + * Specifies header text. + * @default "No Title" + */ + text?: string, + /** + * Specifies font params for the header text, only + * {@link StandardWindowHeaderTextDescription.size}, {@link StandardWindowHeaderTextDescription.color} + * and {@link StandardWindowHeaderTextDescription.shadow} properties are used. + */ + font?: FontDescription, + /** + * If {@link StandardWindowHeaderTextDescription.font font} is not specified, used as + * {@link StandardWindowHeaderTextDescription.size size} value. + */ + size?: number, + /** + * If {@link StandardWindowHeaderTextDescription.font font} is not specified, used as + * {@link StandardWindowHeaderTextDescription.color color} value. + */ + color?: number, + /** + * If {@link StandardWindowHeaderTextDescription.font font} is not specified, used as + * {@link StandardWindowHeaderTextDescription.shadow shadow} value. + */ + shadow?: number; + } + + interface StandardWindowHeaderDescription { + /** + * Specifies whether the header should have shadow or not. If + * `true`, the shadow is not displayed. + * @default false + */ + hideShadow?: boolean, + /** + * Specifies header height in units. + * @default 80 + */ + height?: number, + /** + * If *height* is not specified, used to specify header height + * in units. + */ + width?: number, + /** + * Frame bitmap gui texture name. Defaults to *"headerFrame"* + * style binding or, if not specified, to + * *"default_frame_7"* gui texture. + */ + frame?: string, + /** + * Header background color integer value, produced by + * {@link android.graphics.Color} class. Default is + * *Color.rgb(0x72, 0x6a, 0x70)*. + */ + color?: number, + /** + * Specifies header text styles and value. + */ + text?: StandardWindowHeaderTextDescription, + /** + * If `true`, close button is not displayed. + * @default false + */ + hideButton?: boolean; + } + + interface StandardWindowInventoryDescription { + /** + * Inventory width in units. Defaults to 300 units. + */ + width?: number, + /** + * Specifies additional padding for the inventory in units. + * Defaults to 20 units. + */ + padding?: number, + /** + * If `true`, default window is created. + */ + standard?: boolean; + } + + interface StandardWindowDescription { + /** + * Specifies minimum contents window height. If actual height is + * less then desired, scrolling is used. + */ + minHeight?: number, + /** + * Specifies background properties. + */ + background?: StandardWindowBackgroundDescription, + /** + * Specifies additional parameters for standard window's header. + */ + header?: StandardWindowHeaderDescription, + /** + * Specifies parameters for standard inventory window. + */ + inventory?: StandardWindowInventoryDescription; + } + + /** + * Extended {@link WindowContent} object with additional params for + * {@link UI.StandartWindow} and {@link UI.StandardWindow}. + */ + interface StandardWindowContent extends WindowContent { + /** + * Used for {@link UI.StandartWindow}s and {@link UI.StandardWindow}s. + * Specifies additional parameters for standard windows. + */ + standard?: StandardWindowDescription, + /** + * Used for {@link UI.StandartWindow}s and {@link UI.StandardWindow}s. + * Specifies additional parameters for standard windows. + * @deprecated Use {@link standard} instead. + */ + standart?: StandardWindowDescription; + } + + /** + * Class used to create standard UI for the mod's machines. + * {@link UI.StandardWindow} is a {@link UI.WindowGroup} that has three windows with names + * `"main"`, `"inventory"` and `"header"`. They represent custom window + * contents, player's inventory and window's header respectively. + * @since 2.0.4b40 + */ + class StandardWindow extends WindowGroup { + /** + * Constructs new {@link UI.StandardWindow} with specified content. + * Content is applied to the main window, header and inventory remain + * the same. + * @param content object containing window description + */ + constructor(content: StandardWindowContent); + /** + * Constructs new empty {@link UI.StandardWindow} object. + */ + constructor(); + getContent(): StandardWindowContent; + getStyleSafe(): Style; + setContent(content: StandardWindowContent): void; + } + + /** + * Legacy misspelled standard UI, which is works under classic + * styling and must be used only in unsupported mods. + * @deprecated In 2.0.4b40, use {@link UI.StandardWindow} instead. + */ + class StandartWindow extends StandardWindow { + /** + * Constructs new {@link UI.StandartWindow} with specified content. + * Content is applied to the main window, header and inventory remain + * the same. + * @param content object containing window description + */ + constructor(content: StandardWindowContent); + /** + * Constructs new empty {@link UI.StandartWindow} object. + */ + constructor(); + } +} diff --git a/core-engine/UI.TabbedWindow.d.ts b/core-engine/UI.TabbedWindow.d.ts new file mode 100644 index 000000000..da6622a0f --- /dev/null +++ b/core-engine/UI.TabbedWindow.d.ts @@ -0,0 +1,162 @@ +declare namespace UI { + interface TabbedWindowContent extends WindowContent { + isButtonHidden?: boolean, + } + + /** + * Class used to create windows with multiple tabs. + */ + class TabbedWindow implements IWindow { + closeOnBackPressed: boolean; + currentTab: number; + /** + * Sets window location (bounds) to draw window within. + * @param location location to be used for the tabbed window + */ + setLocation(location: WindowLocation): void; + /** + * @returns Tab content window width in units. + */ + getInnerWindowWidth(): number; + /** + * @returns Tab content window height in units. + */ + getInnerWindowHeight(): number; + /** + * @returns Tab selector window width in units. + */ + getWindowTabSize(): number; + /** + * @returns Tab selector window width in global units. + */ + getGlobalTabSize(): number; + /** + * Constructs new {@link UI.TabbedWindow} with specified location. + * @param loc location to be used for the tabbed window + */ + constructor(loc: WindowLocation); + /** + * Constructs new {@link UI.TabbedWindow} with specified content. + * @param content object containing window description + */ + constructor(content: WindowContent); + /** + * Constructs new empty {@link UI.TabbedWindow} object. + */ + constructor(); + /** + * Sets content of the tab. + * @param index index of the tab; there are 12 tabs available, from 0 to + * 11 + * @param tabOverlay content of the tab selector + * @param tabContent content of the window to be created for the tab + * @param isAlwaysSelected if `true`, tab is always displayed as selected; + * default value is `false` + * @remarks + * The location of the tabs is as follows: + * ```text + * 0 6 + * 1 7 + * 2 8 + * 3 9 + * 4 10 + * 5 11 + * ``` + */ + setTab(index: number, tabOverlay: UI.ElementSet, tabContent: WindowContent, isAlwaysSelected: boolean): void; + /** + * Sets content of the tab. + * @param index index of the tab; there are 12 tabs available, from 0 to + * 11 + * @param tabOverlay content of the tab selector + * @param tabContent content of the window to be created for the tab + * @remarks + * The location of the tabs is as follows: + * ```text + * 0 6 + * 1 7 + * 2 8 + * 3 9 + * 4 10 + * 5 11 + * ``` + */ + setTab(index: number, tabOverlay: UI.ElementSet, tabContent: WindowContent): void; + /** + * Creates fake tab with no content. + * @param index index of the tab, see {@link UI.TabbedWindow.setTab} + * for details + * @param tabOverlay content of the tab selector + */ + setFakeTab(index: number, tabOverlay: UI.ElementSet): void; + /** + * @param index index of the tab + * @returns New {@link UI.Window} instance + * created for the specified tab or null if + * no window was created for specified window. + */ + getWindowForTab(index: number): Nullable; + open(): void; + close(): void; + frame(time: number): void; + invalidateElements(onCurrentThread: boolean): void; + invalidateDrawing(onCurrentThread: boolean): void; + isOpened(): boolean; + isInventoryNeeded(): boolean; + isDynamic(): boolean; + getElements(): java.util.HashMap; + getContent(): Nullable; + getContainer(): Nullable; + setContainer(container: UiAbstractContainer): void; + setDebugEnabled(debug: boolean): void; + /** + * Sets listener to be notified about window opening/closing events. + */ + setEventListener(listener: WindowEventListener): void; + /** + * Sets listener to be notified about tab with specified index opening/closing events. + * @param index tab index + * @param listener object to be notified about the events + */ + setTabEventListener(index: number, listener: WindowEventListener): void; + onTabSelected(index: number): void; + /** + * Specifies whether the window should darken and block background. + * @param enabled pass `true` if you want the window to block + * background + * @default false + */ + setBlockingBackground(enabled: boolean): void; + /** + * @returns Current default tab index. If no default tab was specified + * via {@link UI.TabbedWindow.setDefaultTab}, the first tab added becomes default. + */ + getDefaultTab(): number; + /** + * Sets default tab index. + * @param tab index of the tab to be opened by default + */ + setDefaultTab(tab: number): void; + /** + * Sets new style object as current window's style. If the new style is + * a different object then an old one, forces window invalidation. + * @param style {@link UI.Style} object to be used as style for the window + */ + setStyle(style: Style): void; + /** + * Overrides style properties of the current style by the values + * specified in the style parameter. + * @param style js object where keys represent binding names and values + * represent texture gui names + */ + setStyle(style: BindingSet): void; + getStyle(): Style; + /** + * @deprecated Same as {@link getStyle}, meant to override + * fallback default style, but never properly used. + */ + getStyleSafe(): Style; + setCloseOnBackPressed(cobp: boolean): void; + onBackPressed(): boolean; + } +} diff --git a/core-engine/UI.Texture.d.ts b/core-engine/UI.Texture.d.ts new file mode 100644 index 000000000..d21969643 --- /dev/null +++ b/core-engine/UI.Texture.d.ts @@ -0,0 +1,247 @@ +declare namespace UI { + interface IBitmapWrap { + /* static */ readonly MISSING_BITMAP: android.graphics.Bitmap; + resize(x: number, y: number): IBitmapWrap; + restore(): boolean; + store(): boolean; + storeIfNeeded(): void; + restoreIfNeeded(): void; + getWidth(): number; + getHeight(): number; + getConfig(): android.graphics.Bitmap.Config; + getStackPos(): number; + get(): android.graphics.Bitmap; + isRecycled(): boolean; + recycle(): void; + removeCache(): void; + getResizedCache(width: number, height: number): android.graphics.Bitmap; + /* static */ wrap(bmp: android.graphics.Bitmap): IBitmapWrap; + /* static */ wrap(name: string, width: number, height: number): IBitmapWrap; + /* static */ wrap(name: string): IBitmapWrap; + } + + /** + * Class representing static or animated texture. + */ + class Texture { + animation: IBitmapWrap[]; + bitmap: IBitmapWrap; + delay: number; + isAnimation: boolean; + /** + * Constructs new static {@link Texture} with specified bitmap. + * @param bitmap {@link android.graphics.Bitmap} instance + */ + constructor(bitmap: android.graphics.Bitmap); + /** + * Constructs new animated {@link Texture} with specified frames. + * @param bitmaps an array of {@link android.graphics.Bitmap} instances to be + * used as animation frames + */ + constructor(bitmaps: android.graphics.Bitmap[]); + /** + * Constructs new static or animated {@link Texture} with specified frames. + * @param obj texture name or array of texture names for animated + * textures. Accepts raw gui textures names and style bindings + * (formatted as "style:binding_name"). + * @param style {@link Style} object to look for style bindings. If not + * specified, default style is used + */ + constructor(obj: string | { [key: string]: string }, style?: Style); + isAnimated(): boolean; + /** + * Sets texture offsets in pixels from the upper left bound of the bitmap. + */ + readOffset(obj: { x?: number, y?: number }): void; + /** + * @returns Frame number of the animation corresponding to current system time. + */ + getFrame(): number; + /** + * @param frame frame number + * @returns Bitmap object containing animation frame + * for the corresponding frame number. + */ + getBitmap(frame: number): android.graphics.Bitmap; + getBitmapWrap(frame: number): IBitmapWrap; + draw(canvas: android.graphics.Canvas, x: number, y: number, scale: number): void; + drawCutout(canvas: android.graphics.Canvas, cutout: android.graphics.RectF, x: number, y: number, scale: number): void; + /** + * @returns Width of the texture in pixels. + */ + getWidth(): number; + /** + * @returns Height of the texture in pixels. + */ + getHeight(): number; + /** + * Resizes all the frames of the texture to the specified size. + */ + resizeAll(width: number, height: number): void; + /** + * Resizes all the frames by constant scale multiplier. + * @param scale scale to modify the frames by + */ + rescaleAll(scale: number): void; + /** + * Resizes all the frames to match the first one. + */ + fitAllToOneSize(): void; + /** + * Releases all allocated resources, should be called when the texture + * is not longer needed. + */ + release(): void; + } + + /** + * Namespace containing methods used to get and add gui textures. + */ + class TextureSource { + /** + * @param name gui texture name + * @returns Bitmap instance with the ui texture, if it + * was loaded, with `"missing_texture"` texture otherwise. + */ + static get(name: string): android.graphics.Bitmap; + /** + * + * @param name gui texture name + * @returns Bitmap instance with the ui texture, if it + * was loaded, `null` otherwise. + */ + static getNullable(name: string): Nullable; + /** + * Adds any bitmap as a gui texture with specified name. + * @param name gui texture name + * @param bitmap {@link android.graphics.Bitmap} instance to be used as + * gui texture + */ + static put(name: string, bitmap: android.graphics.Bitmap): void; + /* + TODO: + loadFile(file: java.io.File, namePrefix: string): void; + loadAsset(name: string): void; + loadDirectory(dir: java.io.File): void; + loadDirectory(dir: java.io.File, namePrefix: string): void; + */ + } + + /** + * Object used to manipulate frame textures. + */ + interface FrameTexture { + /** + * Specifies bottom left corner of the frame. + */ + /* static */ readonly CORNER_BOTTOM_LEFT: number; + /** + * Specifies bottom right corner of the frame. + */ + /* static */ readonly CORNER_BOTTOM_RIGHT: number; + /** + * Specifies top left corner of the frame. + */ + /* static */ readonly CORNER_TOP_LEFT: number; + /** + * Specifies top right corner of the frame. + */ + /* static */ readonly CORNER_TOP_RIGHT: number; + /** + * Specifies bottom side of the frame. + */ + /* static */ readonly SIDE_BOTTOM: number; + /** + * Specifies left side of the frame. + */ + /* static */ readonly SIDE_LEFT: number; + /** + * Specifies right side of the frame. + */ + /* static */ readonly SIDE_RIGHT: number; + /** + * Specifies top side of the frame. + */ + /* static */ readonly SIDE_TOP: number; + /** + * Expands side of the texture by specified amount of pixels. + * @param sideId side of the texture, one of the + * **FrameTexture.SIDE_LEFT**, **FrameTexture.SIDE_RIGHT**, + * **FrameTexture.SIDE_UP**, **FrameTexture.SIDE_DOWN** constants + * @returns Expanded {@link android.graphics.Bitmap} instance with the frame. + */ + expandSide(sideId: number, pixels: number): android.graphics.Bitmap; + /** + * Expands texture to the specified side, filling the middle with + * specified color. + * @param color integer color value produced by {@link android.graphics.Color} + * class + * @param sides array of booleans marking whether the side should be + * expanded or not. The order of the sides is + * **FrameTexture.SIDE_LEFT**, **FrameTexture.SIDE_RIGHT**, + * **FrameTexture.SIDE_UP**, **FrameTexture.SIDE_DOWN** + * @returns Expanded {@link android.graphics.Bitmap} instance with the frame. + */ + expand(width: number, height: number, color: number, sides: [boolean, boolean, boolean, boolean]): android.graphics.Bitmap; + /** + * Expands texture to the specified side, filling the middle with + * specified color. + * @param color integer color value produced by {@link android.graphics.Color} + * class + */ + expand(width: number, height: number, color: number): android.graphics.Bitmap; + /** + * Expands texture to the specified side, filling the middle with + * specified color. + * @param scale scale of the created bitmap + * @param color integer color value produced by {@link android.graphics.Color} + * class + * @param sides array of booleans marking whether the side should be + * expanded or not. See {@link UI.FrameTexture.expand} parameters for details. + * Default behavior is to scale all sides + * @returns Expanded and scaled {@link android.graphics.Bitmap} instance. + */ + expandAndScale(width: number, height: number, scale: number, color: number, sides: [boolean, boolean, boolean, boolean]): android.graphics.Bitmap; + /** + * Expands texture to the specified side, filling the middle with + * specified color. + * @param scale scale of the created bitmap + * @param color integer color value produced by {@link android.graphics.Color} + * class + */ + expandAndScale(width: number, height: number, scale: number, color: number): android.graphics.Bitmap; + /** + * @returns Original frame texture source stored in + * {@link android.graphics.Bitmap} instance. + */ + getSource(): android.graphics.Bitmap; + /** + * @param side side of the texture, one of the + * **FrameTexture.SIDE_LEFT**, **FrameTexture.SIDE_RIGHT**, + * **FrameTexture.SIDE_UP**, **FrameTexture.SIDE_DOWN** constants + * @returns Texture side source extracted from the original frame + * texture source stored in {@link android.graphics.Bitmap} instance. + */ + getSideSource(side: number): android.graphics.Bitmap; + /** + * @returns Object packed integer color value + * of the central pixel of the source texture. + */ + getCentralColor(): number; + draw(canvas: android.graphics.Canvas, rect: android.graphics.RectF, scale: number, color: number, sides: [boolean, boolean, boolean, boolean]): void; + } + + /** + * Namespace containing method to get {@link FrameTexture} instances. + */ + class FrameTextureSource { + /** + * @param name gui texture name of the frame + */ + static get(name: string): FrameTexture; + /* + TODO: + static get(name: string, style: Style): FrameTexture; + */ + } +} diff --git a/core-engine/UI.Window.d.ts b/core-engine/UI.Window.d.ts new file mode 100644 index 000000000..3eb50e667 --- /dev/null +++ b/core-engine/UI.Window.d.ts @@ -0,0 +1,303 @@ +declare namespace UI { + interface IContentProvider { + content: WindowContent; + drawing: object; + drawingWatcher: IScriptableWatcher; + elementMap: java.util.HashMap; + elements: object; + window: Window; + setContentObject(content: WindowContent): void; + setupElements(): void; + refreshElements(): void; + setupDrawing(): void; + refreshDrawing(): void; + invalidateAllContent(): void; + } + + interface IElementProvider { + addOrRefreshElement(element: IElement): void; + getStyleFor(element: IElement): Style; + invalidateAll(): void; + releaseAll(): void; + removeElement(element: IElement): void; + resetAll(): void; + runCachePreparation(): void; + setBackgroundProvider(bgprovider: IBackgroundProvider): void; + setWindowStyle(style: Style): void; + } + + interface IBackgroundProvider { + addDrawing(idrawing: IDrawing): void; + clearAll(): void; + prepareCache(): void; + releaseCache(): void; + setBackgroundColor(color: number): void; + } + + /** + * Represents window of required size that can be opened in container to + * provide any required UI facilities. + */ + class Window implements IWindow { + closeOnBackPressed: boolean; + content: WindowContent; + elementProvider: IElementProvider; + elementView: android.widget.ImageView; + isBackgroundDirty: boolean; + isForegroundDirty: boolean; + layout: android.view.ViewGroup; + location: WindowLocation; + /** + * Constructs new {@link UI.Window} object with specified bounds. + * @param location object containing window's bounds. Note that the + * bounds change the width of the window, but the full width of the + * window becomes 1000 units. + */ + constructor(location: WindowLocation); + /** + * Constructs new {@link UI.Window} object with specified content. + * @param content window's content + */ + constructor(content: WindowContent); + /** + * Constructs new empty {@link UI.Window} object. + */ + constructor(); + /** + * Opens window without container. + */ + open(): void; + /** + * Adds another window as adjacent window, so that several windows open + * at the same time. This allows to divide window into separate parts + * and treat them separately. + * @param window another window to be added as adjacent + */ + addAdjacentWindow(window: Window): void; + /** + * Removes adjacent window from the adjacent windows list. + * @param window another window that was added as adjacent + */ + removeAdjacentWindow(window: Window): void; + preOpen(): void; + postOpen(): void; + /** + * Closes window without container. Use only if the window was opened + * without container. + */ + close(): void; + /** + * Called up to 66 times a second to update window's content. + * @param time current time in milliseconds + */ + frame(time: number): void; + /** + * Forces ui elements of the window to refresh. + * @param onCurrentThread if `true`, the drawables will be refreshed + * immediately, otherwise refresh event will be posted; ensure you are + * in the UI thread if you pass `true` as the parameter + * @default onCurrentThread: false + */ + invalidateElements(onCurrentThread: boolean): void; + /** + * Forces ui drawables of the window to refresh. + * @param onCurrentThread if `true`, the drawables will be refreshed + * immediately, otherwise refresh event will be posted; ensure you are + * in the UI thread if you pass `true` as the parameter + * @default onCurrentThread: false + */ + invalidateDrawing(onCurrentThread: boolean): void; + /** + * @returns `true` if the window is opened, `false` otherwise. + */ + isOpened(): boolean; + postElementRefresh(): void; + postBackgroundRefresh(): void; + forceRefresh(): void; + /** + * Specifies whether touch events should be handled by this window or + * passed to underlying windows (to the game). By default all windows + * are touchable. + * @param touchable pass `true` if the window should handle touch events, + * `false` otherwise + */ + setTouchable(touchable: boolean): void; + /** + * @returns `true` if the window is touchable, `false` otherwise. + */ + isTouchable(): boolean; + /** + * @returns `true` if window blocks background. + */ + isBlockingBackground(): boolean; + /** + * Specifies whether the window should darken and block background. + * @param blockingBackground pass `true` if you want the window to block + * background + * @default false + */ + setBlockingBackground(blockingBackground: boolean): void; + /** + * @returns `true` if the window is game overlay, `false` otherwise. + */ + isNotFocusable(): boolean; + /** + * Allows window to be displayed as game overlay without blocking + * Minecraft sounds. Note that this drops window's FPS. + * @param inGameOverlay if `true`, the window is opened in PopupWindow + * to avoid blocking Minecraft sounds + * @default false + */ + setAsGameOverlay(inGameOverlay: boolean): void; + /** + * Set background color of window. + * @param color integer color value (you can specify it using hex value) + */ + setBackgroundColor(color: number): void; + /** + * @returns `true` if the window has an inventory that should be updated. + */ + isInventoryNeeded(): boolean; + /** + * @returns `true` if the window can change it's contents position. + */ + isDynamic(): boolean; + /** + * Gets all the elements in the window. + * @returns Hashes containing string element names + * as keys and element instances as values. + */ + getElements(): java.util.HashMap; + /** + * @returns Window's content object (usually specified in the window's + * constructor). + */ + getContent(): Nullable; + /** + * Specifies the content of the window. + * @param content content object to be applied to the window + */ + setContent(content: WindowContent): void; + /** + * @param dynamic specify `true`, if the window contains dynamic + * (animated) elements, `false` otherwise. By default all windows are + * dynamic. Make them static for better performance + */ + setDynamic(dynamic: boolean): void; + /** + * @param inventoryNeeded specify `true` if the window requires player's + * inventory + * @default false + */ + setInventoryNeeded(inventoryNeeded: boolean): void; + invalidateBackground(): void; + invalidateForeground(): void; + /** + * @returns Window's current location object. + */ + getLocation(): WindowLocation; + getElementProvider(): T; + getBackgroundProvider(): T; + getContentProvider(): IContentProvider; + /** + * @returns Unit size (in pixel) in the window's bounds. + */ + getScale(): number; + /** + * @returns Object containing current style of the window. + */ + getStyle(): Style; + /** + * Overrides style properties of the current style by the values + * specified in the style parameter. + * @param style js object where keys represent binding names and values + * represent texture gui names + */ + setStyle(style: BindingSet): void; + /** + * Sets new style object as current window's style. If the new style is + * a different object then an old one, forces window invalidation. + * @param style {@link UI.Style} object to be used as style for the window + */ + setStyle(style: Style): void; + invalidateAllContent(): void; + /** + * Gets custom property by it's name. Custom properties can be used to + * store some values containing window's current state. Note that these + * properties are not saved between Inner Core launches. + * @param name custom property name + * @returns Value set by {@link UI.Window.putProperty} + * or null if no value was specified for this name. + */ + getProperty(name: string): T; + /** + * Sets custom property value. + * @param name custom property name + * @param value custom property value + */ + putProperty(name: string, value: T): void; + /** + * @returns Currently {@link UI.Container} + * that was used to open this window or null, if + * the window wasn't opened in container. + */ + getContainer(): Nullable; + /** + * Sets container for the current window. Be careful when calling it + * manually. You should prefer opening the window via it. + * {@link UI.Container.openAs} call @param container {@link UI.Container} + * to be associated with current window or `null` to associate + * no container with current window. + */ + setContainer(container: Nullable): void; + /** + * Turns debug mode for the window on and off. + * @param enabled if `true`, additional debug information will be drawn on + * the window canvas + */ + setDebugEnabled(enabled: boolean): void; + /** + * Sets any window as current window's parent. If current window closes, + * parent window closes too. + * @param parent window to be used as parent window for the current + * window. + */ + setParentWindow(parent: IWindow): void; + /** + * @returns Current window's parent window. + */ + getParentWindow(): Nullable; + /** + * Sets listener to be notified about window opening/closing events. + */ + setEventListener(listener: UI.WindowEventListener): void; + /** + * Gets listener to be notified about window opening/closing events. + * @since 2.3.1b116 + */ + getEventListener(): UI.WindowEventListener; + + runCachePreparation(async: boolean): void; + /** + * Writes debug information about current window to the log. + */ + debug(): void; + /** + * Gives the property to be closed on pressing back navigation button to the given window. + */ + setCloseOnBackPressed(val: boolean): void; + /** + * @returns Whether the window can be closed on pressing back navigation button. + */ + onBackPressed(): boolean; + /** + * @since 2.2.1b96 + */ + updateScrollDimensions(): void; + updateWindowLocation(): void; + /** + * @since 2.2.1b96 + */ + updateWindowPositionAndSize(): void; + } +} diff --git a/core-engine/UI.WindowGroup.d.ts b/core-engine/UI.WindowGroup.d.ts new file mode 100644 index 000000000..29f24cb60 --- /dev/null +++ b/core-engine/UI.WindowGroup.d.ts @@ -0,0 +1,161 @@ +declare namespace UI { + /** + * Class representing several windows opened at the same. For example, + * {@link UI.StandardWindow} is a window group that consists of several separate + * windows. + */ + class WindowGroup implements IWindow { + closeOnBackPressed: boolean; + /** + * Constructs new {@link UI.WindowGroup} instance. + */ + constructor(); + /** + * Removes window from group by it's name. + * @param name window name + */ + removeWindow(name: string): void; + /** + * Adds window instance with specified name to the group. + * @param name window name + * @param window window to be added to the group + */ + addWindowInstance(name: string, window: IWindow): void; + /** + * Creates a new window using provided description and adds it to the + * group. + * @param name window name + * @param content window description object + * @returns Created {@link UI.Window} object. + */ + addWindow(name: string, content: WindowContent): Window; + /** + * @param name window name + * @returns Window from the group by it's name or null if no window with + * such a name was added. + */ + getWindow(name: string): Window; + /** + * @param name window name + * @returns Window's description object if a window with specified name + * exists or null otherwise. + */ + getWindowContent(name: string): Nullable; + /** + * Sets content for the window by it's name. + * @param name window name + * @param content content object + */ + setWindowContent(name: string, content: WindowContent): void; + /** + * @returns Collection object containing all the + * {@link UI.Window}s in the group. + */ + getAllWindows(): java.util.Collection; + /** + * @returns Collection object containing string names of the + * windows in the group. + */ + getWindowNames(): java.util.Collection; + /** + * Forces window refresh by it's name. + * @param name name of the window to refresh + */ + refreshWindow(name: string): void; + /** + * Forces refresh for all windows. + */ + refreshAll(): void; + /** + * Moves window with specified name to the top of the group. + * @param name window name + */ + moveOnTop(name: string): void; + /** + * Opens window without container. + */ + open(): void; + /** + * Closes window without container. Use only if the window was opened + * without container. + */ + close(): void; + /** + * Called up to 66 times a second to update window's content. + * @param time current time in milliseconds + */ + frame(time: number): void; + /** + * @returns `true` if the window is opened, `false` otherwise. + */ + isOpened(): boolean; + /** + * @returns `true` if the window has an inventory that should be updated. + */ + isInventoryNeeded(): boolean; + /** + * @returns `true` if the window can change it's contents position. + */ + isDynamic(): boolean; + /** + * Gets all the elements in the window. + * @returns Hashes containing string element name + * as keys and element instances as values. + */ + getElements(): java.util.HashMap; + /** + * @returns `null` for {@link WindowGroup}. + * */ + getContent(): Nullable; + /** + * @returns Currently {@link UI.Container} + * that was used to open this window or null, if the window wasn't opened in container. + */ + getContainer(): Nullable; + /** + * Sets container for the current window. Be careful when calling it + * manually. You should prefer opening the window via {@link UI.Container.openAs} call. + * @param container {@link UI.Container} to be associated with current window + * or `null` to associate no container with current window. + */ + setContainer(container: Nullable): void; + /** + * Turns debug mode for the window on and off. + * @param enabled if `true`, additional debug information will be drawn on + * the window canvas + */ + setDebugEnabled(enabled: boolean): void; + invalidateAllContent(): void; + setStyle(style: Style): void; + setStyle(style: BindingSet): void; + /** + * @returns Object containing current style of the window. + */ + getStyle(): Style; + setBlockingBackground(bb: boolean): void; + /** + * Forces ui elements of the window to refresh. + * @param onCurrentThread if `true`, the drawables will be refreshed + * immediately, otherwise refresh event will be posted; ensure you are + * in the UI thread if you pass `true` as the parameter + * @default onCurrentThread: false + */ + invalidateElements(onCurrentThread: boolean): void; + /** + * Forces ui drawables of the window to refresh. + * @param onCurrentThread if `true`, the drawables will be refreshed + * immediately, otherwise refresh event will be posted; ensure you are + * in the UI thread if you pass `true` as the parameter + * @default onCurrentThread: false + */ + invalidateDrawing(onCurrentThread: boolean): void; + /** + * Gives the property to be closed on pressing back navigation button to the given window group. + */ + setCloseOnBackPressed(val: boolean): void; + /** + * @returns Whether the window group can be closed on pressing back navigation button. + */ + onBackPressed(): boolean; + } +} diff --git a/core-engine/UI.d.ts b/core-engine/UI.d.ts index ac91c4a6e..eb6b7add4 100644 --- a/core-engine/UI.d.ts +++ b/core-engine/UI.d.ts @@ -1,404 +1,138 @@ -declare module UI { - - type ElementName = string | number | symbol; - - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.window.WindowContent} - */ - export type WindowContent = com.zhekasmirnov.innercore.api.mod.ui.window.WindowContent; - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.window.StandardWindowContent} - */ - export type StandardWindowContent = com.zhekasmirnov.innercore.api.mod.ui.window.StandardWindowContent; - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.types.FontDescription} - */ - export type FontDescription = com.zhekasmirnov.innercore.api.mod.ui.types.FontDescription; - - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.types.FontDescription} - */ - export type FontParams = com.zhekasmirnov.innercore.api.mod.ui.types.FontDescription; - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.window.WindowLocationDescription} - */ - export type WindowLocationParams = com.zhekasmirnov.innercore.api.mod.ui.window.WindowLocationDescription; - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.types.BindingSet} - */ - export type BindingsSet = com.zhekasmirnov.innercore.api.mod.ui.types.BindingSet; - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.types.UIStyle} - */ - export type Style = com.zhekasmirnov.innercore.api.mod.ui.types.UIStyle; - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.elements.UIClickEvent} - */ - export type UIClickEvent = com.zhekasmirnov.innercore.api.mod.ui.elements.UIClickEvent; - - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.background.ColorDrawingDescription} - */ - export type ColorDrawing = com.zhekasmirnov.innercore.api.mod.ui.background.ColorDrawingDescription; - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.background.CustomDrawingDescription} - */ - export type CustomDrawing = com.zhekasmirnov.innercore.api.mod.ui.background.CustomDrawingDescription; - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.background.FrameDrawingDescription} - */ - export type FrameDrawing = com.zhekasmirnov.innercore.api.mod.ui.background.FrameDrawingDescription; - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.background.ImageDrawingDescription} - */ - export type ImageDrawing = com.zhekasmirnov.innercore.api.mod.ui.background.ImageDrawingDescription; - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.background.LineDrawingDescription} - */ - export type LineDrawing = com.zhekasmirnov.innercore.api.mod.ui.background.LineDrawingDescription; - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.background.TextDrawingDescription} - */ - export type TextDrawing = com.zhekasmirnov.innercore.api.mod.ui.background.TextDrawingDescription; - - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.elements.BasicElementDescription} - */ - export type UIElement = com.zhekasmirnov.innercore.api.mod.ui.elements.BasicElementDescription; +declare namespace UI { /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.elements.CustomElementDescription} + * Object containing binding names as keys and string values as gui textures + * names. */ - export type UICustomElement = com.zhekasmirnov.innercore.api.mod.ui.elements.CustomElementDescription; - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.elements.ButtonElementDescription} - */ - export type UIButtonElement = com.zhekasmirnov.innercore.api.mod.ui.elements.ButtonElementDescription; - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.elements.ButtonElementDescription} - */ - export type UICloseButtonElement = com.zhekasmirnov.innercore.api.mod.ui.elements.ButtonElementDescription; - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.elements.FrameElementDescription} - */ - export type UIFrameElement = com.zhekasmirnov.innercore.api.mod.ui.elements.FrameElementDescription; - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.elements.ImageElementDescription} - */ - export type UIImageElement = com.zhekasmirnov.innercore.api.mod.ui.elements.ImageElementDescription; - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.elements.ScaleElementDescription} - */ - export type UIScaleElement = com.zhekasmirnov.innercore.api.mod.ui.elements.ScaleElementDescription; - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.elements.ScrollElementDescription} - */ - export type UIScrollElement = com.zhekasmirnov.innercore.api.mod.ui.elements.ScrollElementDescription; - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.elements.SlotElementDescription} - */ - export type UISlotElement = com.zhekasmirnov.innercore.api.mod.ui.elements.SlotElementDescription; - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.elements.SwitchElementDescription} - */ - export type UISwitchElement = com.zhekasmirnov.innercore.api.mod.ui.elements.SwitchElementDescription; - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.elements.TabElementDescription} - */ - export type UITabElement = com.zhekasmirnov.innercore.api.mod.ui.elements.TabElementDescription; - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.elements.TextElementDescription} - */ - export type UITextElement = com.zhekasmirnov.innercore.api.mod.ui.elements.TextElementDescription; - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.elements.FPSTextElementDescription} - */ - export type UIFPSTextElement = com.zhekasmirnov.innercore.api.mod.ui.elements.FPSTextElementDescription; - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.elements.InvSlotElementDescription} - */ - export type UIInvSlotElement = com.zhekasmirnov.innercore.api.mod.ui.elements.InvSlotElementDescription; + type BindingSet = { + [key: string]: string + }; /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.window.IWindow} - */ - export interface IWindow extends com.zhekasmirnov.innercore.api.mod.ui.window.IWindow {} - /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.container.Slot} + * Object containing font parameters. If no color, size and shadow are + * specified, default values are ignored and white font with text size 20, + * white color and 0.45 shadow is created. */ - export interface Slot extends com.zhekasmirnov.innercore.api.mod.ui.container.Slot {} - - /** - * {@inheritDoc UI.UIElement} - */ - export type Element = UIElement; - - /** - * Object containing ui elements with key as the name and value as the - * {@link UI.UIElement} instance to be used. - */ - export type Elements = ( - UICustomElement - | UIButtonElement - | UICloseButtonElement - | UIFrameElement - | UIImageElement - | UIScaleElement - | UIScrollElement - | UISlotElement - | UISwitchElement - | UITabElement - | UITextElement - | UIFPSTextElement - | UIInvSlotElement - ); - - export type DrawingElements = ( - ColorDrawing - | CustomDrawing - | FrameDrawing - | ImageDrawing - | LineDrawing - | TextDrawing - ); - - export interface ElementSet { - [key: string]: Elements; - } - - export type DrawingSet = DrawingElements[]; - - /** - * Object used to handle windows opening and closing events. - */ - export interface WindowEventListener { + interface FontDescription { /** - * Called when the window is opened. - * @param window current {@link UI.Window} object + * Font color, android integer color value (produced by + * {@link android.graphics.Color}). + * @default 0x000 // black */ - onOpen: (window: Window) => void, + color?: number, /** - * Called when the window is closed. - * @param window current {@link UI.Window} object + * Font size. + * @default 20 */ - onClose: (window: Window) => void - } - - /** - * Class representing several windows opened at the same. For example, - * {@link UI.StandardWindow} is a window group that consists of several separate - * windows. - */ - export class WindowGroup extends com.zhekasmirnov.innercore.api.mod.ui.window.UIWindowGroup { - static class: java.lang.Class; - /** - * Constructs new {@link UI.WindowGroup} instance. + size?: number, + /** + * Font shadow offset. + * @default 0 // no shadow */ - constructor(); - } - - /** - * Containers are used to properly manipulate windows and save slots - * contents and windows state between window opens. Every {@link TileEntity} has - * a built-in container that can be accessed as {@link TileEntity.container}. - * @deprecated Client class only. - */ - export class Container extends com.zhekasmirnov.innercore.api.mod.ui.container.Container { - static class: java.lang.Class; - /** - * Creates a new instance of {@link UI.Container}. + shadow?: number, + /** + * Font alignment, one of the {@link UI.Font.ALIGN_DEFAULT}, + * {@link UI.Font.ALIGN_CENTER}, {@link UI.Font.ALIGN_END} constants. */ - constructor(); - /** - * Creates a new instance of {@link UI.Container} and initializes it's parent. - * - * See {@link com.zhekasmirnov.innercore.api.mod.ui.container.Container.setParent UI.Container.setParent} for details. + alignment?: number, + /** + * Same as {@link alignment}. */ - constructor(parent: Nullable | any); - } - - /** - * Represents window of required size that can be opened in container to - * provide any required UI facilities. - */ - export class Window extends com.zhekasmirnov.innercore.api.mod.ui.window.UIWindow { - static class: java.lang.Class; - /** - * Constructs new {@link UI.Window} object with specified bounds. - * @param location object containing window's bounds. Note that the - * bounds change the width of the window, but the full width of the - * window becomes 1000 units. + align?: number, + /** + * If `true`, the font is bold, `false` otherwise. + * @default false */ - constructor(location: com.zhekasmirnov.innercore.api.mod.ui.window.UIWindowLocation); - /** - * Constructs new {@link UI.Window} object with specified content. - * @param content window's content + bold?: boolean, + /** + * If `true`, the font is italic, `false` otherwise. + * @default false */ - constructor(content: WindowContent); - /** - * Constructs new empty {@link UI.Window} object. - */ - constructor(); - } - - /** - * Legacy misspelled standard UI, which is works under classic - * styling, but must be used only in unsupported mods. - * @deprecated In 2.0.4b40, use {@link UI.StandardWindow} instead. - */ - export class StandartWindow extends com.zhekasmirnov.innercore.api.mod.ui.window.UIWindowStandard { - static class: java.lang.Class; - constructor(content: StandardWindowContent); - constructor(); - } - - /** - * Class used to create standard UI for the mod's machines. - * {@link UI.StandardWindow} is a {@link UI.WindowGroup} that has three windows with names - * `"main"`, `"inventory"` and `"header"`. They represent custom window - * contents, player's inventory and window's header respectively. - * @since 2.0.4b40 - */ - export class StandardWindow extends com.zhekasmirnov.innercore.api.mod.ui.window.UIWindowStandard { - static class: java.lang.Class; - /** - * Constructs new {@link UI.StandardWindow} with specified content. - * Content is applied to the main window, header and inventory remain - * the same. - * @param content object containing window description + cursive?: boolean, + /** + * If `true`, the font is underlined, `false` otherwise. + * @default false */ - constructor(content: StandardWindowContent); - /** - * Constructs new empty {@link UI.StandardWindow} object. - */ - constructor(); - } + underline?: boolean + } /** - * {@inheritDoc com.zhekasmirnov.innercore.api.mod.ui.window.UIAdaptiveWindow} + * {@inheritDoc UI.FontDescription} */ - export class AdaptiveWindow extends com.zhekasmirnov.innercore.api.mod.ui.window.UIAdaptiveWindow { - static class: java.lang.Class; - /** - * Constructs new {@link UI.AdaptiveWindow} with specified content. - * @param content object containing window description - */ - constructor(content: WindowContent); - /** - * Constructs a new empty {@link UI.AdaptiveWindow}. - */ - constructor(); - } + type FontParams = FontDescription; /** - * Class used to create windows with multiple tabs. + * Class representing font used in the UI. */ - export class TabbedWindow extends com.zhekasmirnov.innercore.api.mod.ui.window.UITabbedWindow { - static class: java.lang.Class; - /** - * Constructs new {@link UI.TabbedWindow} with specified location. - * @param loc location to be used for the tabbed window - */ - constructor(loc: com.zhekasmirnov.innercore.api.mod.ui.window.UIWindowLocation); - /** - * Constructs new {@link UI.TabbedWindow} with specified content. - * @param content object containing window description + class Font { + /** + * Aligns text to the start of the element (left for English locale). */ - constructor(content: WindowContent); - /** - * Constructs new empty {@link UI.TabbedWindow} object. - */ - constructor(); - } - - /** - * Class representing window's location. All coordinates are defined in - * units (given screen's width is 1000 units). - */ - export class WindowLocation extends com.zhekasmirnov.innercore.api.mod.ui.window.UIWindowLocation { - static class: java.lang.Class; - /** - * Constructs new {@link UI.WindowLocation} instance with default position and - * size (fullscreen window). + static readonly ALIGN_CENTER: number; + /** + * Aligns text to the center of the element. */ - constructor(); - /** - * Constructs new {@link UI.WindowLocation} instance with specified parameters. + static readonly ALIGN_DEFAULT: number; + /** + * Aligns text to the end of the element (right for English locale). */ - constructor(desc: com.zhekasmirnov.innercore.api.mod.ui.window.WindowLocationDescription); - } - - /** - * Class representing static or animated texture. - */ - export class Texture extends com.zhekasmirnov.innercore.api.mod.ui.types.Texture { - static class: java.lang.Class; - } - - /** - * Class representing font used in the UI. - */ - export class Font extends com.zhekasmirnov.innercore.api.mod.ui.types.Font { - static class: java.lang.Class; - constructor(color: number, size: number, shadow: number); - constructor(desc: FontDescription); - } - - /** - * Class used to visualize configuration file contents in a simple way. - */ - export class ConfigVisualizer extends com.zhekasmirnov.innercore.api.mod.util.ConfigVisualizer { - static class: java.lang.Class; + static readonly ALIGN_END: number; + /** + * Aligns text to the center of the element horizontally. + * @since 2.2.1b96 + */ + static readonly ALIGN_CENTER_HORIZONTAL: number; + alignment: number; + color: number; + isBold: boolean; + isCursive: boolean; + isUnderlined: boolean; + shadow: number; + size: number; /** - * Constructs new {@link UI.ConfigVisualizer} instance with specified elements - * names prefix. - * @param config configuration file to be loaded - * @param prefix elements names prefix used for this visualizer + * Constructs new instance of the font with specified parameters. + * @param color font color, android integer color value (produced by + * android.graphics.Color) + * @param size font size + * @param shadow shadow offset */ - constructor(config: com.zhekasmirnov.innercore.mod.build.Config, prefix: string); + constructor(color: number, size: number, shadow: number); /** - * Constructs new {@link UI.ConfigVisualizer} instance with default elements - * names prefix (*config_vis*). - * @param config configuration file to be loaded + * Constructs new instance of the font with specified parameters. + * @param params parameters of the font */ - constructor(config: com.zhekasmirnov.innercore.mod.build.Config); - } - - /** - * Namespace containing method to get {@link com.zhekasmirnov.innercore.api.mod.ui.types.FrameTexture FrameTexture} instances. - */ - export class FrameTextureSource extends java.lang.Object { - static class: java.lang.Class; - /** - * @param name gui texture name of the frame + constructor(params: FontDescription); + /** + * Draws text on the canvas using created font. + * @param canvas {@link android.graphics.Canvas} instance to draw the text on + * @param x x coordinate of the text in pixels + * @param y x coordinate of the text in pixels + * @param text text string to draw + * @param scale additional scale to apply to the text + */ + drawText(canvas: android.graphics.Canvas, x: number, y: number, text: string, scale: number): void; + /** + * Calculates bounds of the text given text position, text string and + * additional scale. + * @returns rect object containing calculated bounds of + * the text */ - static get(name: string): com.zhekasmirnov.innercore.api.mod.ui.types.FrameTexture; - } - - /** - * Namespace containing methods used to get and add gui textures. - */ - export class TextureSource extends java.lang.Object { - static class: java.lang.Class; - /** - * @param name gui texture name - * @returns Bitmap instance with the ui texture, if it - * was loaded, with `"missing_texture"` texture otherwise. + getBounds(text: string, x: number, y: number, scale: number): android.graphics.Rect; + /** + * Calculates text width given text string and additional scale. + * @returns width of the specified string when painted with specified + * scale */ - static get(name: string): android.graphics.Bitmap; - /** - * - * @param name gui texture name - * @returns Bitmap instance with the ui texture, if it - * was loaded, `null` otherwise. + getTextWidth(text: string, scale: number): number; + /** + * Calculates text height given text string and additional scale. + * @returns height of the specified string when painted with specified + * scale */ - static getNullable(name: string): Nullable; - /** - * Adds any bitmap as a gui texture with specified name. - * @param name gui texture name - * @param bitmap {@link android.graphics.Bitmap} instance to be used as - * gui texture + getTextHeight(text: string, x: number, y: number, scale: number): number; + /** + * Converts current {@link Font} object to scriptable font description. */ - static put(name: string, bitmap: android.graphics.Bitmap): void; + asScriptable(): FontDescription; } /** @@ -406,33 +140,33 @@ declare module UI { * depending on specific settings that are in place. * @since 2.3.1b115 */ - export function getMinecraftUiScale(): number; + function getMinecraftUiScale(): number; /** * Defines the size of interface relative to the {@link UI.getMinecraftUiScale}, * with dimensions specified in units used within Inner Core interfaces. * @since 2.3.1b115 */ - export function getRelMinecraftUiScale(): number; + function getRelMinecraftUiScale(): number; /** * Same as {@link UI.getScreenHeight}. */ - export function getScreenRelativeHeight(): number; + function getScreenRelativeHeight(): number; /** * @returns Screen height in units. */ - export function getScreenHeight(): number; + function getScreenHeight(): number; /** * Returns the currently running Android Activity, which can be * used for various actions: opening dialogs, instantiating widgets, * and many other operations with {@link android.content.Context}. + * * @remarks * It is not recommended to use it if it is possible to find * a replacement in the presented Inner Core API. */ - export function getContext(): android.app.Activity; - + function getContext(): android.app.Activity; } diff --git a/core-engine/com/zhekasmirnov/apparatus/api/container/ItemContainer.d.ts b/core-engine/com/zhekasmirnov/apparatus/api/container/ItemContainer.d.ts deleted file mode 100644 index cfe6bbac3..000000000 --- a/core-engine/com/zhekasmirnov/apparatus/api/container/ItemContainer.d.ts +++ /dev/null @@ -1,309 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module apparatus { - export module api { - export module container { - type PrimitiveTypes = string | number | boolean; - type PacketData = {[key: string]: PrimitiveTypes}; - export namespace ItemContainerFuncs { - export interface BindingValidator { - (container: ItemContainer, str: string, obj: any, time: number): any; - } - export interface ClientEventListener { - (container: ItemContainer, window: innercore.api.mod.ui.window.IWindow, scriptable: any, obj: any): void; - } - export interface ClientOnCloseListener { - (container: ItemContainer): void; - } - export interface ClientOnOpenListener { - (container: ItemContainer, str: string): void; - } - export interface DirtySlotListener { - (container: ItemContainer, str: string, slot: ItemContainerSlot): void; - } - export interface ServerEventListener { - (container: ItemContainer, client: NetworkClient, obj: any): void; - } - export interface ServerOnCloseListener { - (container: ItemContainer, client: NetworkClient): void; - } - export interface ServerOnOpenListener { - (container: ItemContainer, client: NetworkClient, screenName: string): void; - } - export interface Transaction { - (container: ItemContainer, str: string): void; - } - export interface TransferPolicy { - (container: ItemContainer, str: string, id: number, count: number, data: number, extra: Nullable, time: number): number; - } - export interface UiScreenFactory { - (container: ItemContainer, screen: string): innercore.api.mod.ui.window.IWindow; - } - } - export class ItemContainer extends java.lang.Object implements innercore.api.mod.recipes.workbench.WorkbenchField { - static class: java.lang.Class; - readonly isServer: boolean; - readonly slots: {[key: string]: ItemContainerSlot}; - readonly transactionLock: any; - static loadClass(): void; - static registerScreenFactory(factoryName: string, factory: ItemContainerFuncs.UiScreenFactory): void; - static addClientEventListener(typeName: string, packetName: string, listener: ItemContainerFuncs.ClientEventListener): void; - static addClientOpenListener(typeName: string, listener: ItemContainerFuncs.ClientOnOpenListener): void; - static addClientCloseListener(typeName: string, listener: ItemContainerFuncs.ClientOnCloseListener): void; - static getClientContainerInstance(name: string): Nullable; - /** - * Constructs a new {@link ItemContainer} object. - */ - constructor(); - /** - * Constructs a new {@link ItemContainer} object from given deprecated - * {@link com.zhekasmirnov.innercore.api.mod.ui.container.Container Container} object. - */ - constructor(legacyContainer: innercore.api.mod.ui.container.Container); - getNetworkEntity(): NetworkEntity; - getNetworkName(): string; - getUiAdapter(): ItemContainerUiHandler; - getWindow(): innercore.api.mod.ui.window.IWindow; - getWindowContent(): innercore.api.mod.ui.window.WindowContent; - removeEntity(): void; - /** - * Sets container's parent object, for {@link TileEntity}'s - * container it should be it reference, otherwise you can pass any - * value to be used in your code later. - * @param parent an object to be set as container's parent - */ - setParent(parent: Nullable | any): void; - /** - * @returns Tile if the following container is part of it, - * and `null` otherwise. - */ - getParent(): Nullable | any; - - setGlobalAddTransferPolicy(policy: ItemContainerFuncs.TransferPolicy): ItemContainer; - setGlobalGetTransferPolicy(policy: ItemContainerFuncs.TransferPolicy): ItemContainer; - setSlotAddTransferPolicy(slotName: string, policy: ItemContainerFuncs.TransferPolicy): ItemContainer; - setSlotGetTransferPolicy(slotName: string, policy: ItemContainerFuncs.TransferPolicy): ItemContainer; - setGlobalDirtySlotListener(listener: ItemContainerFuncs.DirtySlotListener): ItemContainer; - setDirtySlotListener(listener: ItemContainerFuncs.DirtySlotListener): void; - sealSlot(slotName: string): void; - sealAllSlots(): void; - getAddTransferPolicy(slot: string): ItemContainerFuncs.TransferPolicy; - getGetTransferPolicy(slot: string): ItemContainerFuncs.TransferPolicy; - setGlobalBindingValidator(validator: ItemContainerFuncs.BindingValidator): void; - setBindingValidator(composedBindingName: string, validator: ItemContainerFuncs.BindingValidator): void; - getBindingValidator(composedBindingName: string): ItemContainerFuncs.BindingValidator; - runTransaction(transaction: ItemContainerFuncs.Transaction): void; - /** - * Gets the slot by it's name. If a slot with specified name doesn't - * exists, creates an empty one with specified name. - * @param name slot name - * @returns Contents of the slot in a {@link ItemContainerSlot} object. - * You can modify it to change the contents of the slot. - */ - getSlot(name: string): ItemContainerSlot; - /** - * @deprecated Use {@link com.zhekasmirnov.apparatus.api.container.ItemContainer.getSlot getSlot} instead. - */ - getFullSlot(name: string): ItemContainerSlot; - markSlotDirty(name: string): void; - markAllSlotsDirty(): void; - /** - * Sets slot's content by it's name from given slot object. If a slot with specified - * name doesn't exist, a new slot with specified name and item will be created. - * @param name slot name - * @param slot {@link com.zhekasmirnov.apparatus.api.container.ItemContainerSlot ItemContainerSlot} object to specify slot contents - */ - setSlot(name: string, slot: ItemContainerSlot): void; - /** - * Set slot's content by it's name. If a slot with specified name doesn't - * exists, creates new with specified name and item. - * @param name slot name - */ - setSlot(name: string, id: number, count: number, data: number): void; - /** - * Set slot's content by it's name. If a slot with specified name doesn't - * exists, creates new with specified name and item. - * @param name slot name - * @param extra item extra data - */ - setSlot(name: string, id: number, count: number, data: number, extra: Nullable): void; - addToSlot(name: string, id: number, count: number, data: number, extra: Nullable, player: number): number; - getFromSlot(name: string, id: number, count: number, data: number, extra: Nullable, player: number): number; - /** - * Sends changes in container to all clients. - * Needs to be used every time when something changes in container. - */ - sendChanges(): void; - dropAt(region: BlockSource, x: number, y: number, z: number): void; - /** - * Validates all the slots in the container. - */ - validateAll(): void; - /** - * Validates slot contents. If the data value is less then 0, it becomes - * 0, if ID is 0 or count is less then or equals to zero, slot is reset - * to an empty one. - * @param name slot name - */ - validateSlot(name: string): void; - /** - * Clears slot's contents. - * @param name slot name - */ - clearSlot(name: string): void; - /** - * Drops slot's contents on the specified coordinates and clears the - * slot. - * @param name slot name - */ - dropSlot(region: BlockSource, name: string, x: number, y: number, z: number): void; - /** - * Sends event to move specified amount of items from the player inventory slot by given index - * to container slot by given name. This event is sent from client to server, - * so you should use it only on the client side, for example, in custom slot element touch events, etc. - * @param inventorySlot numeric index of the inventory slot, from where to retrieve the item - * @param slotName string name of the container slot, where to put taken item - * @param amount item count to be retrieved from inventory slot - */ - sendInventoryToSlotTransaction(inventorySlot: number, slotName: string, amount: number): void; - handleInventoryToSlotTransaction(player: number, inventorySlot: number, slotName: string, amount: number): void; - /** - * Sends event to move specified amount of items from one container slot to another by given names. - * This event is sent from client to server, so you should use it only on the client side, - * for example, in custom slot element touch events, etc. - * @param slot1 string name of the container slot, from where to retrieve item - * @param slot2 string name of the container slot, where to put taken item - * @param amount item count to be retrieved from container slot - */ - sendSlotToSlotTransaction(slot1: string, slot2: string, amount: number): void; - handleSlotToSlotTransaction(player: number, slot1: string, slot2: string, amount: number): void; - /** - * Sends event to move specified amount of items from the container slot by given name - * to player's inventory. The index of the inventory slot, where to put item, can't be specified, - * because it's decided by {@link ItemContainer} automatically, and you just don't need to do this. - * This event is sent from client to server, so you should use it only on the client side, - * for example, in custom slot element touch events, etc. - * @param slot string name of the container slot, from where to retrieve item - * @param amount item count to be retrieved from container slot - */ - sendSlotToInventoryTransaction(slot: string, amount: number): void; - handleSlotToInventoryTransaction(player: number, slotName: string, inventorySlot: number, amount: number): void; - sendDirtyClientBinding(key: string, value: PrimitiveTypes): void; - handleDirtyBindingsPacket(client: NetworkClient, packet: org.json.JSONObject): void; - setBinding(composedBindingName: string, value: PrimitiveTypes): void; - setClientBinding(composedBindingName: string, value: PrimitiveTypes): void; - getBinding(composedBindingName: string): PrimitiveTypes; - setBinding(elementName: string, bindingName: string, value: PrimitiveTypes): void; - setClientBinding(elementName: string, bindingName: string, value: PrimitiveTypes): void; - getBinding(elementName: string, bindingName: string): PrimitiveTypes; - /** - * Sets "value" binding value for the element. Used to set scales values. - * @param elementName element name - * @param value value to be set for the element - */ - setScale(elementName: string, value: number): void; - setClientScale(elementName: string, value: number): void; - /** - * @param elementName element name - * @returns Value with "value" binding, e.g. scale value, or `null` if no - * element with specified name exist. - */ - getValue(elementName: string, value: number): Nullable; - /** - * Sets "text" binding value for the element. Used to set element's text. - * @param elementName element name - * @param text value to be set for the element - */ - setText(elementName: string, text: string | number): void; - setClientText(elementName: string, text: string): void; - /** - * @param elementName element name - * @returns Value "text" binding, usually the text displayed on the - * element, or `null` if no element with specified name exist. - */ - getText(elementName: string): Nullable; - setClientContainerTypeName(type: string): void; - getClientContainerTypeName(): string; - addServerEventListener(name: string, listener: ItemContainerFuncs.ServerEventListener): void; - addServerOpenListener(listener: ItemContainerFuncs.ServerOnOpenListener): void; - addServerCloseListener(listener: ItemContainerFuncs.ServerOnCloseListener): void; - /** - * Sends packet from client container copy to server. - */ - sendEvent(name: string, data: PacketData | string): void; - /** - * Sends packet from server container copy to client. - */ - sendEvent(client: NetworkClient, name: string, data: PacketData | string): void; - /** - * Sends packet from server container. - * @remarks - * Available only in server container events! - */ - sendResponseEvent(name: string, data: PacketData | string): void; - /** - * Opens UI for client. - * @param client client in which UI will be open - * @param screenName name of the screen to open - */ - openFor(client: NetworkClient, screenName: string): void; - /** - * Closes UI for client. - * @param client client in which UI will be open - */ - closeFor(client: NetworkClient): void; - /** - * Closes UI for all clients - */ - close(): void; - sendClosed(): void; - /** - * @since 2.2.0b82 - */ - setGlobalSlotSavingEnabled(enabled: boolean): void; - /** - * @since 2.2.0b82 - */ - isGlobalSlotSavingEnabled(): boolean; - /** - * @since 2.2.0b82 - */ - setSlotSavingEnabled(name: string, enabled: boolean): void; - /** - * @since 2.2.0b82 - */ - resetSlotSavingEnabled(name: string): void; - /** - * @since 2.2.0b82 - */ - isSlotSavingEnabled(name: string): boolean; - /** - * @returns `false` if container supports multiplayer, `true` otherwise. - */ - isLegacyContainer(): false; - /** - * @since 2.2.0b82 - */ - asLegacyContainer(allSlots: boolean): innercore.api.mod.ui.container.Container; - asLegacyContainer(): innercore.api.mod.ui.container.Container; - setWorkbenchFieldPrefix(prefix: string): void; - /** - * @since 2.2.1b106 - */ - setWorkbenchFieldSize(workbenchFieldSize: number): void; - getFieldSlot(index: number): innercore.api.mod.ui.container.AbstractSlot; - /** - * @since 2.2.1b108 - */ - getFieldSlot(x: number, y: number): innercore.api.mod.ui.container.AbstractSlot; - asScriptableField(): innercore.api.mod.ui.container.AbstractSlot[]; - /** - * @since 2.2.1b106 - */ - getWorkbenchFieldSize(): number; - } - } - } - } - } -} diff --git a/core-engine/com/zhekasmirnov/apparatus/api/container/ItemContainerSlot.d.ts b/core-engine/com/zhekasmirnov/apparatus/api/container/ItemContainerSlot.d.ts deleted file mode 100644 index d17e05424..000000000 --- a/core-engine/com/zhekasmirnov/apparatus/api/container/ItemContainerSlot.d.ts +++ /dev/null @@ -1,94 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module apparatus { - export module api { - export module container { - export class ItemContainerSlot extends java.lang.Object implements innercore.api.mod.ui.container.AbstractSlot { - static class: java.lang.Class; - count: number; - data: number; - extra: Nullable; - id: number; - constructor(id: number, count: number, data: number); - constructor(id: number, count: number, data: number, extra: Nullable); - constructor(); - constructor(item: ItemInstance); - constructor(json: org.json.JSONObject, convert: boolean); - /** - * @returns Slot name. - */ - getName(): string; - /** - * @returns Container linked to the slot. - */ - getContainer(): ItemContainer; - /** - * @returns Following {@link ItemContainerSlot} as {@link ItemInstance} object. - */ - asScriptable(): ItemInstance; - /** - * @returns Following {@link ItemContainerSlot} as {@link org.json.JSONObject} instance. - */ - asJson(): org.json.JSONObject; - /** - * @returns Whether the slot is empty or not. - */ - isEmpty(): boolean; - /** - * Refreshes slot in UI. - */ - markDirty(): void; - /** - * Clears slot contents. - */ - clear(): void; - /** - * Resets slot if it's ID or count equals `0`. - */ - validate(): void; - /** - * Drops slot contents in given world at given coords. - */ - dropAt(region: BlockSource, x: number, y: number, z: number): void; - /** - * Sets slot contents. - */ - setSlot(id: number, count: number, data: number): void; - setSlot(id: number, count: number, data: number, extra: Nullable): void; - /** - * @since 2.2.0b82 - */ - resetSavingEnabled(): void; - /** - * @since 2.2.0b82 - */ - setSavingEnabled(enabled: boolean): void; - /** - * @since 2.2.0b82 - */ - isSavingEnabled(): boolean; - /** - * @returns Numeric ID of the item in slot. - */ - getId(): number; - /** - * @returns Count of the item in slot. - */ - getCount(): number; - /** - * @returns Data of the item in slot. - */ - getData(): number; - /** - * @returns Extra data object of the item in slot, - * or `null` if it is not present in the given item. - */ - getExtra(): Nullable; - set(id: number, count: number, data: number, extra: Nullable): void; - toString(): string; - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/apparatus/api/container/ItemContainerUiHandler.d.ts b/core-engine/com/zhekasmirnov/apparatus/api/container/ItemContainerUiHandler.d.ts deleted file mode 100644 index c592e8044..000000000 --- a/core-engine/com/zhekasmirnov/apparatus/api/container/ItemContainerUiHandler.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module apparatus { - export module api { - export module container { - export class ItemContainerUiHandler extends java.lang.Object implements innercore.api.mod.ui.container.UiAbstractContainer { - static class: java.lang.Class; - constructor(container: ItemContainer); - onWindowClosed(): void; - getWindow(): innercore.api.mod.ui.window.IWindow; - openAs(window: innercore.api.mod.ui.window.IWindow): void; - close(): void; - getParent(): ItemContainer; - addElementInstance(element: innercore.api.mod.ui.elements.UIElement, name: string): void; - getElement(elementName: string): Nullable; - getSlotVisualImpl(name: string): innercore.api.mod.ui.container.UiVisualSlotImpl; - getBinding(elementName: string, bindingName: string): T; - setBinding(elementName: string, bindingName: string, value: T): void; - handleBindingDirty(elementName: string, bindingName: string): void; - applyAllBindingsFromMap(): void; - setBindingByComposedName(name: string, value: PrimitiveTypes): void; - receiveBindingsFromServer(bindings: org.json.JSONObject): void; - handleInventoryToSlotTransaction(inventorySlot: number, slot: string, amount: number): void; - handleSlotToSlotTransaction(from: string, to: string, amount: number): void; - handleSlotToInventoryTransaction(slot: string, amount: number): void; - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/ExecutionDirectory.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/ExecutionDirectory.d.ts deleted file mode 100644 index 6b42b54ed..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/ExecutionDirectory.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export class ExecutionDirectory extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - readonly directory: globalThis.java.io.File; - readonly isPackDriven: boolean; - constructor(dir: globalThis.java.io.File, isPackDriven: boolean); - addLibraryDirectory(lib: library.LibraryDirectory): void; - getLibByName(name: string): Nullable; - addJavaDirectory(directory: java.JavaDirectory): void; - build(context: android.content.Context, logger: runtime.logger.EventLogger): LaunchSequence; - clear(): void; - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/LaunchSequence.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/LaunchSequence.d.ts deleted file mode 100644 index 280ef94ca..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/LaunchSequence.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export class LaunchSequence extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - constructor(dir: ExecutionDirectory, libraries: globalThis.java.util.List, javaLibraries: globalThis.java.util.List); - buildSequence(logger: runtime.logger.EventLogger): void; - loadAll(logger: runtime.logger.EventLogger): void; - getAllLibraries(): globalThis.java.util.List; - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/ModContext.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/ModContext.d.ts deleted file mode 100644 index 0e4ee5301..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/ModContext.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export class ModContext extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - readonly context: android.content.Context; - readonly resourceManager: resource.ResourceManager; - readonly executionDirectory: ExecutionDirectory; - getActivityContext(): android.content.Context; - getResourceManager(): resource.ResourceManager; - getExecutionDirectory(): ExecutionDirectory; - getActiveMods(): globalThis.java.util.List; - getDisabledMods(): globalThis.java.util.List; - getEventLogger(): runtime.logger.EventLogger; - clearContext(): void; - clearModsAndContext(): void; - addMod(mod: mod.Mod): void; - addMods(mods: globalThis.java.util.Collection): void; - injectAll(): void; - buildAll(): void; - initializeAll(): void; - launchAll(): void; - constructor(context: android.content.Context, resman: resource.ResourceManager, exdir: ExecutionDirectory); - addEventReceiver(event: string, receiver: ModContext.EventReceiver | ((...mods: mod.Mod[]) => void)): void; - } - export module ModContext { - export class EventReceiver extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - onEvent(...mods: mod.Mod[]): void; - constructor(); - constructor(impl: { - onEvent: (...mods: mod.Mod[]) => void; - }); - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/configuration/Configuration.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/configuration/Configuration.d.ts deleted file mode 100644 index e96240a3a..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/configuration/Configuration.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export module configuration { - export abstract class Configuration extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - abstract refresh(): void; - abstract get(key: string, clazz: globalThis.java.lang.Class): T; - abstract get(key: string): any; - abstract set(key: string, value: any): boolean; - abstract delete(key: string): any; - abstract isContainer(key: string): boolean; - abstract getChild(key: string): Configuration; - abstract isReadOnly(): boolean; - abstract save(): void; - abstract load(): void; - getInt(key: string): number; - getFloat(key: string): number; - getDouble(key: string): number; - getLong(key: string): number; - getString(key: string): Nullable; - getBoolean(key: string): boolean; - getArray(key: string): Nullable>; - checkAndRestore(json: org.json.JSONObject): void; - checkAndRestore(json: string): void; - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/java/JavaDirectory.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/java/JavaDirectory.d.ts deleted file mode 100644 index ac7678224..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/java/JavaDirectory.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export module java { - export class JavaDirectory extends globalThis.java.lang.Object { - readonly mod: mod.Mod; - readonly directory: globalThis.java.io.File; - readonly manifest: JavaLibraryManifest; - constructor(mod: mod.Mod, dir: globalThis.java.io.File); - getName(): string; - getSubDirectory(path: string, createIfRequired: boolean): globalThis.java.io.File; - getDestinationDirectory(): globalThis.java.io.File; - getJarDirectory(): globalThis.java.io.File; - getBuildDexFile(): globalThis.java.io.File; - getCompiledDexFile(): globalThis.java.io.File; - getSourceDirectories(): string; - getLibraryPaths(bootPaths: globalThis.java.util.List): string; - getArguments(): string[]; - isVerboseRequired(): boolean; - getAllSourceFiles(): string[]; - getBootClassNames(): globalThis.java.util.List; - addToExecutionDirectory(exdir: ExecutionDirectory, context: android.content.Context): JavaLibrary; - compileToClassesFile(context: android.content.Context): void; - getCompiledClassesFile(): globalThis.java.io.File; - getCompiledClassesFiles(): globalThis.java.util.List; - isInDevMode(): boolean; - setPreCompiled(prec: boolean): void; - isPreCompiled(): boolean; - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/java/JavaLibrary.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/java/JavaLibrary.d.ts deleted file mode 100644 index 372070567..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/java/JavaLibrary.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export module java { - export class JavaLibrary extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - constructor(dir: JavaDirectory, dexFile: globalThis.java.io.File); - constructor(dir: JavaDirectory, dexFiles: globalThis.java.util.List); - getDirectory(): JavaDirectory; - getDexFiles(): globalThis.java.util.List; - isInitialized(): boolean; - initialize(): void; - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/java/JavaLibraryManifest.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/java/JavaLibraryManifest.d.ts deleted file mode 100644 index d52faa650..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/java/JavaLibraryManifest.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export module java { - export class JavaLibraryManifest extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - readonly arguments: string[]; - readonly verbose: boolean; - readonly sourceDirs: globalThis.java.util.List; - readonly libraryDirs: globalThis.java.util.List; - readonly libraryPaths: globalThis.java.util.List; - readonly bootClasses: globalThis.java.util.List; - constructor(file: globalThis.java.io.File); - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/library/Library.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/library/Library.d.ts deleted file mode 100644 index 6ece75c2d..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/library/Library.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export module library { - export class Library extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - static load(path: string): Library; - getResult(): number; - refreshModuleList(): void; - getModules(): globalThis.java.util.List; - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/library/LibraryDirectory.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/library/LibraryDirectory.d.ts deleted file mode 100644 index 5b0702499..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/library/LibraryDirectory.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export module library { - export class LibraryDirectory extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - readonly directory: globalThis.java.io.File; - readonly manifest: LibraryManifest; - readonly makeFile: LibraryMakeFile; - readonly soFile: globalThis.java.io.File; - constructor(mod: mod.Mod, directory: globalThis.java.io.File); - constructor(directory: globalThis.java.io.File); - isInDevMode(): boolean; - isPreCompiled(): boolean; - isSharedLibrary(): boolean; - getVersionCode(): number; - getName(): string; - getSoFileName(): string; - getIncludeDirs(): globalThis.java.util.List; - getDependencyNames(): globalThis.java.util.List; - getExecutableFile(): globalThis.java.io.File; - getLibrary(): Library; - compileToTargetFile(directory: ExecutionDirectory, context: android.content.Context, target: globalThis.java.io.File): void; - setPreCompiled(pre: boolean): void; - addToExecutionDirectory(dir: ExecutionDirectory, context: android.content.Context, target: globalThis.java.io.File): void; - loadExecutableFile(): void; - hashCode(): number; - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/library/LibraryMakeFile.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/library/LibraryMakeFile.d.ts deleted file mode 100644 index fad99215d..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/library/LibraryMakeFile.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export module library { - export class LibraryMakeFile extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - constructor(file: globalThis.java.io.File); - getCppFlags(): string; - getFiles(): globalThis.java.util.List; - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/library/LibraryManifest.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/library/LibraryManifest.d.ts deleted file mode 100644 index ce7868f26..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/library/LibraryManifest.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export module library { - export class LibraryManifest extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - constructor(file: globalThis.java.io.File); - getFile(): globalThis.java.io.File; - getName(): string; - getSoName(): string; - getVersion(): number; - getDependencies(): globalThis.java.util.List; - getInclude(): globalThis.java.util.List; - isSharedLibrary(): boolean; - isShared(): boolean; - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/mod/Mod.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/mod/Mod.d.ts deleted file mode 100644 index 2b01a31d2..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/mod/Mod.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export module mod { - export class Mod extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - readonly directory: globalThis.java.io.File; - readonly manifest: ModManifest; - readonly libraries: globalThis.java.util.List; - readonly resources: globalThis.java.util.List; - readonly java: globalThis.java.util.List; - readonly modules: globalThis.java.util.List; - readonly modInstances: globalThis.java.util.List; - readonly subModLocations: globalThis.java.util.List; - constructor(ctx: ModContext, dir: globalThis.java.io.File); - inject(): void; - initialize(): void; - toString(): string; - getDisplayedName(): string; - getConfigurationInterface(): Mod.ConfigurationInterface; - getDeveloperInterface(): Mod.DeveloperInterface; - getSafetyInterface(): Mod.SafetyInterface; - getGraphics(): ModGraphics; - } - export module Mod { - export class ConfigurationInterface extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - configuration: configuration.Configuration; - constructor(); - isActive(): boolean; - setActive(active: boolean): void; - } - export class DeveloperInterface extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - toProductionMode(logger: runtime.logger.EventLogger): void; - toDeveloperMode(): void; - toProductModeUiProtocol(): boolean; - anyForDeveloperModeTransfer(): boolean; - anyForProductionModeTransfer(): boolean; - } - export class SafetyInterface extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - static readonly CRASH_LOCK = ".crash-lock"; - static readonly CRASH_DISABLED_LOCK = ".crash-disabled-lock"; - getLock(name: string): boolean; - setLock(name: string, exists: boolean): boolean; - beginUnsafeSection(): boolean; - endUnsafeSection(): boolean; - isInUnsafeSection(): boolean; - isCrashRegistered(): boolean; - removeCrashLock(): boolean; - isDisabledDueToCrash(): boolean; - setDisabledDueToCrash(disabled: boolean): boolean; - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/mod/ModGraphics.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/mod/ModGraphics.d.ts deleted file mode 100644 index 352b8a9ee..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/mod/ModGraphics.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export module mod { - export class ModGraphics extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - constructor(); - constructor(dir: globalThis.java.io.File); - getNamedGroup(name: string): globalThis.java.util.HashMap; - getGroup(name: string): globalThis.java.util.Collection; - getAllBitmaps(): globalThis.java.util.List; - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/mod/ModInstance.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/mod/ModInstance.d.ts deleted file mode 100644 index 58a4c0e41..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/mod/ModInstance.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export module mod { - export class ModInstance extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - constructor(module: Module); - getModule(): Module; - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/mod/ModManifest.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/mod/ModManifest.d.ts deleted file mode 100644 index 720ec21d2..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/mod/ModManifest.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export module mod { - export class ModManifest extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - constructor(file: globalThis.java.io.File); - getParentDirectory(): globalThis.java.io.File; - getDirectories(): globalThis.java.util.List; - getModules(): globalThis.java.util.List; - getMainModule(): ModManifest.Module; - getName(): string; - } - export module ModManifest { - export class DirectoryType extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - static readonly LIBRARY: DirectoryType; - static readonly RESOURCE: DirectoryType; - static readonly SUBMOD: DirectoryType; - static readonly JAVA: DirectoryType; - static byName(name: string): DirectoryType; - } - export class Directory extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - readonly file: globalThis.java.io.File; - readonly type: DirectoryType; - constructor(file: globalThis.java.io.File, type: DirectoryType); - constructor(json: org.json.JSONObject); - asModLocation(): repo.location.ModLocation; - } - export class Module extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - readonly nameId: string; - readonly name: string; - readonly author: string; - readonly description: string; - readonly versionName: string; - readonly versionCode: number; - constructor(nameId: string, json: org.json.JSONObject); - getDisplayedDescription(): string; - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/mod/Module.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/mod/Module.d.ts deleted file mode 100644 index d5e4b3370..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/mod/Module.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export module mod { - export class Module extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - static getInstance(handle: number): Module; - getParent(): Module; - getNameID(): string; - getType(): string; - isInitialized(): boolean; - onEvent(event: string): void; - isMod(): boolean; - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/repo/location/ModLocation.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/repo/location/ModLocation.d.ts deleted file mode 100644 index f7f449c66..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/repo/location/ModLocation.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export module repo { - export module location { - export class ModLocation extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - initializeInLocalStorage(temporaryStorage: storage.TemporaryStorage, logger: runtime.logger.EventLogger): globalThis.java.io.File; - constructor(); - constructor(impl: { - initializeInLocalStorage: (temporaryStorage: storage.TemporaryStorage, logger: runtime.logger.EventLogger) => globalThis.java.io.File; - }); - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/repo/storage/TemporaryStorage.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/repo/storage/TemporaryStorage.d.ts deleted file mode 100644 index d52461a29..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/repo/storage/TemporaryStorage.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export module repo { - export module storage { - export class TemporaryStorage extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - constructor(dir: globalThis.java.io.File); - allocate(key: string): globalThis.java.io.File; - recycle(key: string): boolean; - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/resource/ResourceManager.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/resource/ResourceManager.d.ts deleted file mode 100644 index 1c18c6bc7..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/resource/ResourceManager.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export module resource { - export class ResourceManager extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - readonly context: android.content.Context; - readonly runtimeDir: runtime.RuntimeResourceDirectory; - constructor(ctx: android.content.Context); - getAssets(): android.content.res.AssetManager; - addResourcePrefixes(...prefixes: string[]): void; - getResourceOverridePrefixes(): globalThis.java.util.List; - addResourceProcessor(processor: processor.ResourceProcessor): void; - addRuntimeResourceHandler(handler: runtime.RuntimeResourceHandler): void; - addResourceDirectory(directory: directory.ResourceDirectory): void; - clear(): void; - getProcessedResources(resources: globalThis.java.util.List): globalThis.java.util.List; - getResource(path: string): globalThis.java.util.List; - addResourcePath(path: string): void; - deployAllOverrides(): void; - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/resource/ResourceOverride.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/resource/ResourceOverride.d.ts deleted file mode 100644 index 40c7c5cfd..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/resource/ResourceOverride.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export module resource { - export class ResourceOverride extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - readonly path: string; - readonly override: string; - constructor(path: string, override: string); - constructor(path: string, override: globalThis.java.io.File); - constructor(resource: directory.Resource, override: string); - constructor(resource: directory.Resource, override: globalThis.java.io.File); - constructor(resource: directory.Resource); - isActive(): boolean; - deploy(): boolean; - deploy(prefixes: globalThis.java.util.List): boolean; - deploy(prefixes: string[]): boolean; - remove(): boolean; - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/resource/directory/Resource.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/resource/directory/Resource.d.ts deleted file mode 100644 index 6d1a1e2ea..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/resource/directory/Resource.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export module resource { - export module directory { - export class Resource extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - static readonly DEFAULT_RESOURCE_PACK = "resource_packs/vanilla/"; - static readonly RESOURCE_INDEX_SEPARATOR = "_"; - readonly directory: ResourceDirectory; - readonly file: globalThis.java.io.File; - constructor(dir: ResourceDirectory, file: globalThis.java.io.File, path: string); - constructor(dir: ResourceDirectory, file: globalThis.java.io.File); - getPath(): string; - getPathWithIndex(): string; - getRealPath(): string; - getPathWithoutExtension(): string; - getAtlasPath(): string; - getName(): string; - getNameWithoutExtension(): string; - getNameWithIndex(): string; - getRealName(): string; - hasIndex(): boolean; - getIndex(): number; - getExtension(): string; - getMeta(): ResourceMeta; - getLink(path: string): Resource; - addOverrides(overrides: globalThis.java.util.List): void; - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/resource/directory/ResourceDirectory.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/resource/directory/ResourceDirectory.d.ts deleted file mode 100644 index 4b5a97520..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/resource/directory/ResourceDirectory.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export module resource { - export module directory { - export class ResourceDirectory extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - readonly manager: ResourceManager; - readonly runtimeDir: runtime.RuntimeResourceDirectory; - readonly mod: mod.Mod; - readonly directory: globalThis.java.io.File; - constructor(manager: ResourceManager, mod: mod.Mod, directory: globalThis.java.io.File); - constructor(manager: ResourceManager, directory: globalThis.java.io.File); - equals(obj: globalThis.java.lang.Object): boolean; - initialize(): void; - getResourceName(file: globalThis.java.io.File): string; - getResource(path: string): globalThis.java.util.List; - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/resource/directory/ResourceMeta.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/resource/directory/ResourceMeta.d.ts deleted file mode 100644 index db400a035..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/resource/directory/ResourceMeta.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export module resource { - export module directory { - export class ResourceMeta extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - readonly file: globalThis.java.io.File; - constructor(file: globalThis.java.io.File); - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/resource/processor/ResourceProcessor.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/resource/processor/ResourceProcessor.d.ts deleted file mode 100644 index 8789c0403..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/resource/processor/ResourceProcessor.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export module resource { - export module processor { - export class ResourceProcessor extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - initialize(manager: ResourceManager): void; - process(resource: directory.Resource, resources: globalThis.java.util.Collection): void; - constructor(); - constructor(impl: { - initialize: (manager: ResourceManager) => void; - process: (resource: directory.Resource, resources: globalThis.java.util.Collection) => void; - }); - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/resource/runtime/RuntimeResource.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/resource/runtime/RuntimeResource.d.ts deleted file mode 100644 index 9c478fb6d..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/resource/runtime/RuntimeResource.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export module resource { - export module runtime { - export class RuntimeResource extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - constructor(directory: RuntimeResourceDirectory, override: ResourceOverride, name: string); - getOverride(): ResourceOverride; - getDirectory(): RuntimeResourceDirectory; - getName(): string; - getFile(): globalThis.java.io.File; - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/resource/runtime/RuntimeResourceDirectory.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/resource/runtime/RuntimeResourceDirectory.d.ts deleted file mode 100644 index 56a2d239e..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/resource/runtime/RuntimeResourceDirectory.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export module resource { - export module runtime { - export class RuntimeResourceDirectory extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - readonly resourceManager: ResourceManager; - readonly directory: globalThis.java.io.File; - constructor(manager: ResourceManager, dir: globalThis.java.io.File); - clear(): void; - addHandler(handler: RuntimeResourceHandler): void; - handleAll(): void; - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/modloader/resource/runtime/RuntimeResourceHandler.d.ts b/core-engine/com/zhekasmirnov/horizon/modloader/resource/runtime/RuntimeResourceHandler.d.ts deleted file mode 100644 index d83fe0f82..000000000 --- a/core-engine/com/zhekasmirnov/horizon/modloader/resource/runtime/RuntimeResourceHandler.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module modloader { - export module resource { - export module runtime { - export class RuntimeResourceHandler extends globalThis.java.lang.Object { - static class: globalThis.java.lang.Class; - getResourceName(): string; - getResourcePath(): string; - handle(res: RuntimeResource): void; - constructor(); - constructor(impl: { - getResourceName: () => string; - getResourcePath: () => string; - handle: (res: RuntimeResource) => void; - }); - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/horizon/runtime/logger/EventLogger.d.ts b/core-engine/com/zhekasmirnov/horizon/runtime/logger/EventLogger.d.ts deleted file mode 100644 index 0bf0af470..000000000 --- a/core-engine/com/zhekasmirnov/horizon/runtime/logger/EventLogger.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module horizon { - export module runtime { - export module logger { - export class EventLogger extends java.lang.Object { - static class: java.lang.Class; - getMessages(filter: EventLogger.Filter): java.util.List; - constructor(); - section(section: string): void; - debug(tag: string, message: string): void; - info(tag: string, message: string): void; - fault(tag: string, message: string, error: java.lang.Throwable): void; - fault(tag: string, message: string): void; - getStream(type: EventLogger.MessageType, tag: string): java.io.OutputStream; - clear(): void; - } - export module EventLogger { - export class MessageType extends java.lang.Object { - static class: java.lang.Class; - static readonly DEBUG: MessageType; - static readonly INFO: MessageType; - static readonly FAULT: MessageType; - static readonly EXCEPTION: MessageType; - static readonly STACKTRACE: MessageType; - } - export class Message extends java.lang.Object { - static class: java.lang.Class; - readonly type: java.lang.Object; - readonly tag: string; - readonly message: string; - readonly section: string; - } - export class Filter extends java.lang.Object { - static class: java.lang.Class; - filter(message: Message): boolean; - constructor(); - constructor(impl: { - filter: (message: Message) => boolean - }); - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/NativeItemInstanceExtra.d.ts b/core-engine/com/zhekasmirnov/innercore/api/NativeItemInstanceExtra.d.ts deleted file mode 100644 index eb567d237..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/NativeItemInstanceExtra.d.ts +++ /dev/null @@ -1,202 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - /** - * Class representing item extra data. Used to store additional information - * about item other then just item ID and data. - */ - export class NativeItemInstanceExtra extends java.lang.Object { - static class: java.lang.Class; - static constructClone(pointer: number): number; - static initSaverId(): void; - isFinalizableInstance(): boolean; - /** - * Creates an {@link com.zhekasmirnov.innercore.api.NativeItemInstanceExtra NativeItemInstanceExtra} Java object instance - * from given native item extra data object pointer, - * represented as 64-bit integer (long). - */ - constructor(pointer: number); - /** - * Creates an empty {@link com.zhekasmirnov.innercore.api.NativeItemInstanceExtra NativeItemInstanceExtra} instance. - */ - constructor(); - /** - * Creates a new {@link com.zhekasmirnov.innercore.api.NativeItemInstanceExtra NativeItemInstanceExtra} instance - * and copies all data from another extra object given. - */ - constructor(other: NativeItemInstanceExtra); - - asJson(): org.json.JSONObject; - /** - * Creates a copy of current {@link com.zhekasmirnov.innercore.api.NativeItemInstanceExtra NativeItemInstanceExtra} object. - * @returns A created copy of the data. - */ - copy(): NativeItemInstanceExtra; - getValue(): number; - /** - * @returns `true`, if item extra exists and is not empty. - */ - isEmpty(): boolean; - applyTo(item: ItemInstance): void; - /** - * @returns `true` if the item is enchanted, `false` otherwise. - */ - isEnchanted(): boolean; - /** - * Adds a new enchantment to the item. - * @param type enchantment ID, one of the {@link EEnchantment} constants - * @param level enchantment level, generally between 1 and 5 - */ - addEnchant(type: number, level: number): void; - /** - * @param type enchantment ID, one of the {@link EEnchantment} constants - * @returns Level of the specified enchantment. - */ - getEnchantLevel(type: number): number; - /** - * Removes enchantments by it's ID. - * @param type enchantment ID, one of the {@link EEnchantment} constants - */ - removeEnchant(type: number): void; - /** - * Removes all the enchantments of the item. - */ - removeAllEnchants(): void; - /** - * @returns Amount of enchantments applied to the item. - */ - getEnchantCount(): number; - /** - * @param id enchantment ID, one of the {@link EEnchantment} constants - * @param level enchantment level, generally between 1 and 5 - * @returns Enchantment name by it's ID and level. - * @since 2.2.1b94 (not worked before) - */ - getEnchantName(id: number, level: number): string; - getRawEnchants(): number[][]; - getEnchants(): {[id: number]: number}; - /** - * @returns All enchantments names separated by line breaks. - */ - getAllEnchantNames(): string; - getAllCustomData(): string; - setAllCustomData(data: string): void; - /** - * @returns Item's custom name. - */ - getCustomName(): string; - /** - * Sets item's custom name. - */ - setCustomName(name: string): void; - /** - * @returns Compound tag for the specified item. - * @since 2.0.5b44 - */ - getCompoundTag(): Nullable; - /** - * Sets compound tag for the specified item. - * @since 2.0.5b44 - */ - setCompoundTag(ent: number, tag: NBT.CompoundTag): void; - /** - * @returns Reference to itself to be used in sequential calls. - */ - putObject(name: string, value: java.lang.Object): NativeItemInstanceExtra; - /** - * Puts some custom string parameter to the extra data of the item. - * @param name parameter name - * @param value parameter value - * @returns Reference to itself to be used in sequential calls. - */ - putString(name: string, value: string): NativeItemInstanceExtra; - /** - * Puts some custom integer parameter to the extra data of the item. - * @param name parameter name - * @param int parameter value - * @returns Reference to itself to be used in sequential calls. - */ - putInt(name: string, int: number): NativeItemInstanceExtra; - /** - * Puts some custom long integer parameter to the extra data of the item. - * @param name parameter name - * @param long parameter value - * @returns Reference to itself to be used in sequential calls. - */ - putLong(name: string, long: number): NativeItemInstanceExtra; - /** - * Puts some custom floating point number parameter to the extra data of the item. - * @param name parameter name - * @param float parameter value - * @returns Reference to itself to be used in sequential calls. - */ - putFloat(name: string, float: number): NativeItemInstanceExtra; - /** - * Puts some custom boolean parameter to the extra data of the item. - * @param name parameter name - * @param bool parameter value - * @returns Reference to itself to be used in sequential calls. - */ - putBoolean(name: string, bool: boolean): NativeItemInstanceExtra; - /** - * @param name parameter name - * @param fallback default value to be returned if item extra data doesn't - * contain a parameter with specified name - * @returns Custom string parameter value if extra data of the item contains - * one, fallback value otherwise. If fallback was not specified, `null` is returned. - */ - getString(name: string, fallback?: string): Nullable; - /** - * @param name parameter name - * @param fallback default value to be returned if item extra data doesn't - * contain a parameter with specified name - * @returns Custom integer parameter value if extra data of the item contains - * one, fallback value otherwise. If fallback was not specified, `null` is returned. - */ - getInt(name: string, fallback?: number): Nullable; - /** - * @param name parameter name - * @param fallback default value to be returned if item extra data doesn't - * contain a parameter with specified name - * @returns Custom long integer parameter value if extra data of the item contains - * one, fallback value otherwise. If fallback was not specified, `null` is returned. - */ - getLong(name: string, fallback?: number): Nullable; - /** - * @param name parameter name - * @param fallback default value to be returned if item extra data doesn't - * contain a parameter with specified name - * @returns Custom float parameter value if extra data of the item contains - * one, fallback value otherwise. If fallback was not specified, `null` is returned. - */ - getFloat(name: string, fallback?: number): Nullable; - /** - * @param name parameter name - * @param fallback default value to be returned if item extra data doesn't - * contain a parameter with specified name - * @returns Custom boolean parameter value if extra data of the item contains - * one, fallback value otherwise. If fallback was not specified, `null` is returned. - */ - getBoolean(name: string, fallback?: boolean): Nullable; - /** - * @returns Reference to itself to be used in sequential calls. - */ - putSerializable(name: string, serializableObject: any): NativeItemInstanceExtra; - getSerializable(name: string): any; - /** - * Removes all custom parameters from item extra data. - */ - removeCustomData(): void; - toString(): string; - static unwrapObject(extra: any): Nullable; - static unwrapValue(extra: any): number; - static getValueOrNullPtr(extra: NativeItemInstanceExtra): number; - static getExtraOrNull(extraPointer: number): Nullable; - static cloneExtra(extra: Nullable): Nullable; - static fromJson(json: org.json.JSONObject): Nullable; - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/NativeRenderMesh.d.ts b/core-engine/com/zhekasmirnov/innercore/api/NativeRenderMesh.d.ts deleted file mode 100644 index 334d0bbad..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/NativeRenderMesh.d.ts +++ /dev/null @@ -1,210 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export class NativeRenderMesh extends java.lang.Object { - static class: java.lang.Class; - /** - * Adds new mesh to the current one on the specified coordinates. - * @param mesh {@link com.zhekasmirnov.innercore.api.NativeRenderMesh NativeRenderMesh} object to be added to current mesh - * @since 2.0.2b23 - */ - addMesh(mesh: NativeRenderMesh): void; - /** - * Adds new mesh to the current one on the specified coordinates - * with specified offset. - * @param mesh {@link com.zhekasmirnov.innercore.api.NativeRenderMesh NativeRenderMesh} object to be added to current mesh - * @since 2.0.2b23 - */ - addMesh(mesh: NativeRenderMesh, addX: number, addY: number, addZ: number): void; - /** - * Adds new mesh to the current one on the specified coordinates - * with specified offset and scale. - * @param mesh {@link com.zhekasmirnov.innercore.api.NativeRenderMesh NativeRenderMesh} object to be added to current mesh - * @since 2.0.2b23 - */ - addMesh(mesh: NativeRenderMesh, addX: number, addY: number, addZ: number, scaleX: number, scaleY: number, scaleZ: number): void; - /** - * Adds a new vertex on the specified coordinates. - */ - addVertex(x: number, y: number, z: number): void; - /** - * Adds a new vertex on the specified coordinates. - * @param u x texture offset of the vertex - * @param v y texture offset of the vertex - */ - addVertex(x: number, y: number, z: number, u: number, v: number): void; - /** - * Removes all vertices of the mesh. - */ - clear(): void; - /** - * Creates a copy of current {@link com.zhekasmirnov.innercore.api.NativeRenderMesh NativeRenderMesh}. - * @since 2.0.2b26 - */ - clone(): NativeRenderMesh; - /** - * Scales the mesh to fit into the specified box. - * @since 2.0.2b26 - */ - fitIn(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number): void; - /** - * Scales the mesh to fit into the specified box. - * @param keepRatio if `true`, the ratio of the dimensions are preserved - * @since 2.0.2b26 - */ - fitIn(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, keepRatio: boolean): void; - /** - * @returns Pointer to the native object instance of the - * following {@link com.zhekasmirnov.innercore.api.NativeRenderMesh NativeRenderMesh}, represented as long number. - */ - getPtr(): number; - getReadOnlyVertexData(): NativeRenderMesh.ReadOnlyVertexData; - /** - * Imports mesh file using specified path. - * @param path path to the mesh file. Path should be absolute path or - * be relative to the resources folder or to the "models/" folder - * @param type file type to read mesh from. The only currently supported mesh file - * type is "obj" - * @param importParams additional import parameters or null, if not needed - */ - importFromFile(path: string, type: "obj", importParams: Nullable): void; - invalidate(): void; - newGuiRenderMesh(): mod.ui.GuiRenderMesh; - /** - * Forces Minecraft to rebuild specified {@link com.zhekasmirnov.innercore.api.NativeRenderMesh NativeRenderMesh} object. - */ - rebuild(): void; - /** - * Resets color applied to the mesh. - * @default 0xfff // white - */ - resetColor(): void; - /** - * Resets texture of the mesh. - */ - resetTexture(): void; - /** - * Rotates the mesh around the specified coordinates. - * @param rotX rotation angle along X axis, in radians - * @param rotY rotation angle along Y axis, in radians - * @param rotZ rotation angle along Z axis, in radians - * @since 2.0.2b26 - */ - rotate(x: number, y: number, z: number, rotX: number, rotY: number, rotZ: number): void; - /** - * Rotates the mesh around the (0, 0, 0) coordinates. - * @param rotX rotation angle along X axis, in radians - * @param rotY rotation angle along Y axis, in radians - * @param rotZ rotation angle along Z axis, in radians - */ - rotate(rotX: number, rotY: number, rotZ: number): void; - /** - * Scales the whole mesh along the three axis. - */ - scale(x: number, y: number, z: number): void; - /** - * Specifies block texture to be used by mesh. - */ - setBlockTexture(textureName: string, textureMeta: number): void; - /** - * Specifies color to be applied to the next vertices. If the color is not white and - * the texture is applied to mesh, texture's colors will be affected. - */ - setColor(r: number, g: number, b: number): void; - /** - * Specifies color to be applied to the next vertices. If the color is not white and - * the texture is applied to mesh, texture's colors will be affected. - */ - setColor(r: number, g: number, b: number, a: number): void; - /** - * Makes specified {@link com.zhekasmirnov.innercore.api.NativeRenderMesh NativeRenderMesh} foliage tinted. - * @since 2.0.2b24 - */ - setFoliageTinted(): void; - /** - * Makes specified {@link com.zhekasmirnov.innercore.api.NativeRenderMesh NativeRenderMesh} foliage tinted. - * @since 2.0.2b25 - */ - setFoliageTinted(leavesType: number): void; - /** - * Makes specified {@link com.zhekasmirnov.innercore.api.NativeRenderMesh NativeRenderMesh} grass tinted. - * @since 2.0.2b24 - */ - setGrassTinted(): void; - /** - * Sets following {@link com.zhekasmirnov.innercore.api.NativeRenderMesh NativeRenderMesh} light direction. - */ - setLightDir(x: number, y: number, z: number): void; - setLightIgnore(ignore: boolean, bool2: boolean): void; - setLightParams(float1: number, float2: number, float3: number): void; - /** - * Sets following {@link com.zhekasmirnov.innercore.api.NativeRenderMesh NativeRenderMesh} light position. - * @since 2.0.2b25 - */ - setLightPos(x: number, y: number, z: number): void; - /** - * Removes any tint from specified {@link com.zhekasmirnov.innercore.api.NativeRenderMesh NativeRenderMesh}. - * @since 2.0.2b24 - */ - setNoTint(): void; - /** - * Specifies the normal vector for the next vertices. - */ - setNormal(x: number, y: number, z: number): void; - /** - * Makes specified {@link com.zhekasmirnov.innercore.api.NativeRenderMesh NativeRenderMesh} water tinted. - * @since 2.0.2b24 - */ - setWaterTinted(): void; - /** - * Translates the whole mesh along three axis. - */ - translate(x: number, y: number, z: number): void; - } - export module NativeRenderMesh { - export class ReadOnlyVertexData { - static class: java.lang.Class; - readonly colors: native.Array; - readonly dataSize: number; - readonly indices: native.Array; - readonly uvs: native.Array; - readonly vertices: native.Array; - private constructor(dataSize: number); - } - /** - * Object used in {@link com.zhekasmirnov.innercore.api.NativeRenderMesh.importFromFile NativeRenderMesh.importFromFile} and - * one of {@link com.zhekasmirnov.innercore.api.NativeRenderMesh NativeRenderMesh} constructors. Here you can put - * some additional parameters, that will be applied to the mesh, - * when the file is being imported. - */ - export interface ImportParams { - /** - * If `true`, all existing vertices of the mesh are deleted - * before the file is imported. - */ - clear?: boolean, - /** - * If `true`, vertex of the texture is inverted. - */ - invertV: boolean, - /** - * Additional translation along x, y and z axis. - */ - translate?: [number, number, number], - /** - * Additional scale along x, y and z axis. - */ - scale?: [number, number, number], - /** - * If `true`, Minecraft won't be forced to rebuild the following - * {@link com.zhekasmirnov.innercore.api.NativeRenderMesh NativeRenderMesh} - * before the file is imported. - */ - noRebuild: boolean - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/NativeRenderer.d.ts b/core-engine/com/zhekasmirnov/innercore/api/NativeRenderer.d.ts index be7996080..75412b9d5 100644 --- a/core-engine/com/zhekasmirnov/innercore/api/NativeRenderer.d.ts +++ b/core-engine/com/zhekasmirnov/innercore/api/NativeRenderer.d.ts @@ -1,195 +1,15 @@ declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export class NativeRenderer extends java.lang.Object { + namespace zhekasmirnov { + namespace innercore { + namespace api { + class NativeRenderer extends java.lang.Object { static class: java.lang.Class; - static createHumanoidRenderer(d: number): NativeRenderer.Renderer; - static createItemSpriteRenderer(id: number): NativeRenderer.Renderer; - static createRendererWithSkin(skin: string, d: number): NativeRenderer.Renderer; - static getRendererById(id: number): Nullable; - } - export module NativeRenderer { - export class FinalizeCallback extends java.lang.Object { - static class: java.lang.Class; - onFinalized(renderer: Renderer): void; - } - export type FinalizeCallbackJS = (renderer: Renderer) => void; - export class Model extends java.lang.Object { - static class: java.lang.Class; - /** - * Clears all parts of the model. - */ - clearAllParts(): void; - /** - * @param partName part name - * @returns Part by it's name or null if part doesn't exist. - */ - getPart(partName: string): Nullable; - /** - * @param partName part name - * @returns `true` if part with specified name exists in the model, - * `false` otherwise. - */ - hasPart(partName: string): boolean; - /** - * Resets the model - */ - reset(): void; - } - export class ModelPart extends java.lang.Object { - static class: java.lang.Class; - /** - * Adds a new box to the part on the specified coordinates (relative to - * the part's coordinates) of the specified size (width, height, length). - */ - addBox(x: number, y: number, z: number, w: number, h: number, l: number): void; - /** - * Adds a new box to the part on the specified coordinates (relative to - * the part's coordinates) of the specified size (width, height, length). - * @param add additional size to be added from all the six sizes of the - * box - */ - addBox(x: number, y: number, z: number, w: number, h: number, l: number, add: number): void; - /** - * Creates a new part with specified name. If a part with specified name - * already exists, returns the existing part. - * @param name name of the part to create or return - */ - addPart(name: string): ModelPart; - /** - * Clears the contents of the part. - */ - clear(): void; - /** - * @returns Mesh specified via {@link com.zhekasmirnov.innercore.api.NativeRenderer.ModelPart.setMesh setMesh} call or `null`, if - * this part doesn't contain mesh. - */ - getMesh(): Nullable; - /** - * Specifies {@link com.zhekasmirnov.innercore.api.NativeRenderMesh NativeRenderMesh} to be used as a part. - */ - setMesh(mesh: Nullable): void; - /** - * Specifies part default offset. - */ - setOffset(offsetX: number, offsetY: number, offsetZ: number): void; - /** - * Specifies part rotation. - */ - setRotation(rotationX: number, rotationY: number, rotationZ: number): void; - /** - * Specifies texture UV offset. - */ - setTextureOffset(u: number, v: number): void; - /** - * Specifies texture UV offset. - */ - setTextureOffset(u: number, v: number): void; - /** - * Specifies texture UV offset. - * @param placeholder deprecated boolean parameter - * @deprecated Use same method without last parameter. - */ - setTextureOffset(u: number, v: number, placeholder: boolean): void; - /** - * Specifies texture size size, use the real texture file size or change - * it to stretch texture. - */ - setTextureSize(w: number, h: number): void; - /** - * Specifies texture size size, use the real texture file size or change - * it to stretch texture. - */ - setTextureSize(w: number, h: number): void; - /** - * Specifies texture size size, use the real texture file size or change - * it to stretch texture. - * @param placeholder deprecated boolean parameter - * @deprecated Use same method without last parameter. - */ - setTextureSize(w: number, h: number, placeholder: boolean): void; - } - export class RenderPool extends java.lang.Object { - static class: java.lang.Class; - constructor(); - constructor(factory: IFactory | IFactoryJS); - getRender(): Renderer; - } - export module RenderPool { - export type IFactory = NativeRenderer.IFactory - } - export class IFactory extends java.lang.Object { - static class: java.lang.Class; - newRender(): Renderer; - constructor(); - constructor(impl: { - newRender: () => Renderer - }); - } - export type IFactoryJS = () => Renderer; - export class Renderer extends java.lang.Object { - static class: java.lang.Class; - isHumanoid: boolean; - transform: Transform; - constructor(pointer: number); - addFinalizeCallback(callback: FinalizeCallback | FinalizeCallbackJS): void; - getModel(): Model; - getPointer(): number; - getRenderType(): number; - getScale(): number; - release(): void; - setFinalizeable(finalizeable: boolean): void; - setScale(scale: number): void; - setSkin(skin: string): void; - } - export module Renderer { - type Transform = NativeRenderer.Transform; - } - class Transform extends java.lang.Object { - static class: java.lang.Class; - /** - * Clears all the transformations applied to the render. - * @returns Reference to itself to be used in sequential calls. - */ - clear(): Transform; - /** - * @returns Reference to itself to be used in sequential calls. - */ - lock(): Transform; - /** - * Performs arbitrary matrix transformations on the render. - * @returns Reference to itself to be used in sequential calls. - */ - matrix(m00: number, m01: number, m02: number, m03: number, - m10: number, m11: number, m12: number, m13: number, - m20: number, m21: number, m22: number, m23: number, - m30: number, m31: number, m32: number, m33: number): Transform; - /** - * Rotates render along three axes. - * @returns Reference to itself to be used in sequential calls. - */ - rotate(rotX: number, rotY: number, rotZ: number): Transform; - /** - * Scales render along the three axes. - * @returns Reference to itself to be used in sequential calls. - */ - scale(scaleX: number, scaleY: number, scaleZ: number): Transform; - /** - * Translates render along three axes. - * @returns Reference to itself to be used in sequential calls. - */ - translate(x: number, y: number, z: number): Transform; - /** - * @returns Reference to itself to be used in sequential calls. - */ - unlock(): Transform; - } - export class SpriteRenderer extends Renderer { - static class: java.lang.Class; - } + static createHumanoidRenderer(d: number): Render.Renderer; + static createItemSpriteRenderer(id: number): Render.Renderer; + static createRendererWithSkin(skin: string, d: number): Render.Renderer; + static getRendererById(id: number): Nullable; } } } } -} \ No newline at end of file +} diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/recipes/workbench/InventoryPool.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/recipes/workbench/InventoryPool.d.ts index 16f097b51..6778ecc0a 100644 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/recipes/workbench/InventoryPool.d.ts +++ b/core-engine/com/zhekasmirnov/innercore/api/mod/recipes/workbench/InventoryPool.d.ts @@ -1,33 +1,32 @@ declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module recipes { - export module workbench { - export class InventoryPool extends java.lang.Object { + namespace zhekasmirnov { + namespace innercore { + namespace api { + namespace mod { + namespace recipes { + namespace workbench { + class InventoryPool extends java.lang.Object { static class: java.lang.Class; constructor(player: number); - addRecipeEntry(entry: RecipeEntry): void; + addRecipeEntry(entry: Recipes.RecipeEntry): void; addPoolEntry(entry: InventoryPool.PoolEntry): void; - getPoolEntrySet(entry: RecipeEntry): Nullable; - getPoolEntries(entry: RecipeEntry): Nullable>; + getPoolEntrySet(entry: Recipes.RecipeEntry): Nullable; + getPoolEntries(entry: Recipes.RecipeEntry): Nullable>; pullFromInventory(): void; } - export module InventoryPool { + namespace InventoryPool { interface PoolEntry { count: number, data: number, - extra: NativeItemInstanceExtra, + extra: ItemExtraData, id: number, slot: number, isMatchesWithExtra(other: PoolEntry): boolean; isMatches(other: PoolEntry): boolean; hasExtra(): boolean; getAmountOfItem(amount: number): number; - toString(): string; } - export class PoolEntrySet extends java.lang.Object { + class PoolEntrySet extends java.lang.Object { static class: java.lang.Class; constructor(); constructor(entries: java.util.ArrayList); @@ -37,8 +36,7 @@ declare module com { removeMatchingEntries(set: PoolEntrySet): void; getFirstEntry(): PoolEntry; getTotalCount(): number; - toString(): string; - spreadItems(slots: java.util.ArrayList): void; + spreadItems(slots: java.util.ArrayList): void; } } } @@ -47,4 +45,4 @@ declare module com { } } } -} \ No newline at end of file +} diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/recipes/workbench/RecipeEntry.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/recipes/workbench/RecipeEntry.d.ts deleted file mode 100644 index e7e5510be..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/recipes/workbench/RecipeEntry.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module recipes { - export module workbench { - export class RecipeEntry extends java.lang.Object { - static class: java.lang.Class; - static readonly noentry: RecipeEntry; - readonly data: number; - readonly id: number; - constructor(id: number, data: number); - constructor(slot: ui.container.Slot); - getMask(): java.lang.Character; - getCodeByItem(id: number, data: number): number; - getCode(): number; - isMatching(slot: ui.container.AbstractSlot): boolean; - isMatching(entry: RecipeEntry): boolean; - equals(obj: java.lang.Object): boolean; - hashCode(): number; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/recipes/workbench/WorkbenchField.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/recipes/workbench/WorkbenchField.d.ts deleted file mode 100644 index 3b2609d95..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/recipes/workbench/WorkbenchField.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module recipes { - export module workbench { - export class WorkbenchField extends java.lang.Object { - static class: java.lang.Class; - constructor(); - constructor(impl: { - asScriptableField: () => ui.container.AbstractSlot[], - getFieldSlot: (i: number) => ui.container.AbstractSlot; - }); - asScriptableField(): ui.container.AbstractSlot[]; - getFieldSlot(i: number): ui.container.AbstractSlot; - /** - * @since 2.2.1b108 - */ - getFieldSlot(x: number, y: number): innercore.api.mod.ui.container.AbstractSlot; - /** - * @since 2.2.1b106 - */ - getWorkbenchFieldSize(): number; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/recipes/workbench/WorkbenchFieldAPI.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/recipes/workbench/WorkbenchFieldAPI.d.ts deleted file mode 100644 index 370289730..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/recipes/workbench/WorkbenchFieldAPI.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module recipes { - export module workbench { - export class WorkbenchFieldAPI extends java.lang.Object { - static class: java.lang.Class; - readonly container: WorkbenchField; - constructor(field: WorkbenchField); - getFieldSlot(i: number): ui.container.AbstractSlot; - decreaseFieldSlot(i: number): void; - prevent(): void; - isPrevented(): boolean; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/ContentProvider.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/ContentProvider.d.ts deleted file mode 100644 index 7bc225ec5..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/ContentProvider.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export class ContentProvider extends java.lang.Object { - static class: java.lang.Class; - content: window.WindowContent; - drawing: object; - drawingWatcher: util.ScriptableWatcher; - elementMap: java.util.HashMap; - elements: object; - window: window.UIWindow; - constructor(window: window.UIWindow); - setContentObject(content: window.WindowContent): void; - setupElements(): void; - refreshElements(): void; - setupDrawing(): void; - refreshDrawing(): void; - invalidateAllContent(): void; - toString(): string; - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/GuiBlockModel.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/GuiBlockModel.d.ts index 91f3ab9de..975b72ff8 100644 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/GuiBlockModel.d.ts +++ b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/GuiBlockModel.d.ts @@ -1,10 +1,10 @@ declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export class GuiBlockModel extends java.lang.Object { + namespace zhekasmirnov { + namespace innercore { + namespace api { + namespace mod { + namespace ui { + class GuiBlockModel extends java.lang.Object { static class: java.lang.Class; setShadow(shadow: boolean): void; constructor(resolution: number); @@ -18,15 +18,15 @@ declare module com { constructor(textures: string[], ids: number[]); updateShape(shape: unlimited.BlockShape): void; genTexture(): android.graphics.Bitmap; - addToMesh(mesh: NativeRenderMesh, x: number, y: number, z: number): void; + addToMesh(mesh: RenderMesh, x: number, y: number, z: number): void; /** * @since 2.2.0b75 */ - addToRenderModelPart(modelPart: NativeRenderer.ModelPart, x: number, y: number, z: number): void; - static createModelForBlockVariant(variant: unlimited.BlockVariant): GuiBlockModel; + addToRenderModelPart(modelPart: Render.ModelPart, x: number, y: number, z: number): void; + static createModelForBlockVariant(variant: any): GuiBlockModel; } - export module GuiBlockModel { - export class Box extends java.lang.Object { + namespace GuiBlockModel { + class Box extends java.lang.Object { static class: java.lang.Class; readonly enabledSides: [boolean, boolean, boolean, boolean, boolean, boolean]; textureNames: java.util.ArrayList>; @@ -48,16 +48,16 @@ declare module com { addTexture(name: string, id: number): void; addTexture(name: android.util.Pair): void; genTexture(resolution: number): android.graphics.Bitmap; - public addToMesh(mesh: NativeRenderMesh, x: number, y: number, z: number): void; + public addToMesh(mesh: RenderMesh, x: number, y: number, z: number): void; } - export class Builder extends java.lang.Object { + class Builder extends java.lang.Object { static class: java.lang.Class; build(resolveCollisionsAndSort: boolean): GuiBlockModel; add(box: Builder.PrecompiledBox): void; add(builder: Builder): void; } - export module Builder { - export class PrecompiledBox extends java.lang.Object { + namespace Builder { + class PrecompiledBox extends java.lang.Object { static class: java.lang.Class; blockData: number; blockId: number; @@ -77,10 +77,9 @@ declare module com { intersects(b: PrecompiledBox): boolean; inFrontOf(b: PrecompiledBox): boolean; compile(): Box; - toString(): string; } } - export class VanillaRenderType extends java.lang.Object { + class VanillaRenderType extends java.lang.Object { static class: java.lang.Class; static getFor(id: number): VanillaRenderType; buildModelFor(textures: string[], textureIds: number[]): GuiBlockModel; @@ -92,4 +91,4 @@ declare module com { } } } -} \ No newline at end of file +} diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/GuiRenderMesh.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/GuiRenderMesh.d.ts deleted file mode 100644 index 40622a0d5..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/GuiRenderMesh.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export class GuiRenderMesh extends java.lang.Object { - static class: java.lang.Class; - rx: number; - ry: number; - rz: number; - x: number; - y: number; - z: number; - draw(gl: javax.microedition.khronos.opengles.GL10): void; - setVertices(vertices: number[]): void; - setIndices(indices: number[]): void; - setTextureCoordinates(textureCoords: number[]): void; - setColors(colors: number[]): void; - loadBitmap(bitmap: android.graphics.Bitmap): void; - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/IBackgroundProvider.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/IBackgroundProvider.d.ts deleted file mode 100644 index 8f9b3fb29..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/IBackgroundProvider.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export class IBackgroundProvider extends java.lang.Object { - static class: java.lang.Class; - constructor(); - constructor(impl: { - addDrawing(idrawing: background.IDrawing): void; - clearAll(): void; - prepareCache(): void; - releaseCache(): void; - setBackgroundColor(color: number): void; - }); - addDrawing(idrawing: background.IDrawing): void; - clearAll(): void; - prepareCache(): void; - releaseCache(): void; - setBackgroundColor(color: number): void; - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/IElementProvider.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/IElementProvider.d.ts deleted file mode 100644 index bf5815bc7..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/IElementProvider.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export class IElementProvider extends java.lang.Object { - static class: java.lang.Class; - constructor(); - constructor(impl: { - addOrRefreshElement(element: elements.UIElement): void; - getStyleFor(element: elements.UIElement): types.UIStyle; - invalidateAll(): void; - releaseAll(): void; - removeElement(element: elements.UIElement): void; - resetAll(): void; - runCachePreparation(): void; - setBackgroundProvider(bgprovider: IBackgroundProvider): void; - setWindowStyle(style: types.UIStyle): void; - }); - addOrRefreshElement(element: elements.UIElement): void; - getStyleFor(element: elements.UIElement): types.UIStyle; - invalidateAll(): void; - releaseAll(): void; - removeElement(element: elements.UIElement): void; - resetAll(): void; - runCachePreparation(): void; - setBackgroundProvider(bgprovider: IBackgroundProvider): void; - setWindowStyle(style: types.UIStyle): void; - } - export interface IElementProvider { - addOrRefreshElement(element: elements.UIElement): void; - getStyleFor(element: elements.UIElement): types.UIStyle; - invalidateAll(): void; - releaseAll(): void; - removeElement(element: elements.UIElement): void; - resetAll(): void; - runCachePreparation(): void; - setBackgroundProvider(bgprovider: IBackgroundProvider): void; - setWindowStyle(style: types.UIStyle): void; - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/ItemModelCacheManager.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/ItemModelCacheManager.d.ts index 9770d1981..8fc722bb8 100644 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/ItemModelCacheManager.d.ts +++ b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/ItemModelCacheManager.d.ts @@ -1,10 +1,10 @@ declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export class ItemModelCacheManager extends java.lang.Object { + namespace zhekasmirnov { + namespace innercore { + namespace api { + namespace mod { + namespace ui { + class ItemModelCacheManager extends java.lang.Object { static class: java.lang.Class; static getSingleton(): ItemModelCacheManager; getCacheGroupDirectory(group: string): java.io.File; @@ -17,4 +17,4 @@ declare module com { } } } -} \ No newline at end of file +} diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/TextureSource.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/TextureSource.d.ts deleted file mode 100644 index 1f8e58b3f..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/TextureSource.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export class TextureSource extends java.lang.Object { - static class: java.lang.Class; - loadAllStandartAssets(): void; - put(name: string, bmp: android.graphics.Bitmap): void; - get(name: string): android.graphics.Bitmap; - getSafe(name: string): android.graphics.Bitmap; - loadFile(file: java.io.File, namePrefix: string): void; - loadAsset(name: string): void; - loadDirectory(dir: java.io.File): void; - loadDirectory(dir: java.io.File, namePrefix: string): void; - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/background/DrawColor.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/background/DrawColor.d.ts deleted file mode 100644 index 0babbfd69..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/background/DrawColor.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module background { - export interface ColorDrawingDescription { - type: "background", - color?: number, - mode?: number, - colorMode?: number - } - export class DrawColor extends java.lang.Object implements IDrawing { - static class: java.lang.Class; - onDraw(canvas: android.graphics.Canvas, scale: number): void; - onSetup(scriptable: ColorDrawingDescription, style: types.UIStyle): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/background/DrawCustom.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/background/DrawCustom.d.ts deleted file mode 100644 index cb6892529..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/background/DrawCustom.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module background { - export interface CustomDrawingDescription { - type: "custom", - onDraw?: (canvas: android.graphics.Canvas, scale: number) => void; - } - export class DrawCustom extends java.lang.Object implements IDrawing { - static class: java.lang.Class; - onDraw(canvas: android.graphics.Canvas, scale: number): void; - onSetup(scriptable: CustomDrawingDescription, style: types.UIStyle): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/background/DrawFrame.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/background/DrawFrame.d.ts deleted file mode 100644 index 309882aa3..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/background/DrawFrame.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module background { - export interface FrameDrawingDescription { - type: "frame", - bitmap?: string, - sides?: boolean[], - x?: number, - y?: number, - scale?: number, - width?: number, height?: number, - color?: number, - bg?: number - } - export class DrawFrame extends java.lang.Object implements IDrawing { - static class: java.lang.Class; - onDraw(canvas: android.graphics.Canvas, scale: number): void; - onSetup(scriptable: FrameDrawingDescription, style: types.UIStyle): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/background/DrawImage.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/background/DrawImage.d.ts deleted file mode 100644 index 4812a73f5..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/background/DrawImage.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module background { - export interface ImageDrawingDescription { - type: "bitmap", - x?: number, y?: number, - width?: number, - height?: number, - scale?: number, - bitmap?: string - } - export class DrawImage extends java.lang.Object implements IDrawing { - static class: java.lang.Class; - onDraw(canvas: android.graphics.Canvas, scale: number): void; - onSetup(scriptable: ImageDrawingDescription, style: types.UIStyle): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/background/DrawLine.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/background/DrawLine.d.ts deleted file mode 100644 index 9baf50777..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/background/DrawLine.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module background { - export interface LineDrawingDescription { - type: "line", - x1?: number, y1?: number, x2?: number, y2?: number, - color?: number, width?: number - } - export class DrawLine extends java.lang.Object implements IDrawing { - static class: java.lang.Class; - onDraw(canvas: android.graphics.Canvas, scale: number): void; - onSetup(scriptable: LineDrawingDescription, style: types.UIStyle): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/background/DrawText.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/background/DrawText.d.ts deleted file mode 100644 index 9ca53f2a9..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/background/DrawText.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module background { - export interface TextDrawingDescription { - type: "text", - x?: number, y?: number, - text?: string, - font?: types.FontDescription - } - export class DrawText extends java.lang.Object implements IDrawing { - static class: java.lang.Class; - onDraw(canvas: android.graphics.Canvas, scale: number): void; - onSetup(scriptable: TextDrawingDescription, style: types.UIStyle): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/background/DrawingFactory.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/background/DrawingFactory.d.ts deleted file mode 100644 index 133001545..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/background/DrawingFactory.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module background { - export type StandardDrawingTypes = - ColorDrawingDescription | - CustomDrawingDescription | - FrameDrawingDescription | - ImageDrawingDescription | - LineDrawingDescription | - TextDrawingDescription; - export class DrawingFactory extends java.lang.Object { - static class: java.lang.Class; - static put(name: string, element: java.lang.Class): void; - static construct(desc: StandardDrawingTypes, style: types.UIStyle): Nullable; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/background/IDrawing.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/background/IDrawing.d.ts deleted file mode 100644 index 3a4357c91..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/background/IDrawing.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module background { - export class IDrawing extends java.lang.Object { - static class: java.lang.Class; - constructor(); - constructor(impl: { - onDraw(canvas: android.graphics.Canvas, scale: number): void; - onSetup(scriptable: object, style: types.UIStyle): void; - }); - onDraw(canvas: android.graphics.Canvas, scale: number): void; - onSetup(scriptable: object, style: types.UIStyle): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/container/AbstractSlot.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/container/AbstractSlot.d.ts deleted file mode 100644 index 3d1fa9bf8..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/container/AbstractSlot.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module container { - export class AbstractSlot extends java.lang.Object { - static class: java.lang.Class; - constructor(); - constructor(impl: { - getId(): number; getCount(): number; getData(): number; - getExtra(): Nullable; - set(id: number, count: number, data: number, extra: Nullable): void; - validate(): void; - }) - getId(): number; getCount(): number; getData(): number; - getExtra(): Nullable; - set(id: number, count: number, data: number, extra: Nullable): void; - validate(): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/container/Container.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/container/Container.d.ts deleted file mode 100644 index cbe92f4b4..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/container/Container.d.ts +++ /dev/null @@ -1,295 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module container { - export module Container { - export class OnCloseListener extends java.lang.Object { - static class: java.lang.Class; - constructor(); - constructor(impl: { onClose(container: Container, win: window.IWindow): void }); - onClose(container: Container, win: window.IWindow): void; - } - export class OnOpenListener extends java.lang.Object { - static class: java.lang.Class; - constructor(); - constructor(impl: { onOpen(container: Container, win: window.IWindow): void }); - onOpen(container: Container, win: window.IWindow): void; - } - } - /** - * @param container {@link UI.Container} the window was opened in - * @param window an instance of {@link UI.IWindow} that was opened - */ - export interface OnOpenCloseListenerJS { (container: Container, window: window.IWindow): void; } - export class Container extends java.lang.Object implements UiAbstractContainer, recipes.workbench.WorkbenchField { - static class: java.lang.Class; - static readonly isContainer: boolean; - /** - * If container is a part of {@link TileEntity}, this field stores reference - * to it, otherwise null. You can also assign any value of any type to - * it using {@link com.zhekasmirnov.innercore.api.mod.ui.container.Container.setParent UI.Container.setParent} method or using constructor - * parameter. Consider using {@link com.zhekasmirnov.innercore.api.mod.ui.container.Container.getParent UI.Container.getParent} instead of direct - * field access. - */ - parent: Nullable | any; - slots: {[slotName: string]: container.Slot} - /** - * Same as {@link com.zhekasmirnov.innercore.api.mod.ui.container.Container.parent UI.Container.parent}. - */ - tileEntity: Nullable | any; - constructor(); - constructor(parent: any); - /** - * Sets container's parent object, for {@link TileEntity}'s container it - * should be a {@link TileEntity} reference, otherwise you can pass any - * value to be used in your code later. - * @param parent an object to be set as container's parent - */ - setParent(parent: Nullable | any): void; - /** - * Getter for {@link com.zhekasmirnov.innercore.api.mod.ui.container.Container.parent Container.parent} field. - */ - getParent(): Nullable | any; - /** - * Gets the slot by it's name. If a slot with specified name doesn't - * exists, creates an empty one with specified name. - * @param name slot name - * @returns Contents of the slot in a {@link UI.Slot} object. - * You can modify it to change the contents of the slot. - */ - getSlot(name: string): Slot; - /** - * Gets the slot by it's name. If a slot with specified name doesn't - * exists, creates an empty one with specified name. - * @param name slot name - * @returns Contents of the slot in a FullSlot object containing - * more useful methods for slot manipulation. - */ - getFullSlot(name: string): Slot; - getSlotVisualImpl(name: string): UiVisualSlotImpl; - handleInventoryToSlotTransaction(invSlot: number, slotName: string, amount: number): void; - handleSlotToSlotTransaction(from: string, to: string, amount: number): void; - handleSlotToInventoryTransaction(slotName: string, amount: number): void; - /** - * Set slot's content by it's name. If a slot with specified name doesn't - * exists, creates an empty one with specified name and item. - * @param name slot name - */ - setSlot(name: string, id: number, count: number, data: number): void; - /** - * Set slot's content by it's name. If a slot with specified name doesn't - * exists, creates new with specified name and item. - * @param name slot name - * @param extra item extra value. Note that it should be an instance of - * {@link ItemExtraData} and not it's numeric ID - */ - setSlot(name: string, id: number, count: number, data: number, extra: Nullable): void; - /** - * Validates slot contents. If the data value is less then `0`, it becomes - * `0`, if ID is `0` or count is less then or equals to zero, slot is reset - * to an empty one. - * @param name slot name - */ - validateSlot(name: string): void; - /** - * Clears slot's contents. - * @param name slot name - */ - clearSlot(name: string): void; - /** - * Drops slot's contents on the specified coordinates - * and clears the slot. - * @param name slot name - * @deprecated Client only, use {@link BlockSource.spawnDroppedItem} instead. - */ - dropSlot(name: string, x: number, y: number, z: number): void; - /** - * Drops the contents of all the slots in the container on the specified - * coordinates and clears them. - * @deprecated Client only, use {@link BlockSource.spawnDroppedItem} instead. - */ - dropAt(x: number, y: number, z: number): void; - /** - * Validates all the slots in the container. - */ - validateAll(): void; - /** - * @returns Currently opened {@link UI.IWindow} - * or `null` if no window is currently opened in the container. - */ - getWindow(): window.IWindow; - _addElement(element: elements.UIElement, name: string): void; - addElementInstance(element: elements.UIElement, name: string): void; - _removeElement(name: string): void; - /** - * Opens {@link UI.IWindow} object in the container. - * @param win {@link UI.IWindow} object to be opened - */ - openAs(win: window.IWindow): void; - /** - * Closes currently opened window. - */ - close(): void; - /** - * Sets an object to be notified when the window is opened. - * @param listener object to be notified when the window is opened - * @since 2.0.4b43 - */ - setOnOpenListener(listener: Container.OnOpenListener | OnOpenCloseListenerJS): void; - /** - * Sets an object to be notified when the window is closed. - * @param listener object to be notified when the window is closed - */ - setOnCloseListener(listener: Container.OnCloseListener | OnOpenCloseListenerJS): void; - onWindowClosed(): void; - /** - * @returns `true`, if some window is opened in the container. - */ - isOpened(): boolean; - /** - * Same as {@link com.zhekasmirnov.innercore.api.mod.ui.container.Container.getWindow Container.getWindow}. - */ - getGuiScreen(): window.IWindow; - /** - * @returns Window's content object (usually specified in the window's - * constructor) if a window was opened in the container, `null` otherwise. - */ - getGuiContent(): Nullable; - /** - * @returns Window's element by it's name. - * @param name element name - */ - getElement(name: string): Nullable; - /** - * Passes any value to the element. - * @param elementName element name - * @param bindingName binding name, you can access the value from the - * element by this name - * @param val value to be passed to the element - */ - setBinding(elementName: string, bindingName: string, val: any): void; - /** - * Gets any value from the element. - * @param elementName element name - * @param bindingName binding name, you can access the value from the - * element by this name. Some binding names are reserved for additional - * element information, e.g. "element_obj" contains pointer to the - * current object and "element_rect" contains android.graphics.Rect - * object containing drawing rectangle - * @returns Value that was get from the element or `null` if the - * element doesn't exist. - */ - getBinding(elementName: string, bindingName: string): elements.UIElement | android.graphics.Rect | T | null; - handleBindingDirty(): void; - sendChanges(): void; - /** - * Sets "value" binding value for the element. Used to set scales values. - * @param name element name - * @param value value to be set for the element - */ - setScale(name: string, value: number): void; - /** - * @param name element name - * @returns Value "value" binding, e.g. scale value, or `null` if no - * element with specified name exist. - */ - getValue(name: string): Nullable; - /** - * Sets "text" binding value for the element. Used to set element's text. - * @param name element name - * @param value value to be set for the element - */ - setText(name: string, value: string | number): void; - /** - * - * @param name element name - * @returns Value "text" binding, usually the text displayed on the - * element, or `null` if no element with specified name exist. - */ - getText(name: string): Nullable; - /** - * @param name element name - * @returns `true` if the element is currently hovered. - */ - isElementTouched(name: string): boolean; - /** - * Forces ui elements of the window to refresh. - * @param onCurrentThread if `true`, the drawables will be refreshed - * immediately, otherwise refresh event will be posted; ensure you are - * in the UI thread if you pass `true` as the parameter - * @default onCurrentThread: false - */ - invalidateUIElements(onCurrentThread: boolean): void; - /** - * Forces ui elements of the window to refresh. - */ - invalidateUIElements(): void; - /** - * Forces ui drawables of the window to refresh. - * @param onCurrentThread if `true`, the drawables will be refreshed - * immediately, otherwise refresh event will be posted; ensure you are - * in the UI thread if you pass `true` as the parameter - * @default onCurrentThread: false - */ - invalidateUIDrawing(onCurrentThread: boolean): void; - invalidateUIDrawing(): void; - /** - * Forces ui elements and drawables of the window to refresh. - * @param onCurrentThread if `true`, the drawables will be refreshed - * immediately, otherwise refresh event will be posted; ensure you are - * in the UI thread if you pass `true` as the parameter - * @default onCurrentThread: false - */ - invalidateUI(onCurrentThread: boolean): void; - /** - * Forces ui elements and drawables of the window to refresh. - */ - invalidateUI(): void; - /** - * @deprecated Backwards compatibility. - */ - refreshSlots(): void; - /** - * @deprecated Backwards compatibility. - */ - applyChanges(): void; - /** - * If the container is a custom workbench, you can set the slot prefix - * via this method call. {@link com.zhekasmirnov.innercore.api.mod.ui.container.Container.getFieldSlot Container.getFieldSlot} - * will get field slot by `prefix + slot` name. - * @param wbsnp custom workbench slot prefix - */ - setWbSlotNamePrefix(wbsnp: string): void; - /** - * @param slot slot index - * @returns Workbench slot instance by slot index. - */ - getFieldSlot(slot: number): Slot; - /** - * @since 2.2.1b108 - */ - getFieldSlot(x: number, y: number): AbstractSlot; - /** - * @returns JS array of all slots. - */ - asScriptableField(): Slot[]; - /** - * @returns `9` - * @since 2.2.1b106 - */ - getWorkbenchFieldSize(): number; - /** - * @returns `false` if container supports multiplayer, `true` otherwise. - */ - isLegacyContainer(): boolean; - } - } - } - } - } - } - } -} diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/container/ScriptableUiVisualSlotImpl.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/container/ScriptableUiVisualSlotImpl.d.ts deleted file mode 100644 index a953b5937..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/container/ScriptableUiVisualSlotImpl.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module container { - export class ScriptableUiVisualSlotImpl extends java.lang.Object implements UiVisualSlotImpl { - static class: java.lang.Class; - constructor(scriptable: ItemInstance); - getId(): number; - getCount(): number; - getData(): number; - getExtra(): Nullable; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/container/Slot.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/container/Slot.d.ts deleted file mode 100644 index ff3e1f5de..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/container/Slot.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module container { - export class Slot extends java.lang.Object implements AbstractSlot { - static class: java.lang.Class; - id: number; - count: number; - data: number; - extra: Nullable; - getClassName(): "slot"; - constructor(id: number, count: number, data: number); - constructor(id: number, count: number, data: number, extra: Nullable); - constructor(); - constructor(parent: ItemInstance); - set(id: number, count: number, data: number): void; - set(id: number, count: number, data: number, extra: Nullable): void; - put(name: string, prop: any): void; - getInt(name: string): number; - validate(): void; - /** - * @deprecated Client only, use {@link BlockSource.spawnDroppedItem} instead. - */ - drop(x: number, y: number, z: number): void; - getTarget(): ItemInstance; - getId(): number; getCount(): number; getData(): number; - getExtraValue(): number; - getExtra(): Nullable; - save(): Slot; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/container/UiAbstractContainer.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/container/UiAbstractContainer.d.ts deleted file mode 100644 index 8c46ff7c2..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/container/UiAbstractContainer.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module container { - export class UiAbstractContainer extends java.lang.Object { - static class: java.lang.Class; - constructor(); - constructor(impl: { - addElementInstance(element: elements.UIElement, name: string): void; - close(): void; - getBinding(element: string, bindingName: string): elements.UIElement | android.graphics.Rect | T; - getElement(elementName: string): elements.UIElement; - getParent(): any; - getSlotVisualImpl(slotName: string): UiVisualSlotImpl; - handleBindingDirty(element: string, bindingName: string): void; - handleInventoryToSlotTransaction(invSlot: number, containerSlot: string, count: number): void; - handleSlotToInventoryTransaction(containerSlot: string, invSlot: number): void; - handleSlotToSlotTransaction(slot1: string, slot2: string, count: number): void; - onWindowClosed(): void; - openAs(win: window.IWindow): void; - setBinding(element: string, bindingName: string, obj: T): void; - }); - addElementInstance(element: elements.UIElement, name: string): void; - close(): void; - getBinding(element: string, bindingName: string): elements.UIElement | android.graphics.Rect | T; - getElement(elementName: string): elements.UIElement; - getParent(): any; - getSlotVisualImpl(slotName: string): UiVisualSlotImpl; - handleBindingDirty(element: string, bindingName: string): void; - handleInventoryToSlotTransaction(invSlot: number, containerSlot: string, count: number): void; - handleSlotToInventoryTransaction(containerSlot: string, invSlot: number): void; - handleSlotToSlotTransaction(slot1: string, slot2: string, count: number): void; - onWindowClosed(): void; - openAs(win: window.IWindow): void; - setBinding(element: string, bindingName: string, obj: T): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/container/UiVisualSlotImpl.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/container/UiVisualSlotImpl.d.ts deleted file mode 100644 index 0a9436865..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/container/UiVisualSlotImpl.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module container { - export class UiVisualSlotImpl extends java.lang.Object { - static class: java.lang.Class; - constructor(); - constructor(impl: { - getId(): number; getCount(): number; getData(): number; - getExtra(): Nullable; - }); - getId(): number; getCount(): number; getData(): number; - getExtra(): Nullable; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/ElementFactory.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/ElementFactory.d.ts deleted file mode 100644 index 3c491fe8d..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/ElementFactory.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module elements { - export type StandardElementTypes = - ButtonElementDescription | - CustomElementDescription | - FPSTextElementDescription | - FrameElementDescription | - ImageElementDescription | - InvSlotElementDescription | - ScaleElementDescription | - ScrollElementDescription | - SlotElementDescription | - SwitchElementDescription | - TabElementDescription | - TextElementDescription; - export class ElementFactory extends java.lang.Object { - static class: java.lang.Class; - static put(name: string, element: java.lang.Class): void; - static construct(type: string, win: window.UIWindow, descr: StandardElementTypes | T): Nullable; - static construct(win: window.UIWindow, descr: StandardElementTypes | T): Nullable; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIButtonElement.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIButtonElement.d.ts deleted file mode 100644 index 251b5636d..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIButtonElement.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module elements { - export interface ButtonElementDescription extends BasicElementDescription { - type: "button" | "closeButton" | "close_button", - scale?: number, - bitmap?: BitmapTypes, - bitmap2?: BitmapTypes - } - export class UIButtonElement extends UIElement { - static class: java.lang.Class; - constructor(win: window.UIWindow, desc: ButtonElementDescription); - onSetup(desc: ButtonElementDescription): void; - onDraw(cvs: android.graphics.Canvas, scale: number): void; - onBindingUpdated(name: string, value: T): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UICloseButtonElement.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UICloseButtonElement.d.ts deleted file mode 100644 index 881402477..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UICloseButtonElement.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module elements { - export class UICloseButtonElement extends UIButtonElement { - static class: java.lang.Class; - constructor(window: window.UIWindow, desc: ButtonElementDescription); - onTouchEvent(event: types.TouchEvent): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UICustomElement.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UICustomElement.d.ts deleted file mode 100644 index 4e57bf1f1..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UICustomElement.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module elements { - export interface CustomElementDescription extends BasicElementDescription { - type: "custom", - custom?: { - onSetup?: (element: UICustomElement) => void, - onDraw?: (element: UICustomElement, cvs: android.graphics.Canvas, scale: number) => void, - onTouchReleased?: (element: UICustomElement) => void, - onBindingUpdated?: (element: UICustomElement, name: string, val: T) => void, - onReset?: (element: UICustomElement) => void, - onRelease?: (element: UICustomElement) => void, - onContainerInit?: (element: UICustomElement, container: container.UiAbstractContainer, elementName: string) => void - } - } - export class UICustomElement extends UIElement { - static class: java.lang.Class; - constructor(win: window.UIWindow, desc: CustomElementDescription); - getScope(): object; - onSetup(desc: CustomElementDescription): void; - onDraw(canvas: android.graphics.Canvas, scale: number): void; - onTouchReleased(event: types.TouchEvent): void; - onBindingUpdated(name: string, val: T): void; - onReset(): void; - onRelease(): void; - setupInitialBindings(container: container.UiAbstractContainer, elementName: string): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIElement.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIElement.d.ts deleted file mode 100644 index 13ded491b..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIElement.d.ts +++ /dev/null @@ -1,116 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module elements { - /** - * Object where you can specify how the UI element will behave on touch events. - */ - export interface UIClickEvent { - /** - * This function will be called when element is short touched. - */ - onClick?: (position: Vector, container: container.UiAbstractContainer | apparatus.api.container.ItemContainer, tileEntity: Nullable | any, window: window.IWindow, canvas: android.graphics.Canvas, scale: number) => void; - /** - * This function will be called when element is long touched. - */ - onLongClick?: (position: Vector, container: container.UiAbstractContainer | apparatus.api.container.ItemContainer, tileEntity: Nullable | any, window: window.IWindow, canvas: android.graphics.Canvas, scale: number) => void; - } - /** - * Types that can be used to create element texture. - * For static textures it can be string path to texture in assets directory, or {@link android.graphics.Bitmap} instance. - * For animated textures it can be array of string paths to texture in assets directory, or an array of {@link android.graphics.Bitmap} instances. - * Each element in the array represents one of animation frames. - */ - export type BitmapTypes = string | string[] | android.graphics.Bitmap | android.graphics.Bitmap[]; - /** - * There are 12 types of UI elements given by Inner Core, and you can also create your custom ones. - * Each element type has it's own specific description object. - * These description objects are all inherited from this BasicElementDescription. - * It means that each element must have coords on the GUI by X, Y, and additionally Z axis, - * and also you can specify how the element will behave when touched, in clicker object (optional). - */ - export interface BasicElementDescription extends Scriptable { - x?: number, y?: number, z?: number, - clicker?: UIClickEvent - } - /** - * This is the base Java abstract class, which are all Inner Core element types inherited from. - * In Java, to create custom element types, you can inherit your element class from this one as well. - * Whereas in JavaScript, you should use "custom" element type in description object, - * where you can specify custom behavior for different events. - * For more information about custom element types in JavaScript, - * see {@link UI.UICustomElement}. - */ - export abstract class UIElement extends java.lang.Object { - static class: java.lang.Class; - cleaner: UIElementCleaner; - description: object; - descriptionWatcher: util.ScriptableWatcher; - elementName: string; - elementRect: android.graphics.Rect; - isDirty: boolean; - isTouched: boolean; - window: window.UIWindow; - x: number; - y: number; - z: number; - abstract onBindingUpdated(str: string, obj: T): void; - abstract onDraw(canvas: android.graphics.Canvas, scale: number): void; - abstract onSetup(descr?: T): void; - /** - * Creates a new {@link UI.Texture} instance - * with specified style applied. - * See {@link UI.Texture.constructor} for parameters description. - */ - createTexture(obj: BitmapTypes): types.Texture; - /** - * Sets element's position in the window's unit coordinates. - * @param x x position - * @param y y position - */ - setPosition(x: number, y: number): void; - /** - * Sets element's size in the window's unit coordinates. - * @param width element's width - * @param height element's height - */ - setSize(width: number, height: number): void; - constructor(window: window.UIWindow, scriptable: object); - getCleanerCopy(): UIElementCleaner; - /** - * Passes any value to the element. - * @param bindingName binding name, you can access the value from the - * element by this name - * @param value value to be passed to the element - */ - setBinding(bindingName: string, value: T): void; - /** - * Gets any value from the element. - * @param name binding name, you can access the value from the - * element by this name; some binding names are reserved for additional - * element information, e.g. `"element_obj"` contains pointer to the - * current object and `"element_rect"` contains {@link android.graphics.Rect} - * object containing drawing rectangle - * @returns Value that was get from the element or `null` if the element - * doesn't exist. - */ - getBinding(name: string): UIElement | android.graphics.Rect | T; - setupInitialBindings(container: container.UiAbstractContainer, elementName: string): void; - onTouchEvent(event: types.TouchEvent): void; - onTouchReleased(event: types.TouchEvent): void; - isReleased(): boolean; - onRelease(): void; - onReset(): void; - invalidate(): void; - debug(canvas: android.graphics.Canvas, scale: number): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIElementCleaner.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIElementCleaner.d.ts deleted file mode 100644 index 1dc1b9693..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIElementCleaner.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module elements { - export class UIElementCleaner extends java.lang.Object { - static class: java.lang.Class; - element: UIElement; - rect: android.graphics.Rect; - constructor(element: UIElement); - clone(): UIElementCleaner; - set(rect: android.graphics.Rect): void; - clean(canvas: android.graphics.Canvas, scale: number): void; - debug(canvas: android.graphics.Canvas, scale: number): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIFPSTextElement.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIFPSTextElement.d.ts deleted file mode 100644 index 317c8f270..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIFPSTextElement.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module elements { - export interface FPSTextElementDescription extends BasicElementDescription { - type: "fps", - font?: types.FontDescription, - multiline?: boolean, - format?: boolean, - formatMaxCharsPerLine?: number, - text?: string, - interpolate?: boolean, - period?: number - } - export class UIFPSTextElement extends UITextElement { - static class: java.lang.Class; - constructor(win: window.UIWindow, desc: FPSTextElementDescription); - onSetup(desc: FPSTextElementDescription): void; - onDraw(canvas: android.graphics.Canvas, scale: number): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIFrameElement.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIFrameElement.d.ts deleted file mode 100644 index 7f804475d..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIFrameElement.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module elements { - export interface FrameElementDescription extends BasicElementDescription { - type: "frame", - bitmap?: BitmapTypes, - width?: number, height?: number, - scale?: number, - color?: number, - sides?: types.Sides - } - export class UIFrameElement extends UIElement { - static class: java.lang.Class; - constructor(win: window.UIWindow, desc: FrameElementDescription); - onSetup(desc: FrameElementDescription): void; - onDraw(canvas: android.graphics.Canvas, scale: number): void; - onBindingUpdated(name: string, val: T): void; - onRelease(): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIImageElement.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIImageElement.d.ts deleted file mode 100644 index c80025466..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIImageElement.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module elements { - export interface ImageElementDescription extends BasicElementDescription { - type: "image", - width?: number, height?: number, - scale?: number, - bitmap?: BitmapTypes, - overlay?: BitmapTypes - } - export class UIImageElement extends UIElement { - static class: java.lang.Class; - height: number; - overlay: types.Texture; - texture: types.Texture; - textureScale: number; - width: number; - constructor(win: window.UIWindow, desc: ImageElementDescription); - onSetup(desc: ImageElementDescription): void; - isAnimated(): boolean; - onDraw(canvas: android.graphics.Canvas, scale: number): void; - onBindingUpdated(name: string, val: T): void; - onRelease(): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIInvSlotElement.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIInvSlotElement.d.ts deleted file mode 100644 index 66d3466ad..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIInvSlotElement.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module elements { - export interface InvSlotElementDescription extends BasicElementDescription { - type: "invSlot" | "invslot", - bitmap?: string, - size?: number, - maxStackSize?: number, - visual?: boolean, - darken?: boolean, - isDarkenAtZero?: boolean, - text?: string, - onItemChanged?: (container: container.UiAbstractContainer, oldId: number, oldCount: number, oldData: number) => void, - isValid?: (id: number, count: number, data: number, container: container.UiAbstractContainer, item: ItemInstance) => boolean, - index?: number; - } - export class UIInvSlotElement extends UISlotElement { - static class: java.lang.Class; - constructor(win: window.UIWindow, desc: UIInvSlotElement); - onSetup(desc: InvSlotElementDescription): void; - onTouchEvent(event: types.TouchEvent): void; - onBindingUpdated(name: string, val: T): void; - setupInitialBindings(container: container.UiAbstractContainer, elementName: string): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIScaleElement.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIScaleElement.d.ts deleted file mode 100644 index 7c1ffcb2d..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIScaleElement.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module elements { - export interface ScaleElementDescription extends BasicElementDescription { - type: "scale", - scale?: number, - direction?: number, - invert?: boolean, - pixelate?: boolean, - bitmap?: string, - width?: number, height?: number, - background?: string, - backgroundOffset?: { x?: number, y?: number }, - overlay?: string, - overlayOffset?: { x?: number, y?: number }, - value?: number - } - export class UIScaleElement extends UIElement { - static class: java.lang.Class; - static readonly DIRECTION_DOWN: number; - static readonly DIRECTION_LEFT: number; - static readonly DIRECTION_RIGHT: number; - static readonly DIRECTION_UP: number; - constructor(win: window.UIWindow, desc: ScaleElementDescription); - onSetup(desc: ScaleElementDescription): void; - onDraw(canvas: android.graphics.Canvas, scale: number): void; - onBindingUpdated(name: string, val: T): void; - onRelease(): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIScrollElement.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIScrollElement.d.ts deleted file mode 100644 index e6f6bd0c9..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UIScrollElement.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module elements { - export interface ScrollElementDescription extends BasicElementDescription { - type: "scroll", - isInt?: boolean, - width?: number, length?: number, - min?: number, max?: number, - divider?: number, - bindingObject?: any, - bindingProperty?: string, - configValue?: Config.ConfigValue, - bitmapHandle?: BitmapTypes, - bitmapHandleHover?: BitmapTypes, - bitmapBg?: string, - bitmapBgHover?: string, - ratio?: number, - onNewValue?: (result: number, container: container.UiAbstractContainer, element: UIScrollElement) => void - } - export class UIScrollElement extends UIElement { - static class: java.lang.Class; - constructor(win: window.UIWindow, desc: ScrollElementDescription); - onSetup(desc: ScrollElementDescription): void; - onDraw(canvas: android.graphics.Canvas, scale: number): void; - onBindingUpdated(name: string, val: T): void; - onRelease(): void; - onTouchEvent(event: types.TouchEvent): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UISlotElement.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UISlotElement.d.ts deleted file mode 100644 index a26e16307..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UISlotElement.d.ts +++ /dev/null @@ -1,75 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module elements { - export interface SlotElementDescription extends BasicElementDescription { - type: "slot", - bitmap?: string, - size?: number, - maxStackSize?: number, - visual?: boolean, - darken?: boolean, - isDarkenAtZero?: boolean, - /** - * @since 2.0.4b42 - */ - text?: string, - source?: ItemInstance, - /** - * @deprecated In 2.0.4b43, not needed anymore. - */ - isTransparentBackground?: boolean, - /** - * @deprecated In 2.0.4b43, not needed anymore. - */ - needClean?: boolean, - /** - * @default 0.82 - * @since 2.2.1b96 - */ - iconScale?: number, - /** - * @default false - * @since 2.2.1b96 - */ - disablePixelPerfect?: boolean, - onItemChanged?: (container: container.UiAbstractContainer, oldId: number, oldCount: number, oldData: number) => void, - isValid?: (id: number, count: number, data: number, container: container.Container, item: ItemInstance) => boolean; - } - export class UISlotElement extends UIElement { - static class: java.lang.Class; - background: types.Texture; - curCount: number; - curData: number; - curExtra: Nullable; - curId: number; - isDarken: boolean; - isDarkenAtZero: boolean; - isVisual: boolean; - maxStackSize: number; - size: number; - slotName: string; - source: container.UiVisualSlotImpl; - textOverride: Nullable; - constructor(win: window.UIWindow, desc: SlotElementDescription); - onSetup(desc: UISlotElement): void; - onDraw(canvas: android.graphics.Canvas, scale: number): void; - onBindingUpdated(name: string, val: T): void; - setupInitialBindings(container: container.UiAbstractContainer, elementName: string): void; - onRelease(): void; - onReset(): void; - getMaxStackSize(): number; - isValidItem(id: number, count: number, data: number, extra: Nullable): boolean; - getMaxItemTransferAmount(slot: UISlotElement): number; - onTouchEvent(event: types.TouchEvent): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UISwitchElement.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UISwitchElement.d.ts deleted file mode 100644 index f078b2a10..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UISwitchElement.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module elements { - export interface SwitchElementDescription extends BasicElementDescription { - type: "switch", - bindingObject?: any, - bindingProperty?: string, - configValue?: Config.ConfigValue, - bitmapOn?: BitmapTypes, - bitmapOnHover?: BitmapTypes, - bitmapOff?: BitmapTypes, - bitmapOffHover?: BitmapTypes, - scale?: number, - onNewState?: (val: boolean, container: container.UiAbstractContainer, element: UISwitchElement) => void - } - export class UISwitchElement extends UIElement { - static class: java.lang.Class; - constructor(win: window.UIWindow, desc: SwitchElementDescription); - onSetup(desc: SwitchElementDescription): void; - onDraw(canvas: android.graphics.Canvas, scale: number): void; - onBindingUpdated(name: string, val: T): void; - onTouchEvent(event: types.TouchEvent): void; - onRelease(): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UITabElement.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UITabElement.d.ts deleted file mode 100644 index 6f0d9570b..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UITabElement.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module elements { - export interface TabElementDescription extends BasicElementDescription { - type: "tab", - selectedColor?: number, - deselectedColor?: number, - tabIndex?: number, - isAlwaysSelected?: boolean, - isSelected?: boolean - } - export class UITabElement extends UIFrameElement { - static class: java.lang.Class; - constructor(win: window.UIWindow, desc: TabElementDescription); - onSetup(desc: TabElementDescription): void; - onTouchEvent(event: types.TouchEvent): void; - onReset(): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UITextElement.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UITextElement.d.ts deleted file mode 100644 index a31d6d859..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/elements/UITextElement.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module elements { - export interface TextElementDescription extends BasicElementDescription { - type: "text", - font?: types.FontDescription, - multiline?: boolean, - format?: boolean, - formatMaxCharsPerLine?: number, - text?: string - } - export class UITextElement extends UIElement { - static class: java.lang.Class; - constructor(win: window.UIWindow, desc: TextElementDescription); - onSetup(desc: TextElementDescription): void; - onDraw(canvas: android.graphics.Canvas, scale: number): void; - onBindingUpdated(name: string, val: T): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/icon/ItemIconLoader.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/icon/ItemIconLoader.d.ts deleted file mode 100644 index 3d092c531..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/icon/ItemIconLoader.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module icon { - export class ItemIconLoader extends java.lang.Object { - static class: java.lang.Class; - static load(): void; - static init(): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/icon/ItemIconSource.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/icon/ItemIconSource.d.ts index f6ef3e4f5..5a02dc926 100644 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/icon/ItemIconSource.d.ts +++ b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/icon/ItemIconSource.d.ts @@ -1,11 +1,11 @@ declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module icon { - export class ItemIconSource extends java.lang.Object { + namespace zhekasmirnov { + namespace innercore { + namespace api { + namespace mod { + namespace ui { + namespace icon { + class ItemIconSource extends java.lang.Object { static class: java.lang.Class; static readonly instance: ItemIconSource; private constructor(); @@ -29,4 +29,4 @@ declare module com { } } } -} \ No newline at end of file +} diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/icon/ItemModels.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/icon/ItemModels.d.ts index a1be23c4b..0f4ad03c7 100644 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/icon/ItemModels.d.ts +++ b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/icon/ItemModels.d.ts @@ -1,11 +1,11 @@ declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module icon { - export class ItemModels extends java.lang.Object { + namespace zhekasmirnov { + namespace innercore { + namespace api { + namespace mod { + namespace ui { + namespace icon { + class ItemModels extends java.lang.Object { static class: java.lang.Class; static readonly ATLAS_NAME = "textures/entity/camera_tripod"; static readonly ATLAS_PATH: string; @@ -24,10 +24,10 @@ declare module com { static getModelInfo(id: number, data: number): ItemModels.ModelInfo; static updateBlockShape(id: number, data: number, shape: unlimited.BlockShape): void; static setCustomUiModel(id: number, data: number, model: GuiBlockModel): void; - static getItemOrBlockModel(id: number, count: number, data: number, scale: number, rX: number, rY: number, rZ: number, randomize: boolean): NativeRenderer.Renderer; + static getItemOrBlockModel(id: number, count: number, data: number, scale: number, rX: number, rY: number, rZ: number, randomize: boolean): Render.Renderer; } - export module ItemModels { - export class ModelInfo extends java.lang.Object { + namespace ItemModels { + class ModelInfo extends java.lang.Object { static class: java.lang.Class; private constructor(idKey: string); getModel(): GuiBlockModel; @@ -38,7 +38,7 @@ declare module com { writeToCache(bmp: android.graphics.Bitmap): void; setShape(shape: unlimited.BlockShape): void; } - export class AltasUnit extends java.lang.Object { + class AltasUnit extends java.lang.Object { static class: java.lang.Class; readonly bitmap: android.graphics.Bitmap; readonly pos: number; @@ -52,4 +52,4 @@ declare module com { } } } -} \ No newline at end of file +} diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/memory/BitmapCache.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/memory/BitmapCache.d.ts deleted file mode 100644 index 5afb005a6..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/memory/BitmapCache.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module memory { - export class BitmapCache extends java.lang.Object { - static class: java.lang.Class; - static readonly CACHE_DIR: string; - static init(): void; - static getCacheFile(name: string): java.io.File; - static getUseId(): number; - static getStackPos(id: number): number; - static registerWrap(wrap: BitmapWrap): void; - static unregisterWrap(wrap: BitmapWrap): void; - static writeToFile(file: java.io.File, bitmap: android.graphics.Bitmap): void; - static readFromFile(file: java.io.File, bitmap: android.graphics.Bitmap): void; - static testCaching(src: android.graphics.Bitmap): android.graphics.Bitmap; - static storeOldWraps(maxStackPos: number): void; - static immediateGC(): void; - static asyncGC(): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/memory/BitmapWrap.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/memory/BitmapWrap.d.ts deleted file mode 100644 index c19503210..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/memory/BitmapWrap.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module memory { - export abstract class BitmapWrap extends java.lang.Object { - static class: java.lang.Class; - static readonly MISSING_BITMAP: android.graphics.Bitmap; - abstract resize(x: number, y: number): BitmapWrap; - abstract restore(): boolean; - abstract store(): boolean; - constructor(); - storeIfNeeded(): void; - restoreIfNeeded(): void; - getWidth(): number; - getHeight(): number; - getConfig(): android.graphics.Bitmap.Config; - getStackPos(): number; - get(): android.graphics.Bitmap; - isRecycled(): boolean; - recycle(): void; - removeCache(): void; - getResizedCache(width: number, height: number): android.graphics.Bitmap; - static wrap(bmp: android.graphics.Bitmap): BitmapWrap; - static wrap(name: string, width: number, height: number): BitmapWrap; - static wrap(name: string): BitmapWrap; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/memory/RandomBitmapWrap.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/memory/RandomBitmapWrap.d.ts deleted file mode 100644 index 4560af902..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/memory/RandomBitmapWrap.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module memory { - export class RandomBitmapWrap extends BitmapWrap { - static class: java.lang.Class; - constructor(bitmap: android.graphics.Bitmap); - store(): boolean; - restore(): boolean; - resize(width: number, height: number): BitmapWrap; - recycle(): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/memory/SourceBitmapWrap.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/memory/SourceBitmapWrap.d.ts deleted file mode 100644 index 565fb6f6f..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/memory/SourceBitmapWrap.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module memory { - export class SourceBitmapWrap extends BitmapWrap { - static class: java.lang.Class; - constructor(name: string, width: number, height: number); - store(): boolean; - restore(): boolean; - resize(width: number, height: number): BitmapWrap; - recycle(): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/types/Font.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/types/Font.d.ts deleted file mode 100644 index c94c78e76..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/types/Font.d.ts +++ /dev/null @@ -1,149 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module types { - /** - * Object containing font parameters. If no color, size and shadow are - * specified, default values are ignored and white font with text size 20, - * white color and 0.45 shadow is created. - */ - export interface FontDescription { - /** - * Font color, android integer color value (produced by - * {@link android.graphics.Color}). - * @default 0x000 // black - */ - color?: number, - /** - * Font size. - * @default 20 - */ - size?: number, - /** - * Font shadow offset. - * @default 0 // no shadow - */ - shadow?: number, - /** - * Font alignment, one of the - * {@link com.zhekasmirnov.innercore.api.mod.ui.types.Font.ALIGN_DEFAULT Font.ALIGN_DEFAULT}, - * {@link com.zhekasmirnov.innercore.api.mod.ui.types.Font.ALIGN_CENTER Font.ALIGN_CENTER}, - * {@link com.zhekasmirnov.innercore.api.mod.ui.types.Font.ALIGN_END Font.ALIGN_END} constants. - */ - alignment?: number, - /** - * Same as {@link com.zhekasmirnov.innercore.api.mod.ui.types.FontDescription.alignment FontDescription.alignment}. - */ - align?: number, - /** - * If `true`, the font is bold, `false` otherwise. - * @default false - */ - bold?: boolean, - /** - * If `true`, the font is italic, `false` otherwise. - * @default false - */ - cursive?: boolean, - /** - * If `true`, the font is underlined, `false` otherwise. - * @default false - */ - underline?: boolean - } - export class Font extends java.lang.Object { - static class: java.lang.Class; - /** - * Aligns text to the start of the element (left for English locale). - */ - static readonly ALIGN_CENTER: number; - /** - * Aligns text to the center of the element. - */ - static readonly ALIGN_DEFAULT: number; - /** - * Aligns text to the end of the element (right for English locale). - */ - static readonly ALIGN_END: number; - /** - * Aligns text to the center of the element horizontally. - * @since 2.2.1b96 - */ - static readonly ALIGN_CENTER_HORIZONTAL: number; - alignment: number; - color: number; - isBold: boolean; - isCursive: boolean; - isUnderlined: boolean; - shadow: number; - size: number; - /** - * Constructs new instance of the font with specified parameters. - * @param color font color, android integer color value (produced by - * android.graphics.Color) - * @param size font size - * @param shadow shadow offset - */ - constructor(color: number, size: number, shadow: number); - /** - * Constructs new instance of the font with specified parameters. - * @param params parameters of the font - */ - constructor(params: FontDescription); - /** - * Draws text on the canvas using created font. - * @param canvas {@link android.graphics.Canvas} instance to draw the text on - * @param x x coordinate of the text in pixels - * @param y x coordinate of the text in pixels - * @param text text string to draw - * @param scale additional scale to apply to the text - */ - drawText(canvas: android.graphics.Canvas, x: number, y: number, text: string, scale: number): void; - /** - * Calculates bounds of the text given text position, text string and - * additional scale. - * @returns rect object containing calculated bounds of - * the text - */ - getBounds(text: string, x: number, y: number, scale: number): android.graphics.Rect; - /** - * Calculates text width given text string and additional scale. - * @returns width of the specified string when painted with specified - * scale - */ - getTextWidth(text: string, scale: number): number; - /** - * Calculates text height given text string and additional scale. - * @returns height of the specified string when painted with specified - * scale - */ - getTextHeight(text: string, x: number, y: number, scale: number): number; - /** - * Converts current {@link com.zhekasmirnov.innercore.api.mod.ui.types.Font Font} object to scriptable font description. - */ - asScriptable(): FontDescription; - - /* : "Not sure about these two methods, that I saw in previous docs. - I can't see them in sources 0_0" */ - - /** - * Sets listener to be notified about window opening/closing events. - */ - setEventListener(listener: window.IWindowEventListener | UI.WindowEventListener): void; - /** - * Sets listener to be notified about tab with specified index opening/closing events. - * @param tab tab index - * @param listener object to be notified about the events - */ - setTabEventListener(tab: number, listener: window.IWindowEventListener | UI.WindowEventListener): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/types/FrameTexture.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/types/FrameTexture.d.ts deleted file mode 100644 index 63e55a56f..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/types/FrameTexture.d.ts +++ /dev/null @@ -1,119 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module types { - /** - * Object used to manipulate frame textures. - */ - export class FrameTexture extends java.lang.Object { - static class: java.lang.Class; - /** - * Specifies bottom left corner of the frame. - */ - static readonly CORNER_BOTTOM_LEFT: number; - /** - * Specifies bottom right corner of the frame. - */ - static readonly CORNER_BOTTOM_RIGHT: number; - /** - * Specifies top left corner of the frame. - */ - static readonly CORNER_TOP_LEFT: number; - /** - * Specifies top right corner of the frame. - */ - static readonly CORNER_TOP_RIGHT: number; - /** - * Specifies bottom side of the frame. - */ - static readonly SIDE_BOTTOM: number; - /** - * Specifies left side of the frame. - */ - static readonly SIDE_LEFT: number; - /** - * Specifies right side of the frame. - */ - static readonly SIDE_RIGHT: number; - /** - * Specifies top side of the frame. - */ - static readonly SIDE_TOP: number; - constructor(source: android.graphics.Bitmap); - /** - * Expands side of the texture by specified amount of pixels. - * @param sideId side of the texture, one of the - * **FrameTexture.SIDE_LEFT**, **FrameTexture.SIDE_RIGHT**, - * **FrameTexture.SIDE_UP**, **FrameTexture.SIDE_DOWN** constants - * @returns Expanded {@link android.graphics.Bitmap} instance with the frame. - */ - expandSide(sideId: number, pixels: number): android.graphics.Bitmap; - /** - * Expands texture to the specified side, filling the middle with - * specified color. - * @param color integer color value produced by {@link android.graphics.Color} - * class - * @param sides array of booleans marking whether the side should be - * expanded or not. The order of the sides is - * **FrameTexture.SIDE_LEFT**, **FrameTexture.SIDE_RIGHT**, - * **FrameTexture.SIDE_UP**, **FrameTexture.SIDE_DOWN** - * @returns Expanded {@link android.graphics.Bitmap} instance with the frame. - */ - expand(width: number, height: number, color: number, sides: [boolean, boolean, boolean, boolean]): android.graphics.Bitmap; - /** - * Expands texture to the specified side, filling the middle with - * specified color. - * @param color integer color value produced by {@link android.graphics.Color} - * class - */ - expand(width: number, height: number, color: number): android.graphics.Bitmap; - /** - * Expands texture to the specified side, filling the middle with - * specified color. - * @param scale scale of the created bitmap - * @param color integer color value produced by {@link android.graphics.Color} - * class - * @param sides array of booleans marking whether the side should be - * expanded or not. See {@link com.zhekasmirnov.innercore.api.mod.ui.types.FrameTexture.expand FrameTexture.expand} parameters for details. - * Default behavior is to scale all sides - * @returns Expanded and scaled {@link android.graphics.Bitmap} instance. - */ - expandAndScale(width: number, height: number, scale: number, color: number, sides: [boolean, boolean, boolean, boolean]): android.graphics.Bitmap; - /** - * Expands texture to the specified side, filling the middle with - * specified color. - * @param scale scale of the created bitmap - * @param color integer color value produced by {@link android.graphics.Color} - * class - */ - expandAndScale(width: number, height: number, scale: number, color: number): android.graphics.Bitmap; - /** - * @returns Original frame texture source stored in - * {@link android.graphics.Bitmap} instance. - */ - getSource(): android.graphics.Bitmap; - /** - * @param side side of the texture, one of the - * **FrameTexture.SIDE_LEFT**, **FrameTexture.SIDE_RIGHT**, - * **FrameTexture.SIDE_UP**, **FrameTexture.SIDE_DOWN** constants - * @returns Texture side source extracted from the original frame - * texture source stored in {@link android.graphics.Bitmap} instance. - */ - getSideSource(side: number): android.graphics.Bitmap; - /** - * @returns Object packed integer color value - * of the central pixel of the source texture. - */ - getCentralColor(): number; - draw(canvas: android.graphics.Canvas, rect: android.graphics.RectF, scale: number, color: number, sides: [boolean, boolean, boolean, boolean]): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/types/FrameTextureSource.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/types/FrameTextureSource.d.ts deleted file mode 100644 index 1ae2ea255..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/types/FrameTextureSource.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module types { - export interface Sides { up?: boolean, down?: boolean, left?: boolean, right?: boolean } - export class FrameTextureSource extends java.lang.Object { - static class: java.lang.Class; - static getFrameTexture(name: string, style: UIStyle): FrameTexture; - static scriptableAsSides(obj: Sides): [boolean, boolean, boolean, boolean]; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/types/ITouchEventListener.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/types/ITouchEventListener.d.ts deleted file mode 100644 index dd15435aa..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/types/ITouchEventListener.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module types { - export interface ITouchEventListenerJS { - (touchEvent: TouchEvent): void; - } - export class ITouchEventListener extends java.lang.Object { - static class: java.lang.Class; - constructor(); - constructor(impl: { onTouchEvent: (event: TouchEvent) => void }); - onTouchEvent(event: TouchEvent): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/types/Texture.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/types/Texture.d.ts deleted file mode 100644 index b11cf595d..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/types/Texture.d.ts +++ /dev/null @@ -1,85 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module types { - export class Texture extends java.lang.Object { - static class: java.lang.Class; - animation: memory.BitmapWrap[]; - bitmap: memory.BitmapWrap; - delay: number; - isAnimation: boolean; - /** - * Constructs new static {@link Texture} with specified bitmap. - * @param bitmap {@link android.graphics.Bitmap} instance - */ - constructor(bitmap: android.graphics.Bitmap); - /** - * Constructs new animated {@link Texture} with specified frames. - * @param bitmaps an array of {@link android.graphics.Bitmap} instances to be - * used as animation frames - */ - constructor(bitmaps: android.graphics.Bitmap[]); - /** - * Constructs new static or animated {@link Texture} with specified frames. - * @param obj texture name or array of texture names for animated - * textures. Accepts raw gui textures names and style bindings - * (formatted as "style:binding_name"). - * @param style {@link com.zhekasmirnov.innercore.api.mod.ui.types.UIStyle UIStyle} object to look for style bindings. If not - * specified, default style is used - */ - constructor(obj: string | {[key: string]: string}, style?: UIStyle); - isAnimated(): boolean; - /** - * Sets texture offsets in pixels from the upper left bound of the bitmap. - */ - readOffset(obj: { x?: number, y?: number }): void; - /** - * @returns Frame number of the animation corresponding to current system time. - */ - getFrame(): number; - /** - * @param frame frame number - * @returns Bitmap object containing animation frame - * for the corresponding frame number. - */ - getBitmap(frame: number): android.graphics.Bitmap; - getBitmapWrap(frame: number): memory.BitmapWrap; - draw(canvas: android.graphics.Canvas, x: number, y: number, scale: number): void; - drawCutout(canvas: android.graphics.Canvas, cutout: android.graphics.RectF, x: number, y: number, scale: number): void; - /** - * @returns Width of the texture in pixels. - */ - getWidth(): number; - /** - * @returns Height of the texture in pixels. - */ - getHeight(): number; - /** - * Resizes all the frames of the texture to the specified size. - */ - resizeAll(width: number, height: number): void; - /** - * Resizes all the frames by constant scale multiplier. - * @param scale scale to modify the frames by - */ - rescaleAll(scale: number): void; - /** - * Resizes all the frames to match the first one. - */ - fitAllToOneSize(): void; - /** - * Releases all allocated resources, should be called when the texture - * is not longer needed. - */ - release(): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/types/TouchEvent.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/types/TouchEvent.d.ts deleted file mode 100644 index 5d380f4e7..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/types/TouchEvent.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module types { - export class TouchEvent extends java.lang.Object { - static class: java.lang.Class; - _x: number; - _y: number; - downX: number; - downY: number; - localX: number; - localY: number; - type: TouchEventType; - x: number; - y: number; - constructor(listener: ITouchEventListener | ITouchEventListenerJS); - hasMovedSinceLastDown(): boolean; - update(event: android.view.MotionEvent): void; - preparePosition(win: window.UIWindow, rect: android.graphics.Rect): void; - posAsScriptable(): { x: number, y: number }; - localPosAsScriptable(): { x: number, y: number }; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/types/TouchEventType.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/types/TouchEventType.d.ts deleted file mode 100644 index 31039a4e1..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/types/TouchEventType.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module types { - export class TouchEventType extends java.lang.Object { - static class: java.lang.Class; - static readonly DOWN: TouchEventType; - static readonly UP: TouchEventType; - static readonly MOVE: TouchEventType; - static readonly CLICK: TouchEventType; - static readonly LONG_CLICK: TouchEventType; - static readonly CANCEL: TouchEventType; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/types/UIStyle.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/types/UIStyle.d.ts deleted file mode 100644 index dd014dc87..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/types/UIStyle.d.ts +++ /dev/null @@ -1,98 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module types { - /** - * Object containing binding names as keys and string values as gui textures - * names. - */ - export type BindingSet = {[key: string]: string}; - /** - * Object representing window style. Window styles allows to customize the - * way your windows look like. - */ - export class UIStyle extends java.lang.Object { - static class: java.lang.Class; - /** - * Classic (0.16.*-like) windows style, which also used before - * legacy version. - */ - static readonly CLASSIC: UIStyle; - /** - * Default windows style. - */ - static readonly DEFAULT: UIStyle; - static readonly LEGACY: UIStyle; - /** - * Adds gui texture name to use for the specified window part. - * @param key binding name - * @param name gui texture name - */ - addBinding(key: string, name: string): void; - /** - * Gets texture binding bt it's name. Searches first in the additional - * styles, then in the current style, then in all it's parents. - * @param key binding name - * @param fallback value to return on binding failure - * @returns Ui texture name if current object, additional styles or one - * of the parents contains such a binding name, fallback otherwise. - */ - getBinding(key: string, fallback: string): string; - /** - * Adds an additional style object to the current style. - * @param style additional style object to be added - */ - addStyle(style: UIStyle): void; - /** - * Constructs new {@link com.zhekasmirnov.innercore.api.mod.ui.types.UIStyle UIStyle} object - * with bindings from {@link com.zhekasmirnov.innercore.api.mod.ui.types.UIStyle.DEFAULT UIStyle.DEFAULT}. - */ - constructor(); - /** - * Constructs new {@link com.zhekasmirnov.innercore.api.mod.ui.types.UIStyle UIStyle} object - * from given {@link com.zhekasmirnov.innercore.api.mod.ui.types.BindingSet BindingSet} object. - */ - constructor(bindings: BindingSet); - /** - * @returns A copy of the current style. Only style bindings of the - * current style are copied, no parent/additional styles are copied. - */ - copy(): UIStyle; - /** - * Specifies parent style object for the current style. - * @param style style to be set as parent - */ - inherit(style: UIStyle): void; - /** - * Adds all values from given {@link com.zhekasmirnov.innercore.api.mod.ui.types.BindingSet BindingSet} object. - */ - addAllBindings(bindings: BindingSet): void; - /** - * @returns Collection containing all binding names - * from the current style object. - */ - getAllBindingNames(): java.util.Collection; - /** - * If name is a style value (starts with `"style:"`), returns - * corresponding gui texture name, else returns input string. - * @param name style value or bitmap name - */ - getBitmapName(name: string): string; - getIntProperty(name: string, fallback: number): number; - getFloatProperty(name: string, fallback: number): number; - getDoubleProperty(name: string, fallback: number): number; - getStringProperty(name: string, fallback: string): string; - getBooleanProperty(name: string, fallback: boolean): boolean; - setProperty(name: string, value: any): void; - static getBitmapByDescription(style: UIStyle, description: string): memory.BitmapWrap; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/IWindow.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/IWindow.d.ts deleted file mode 100644 index d29b08368..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/IWindow.d.ts +++ /dev/null @@ -1,120 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module window { - export class IWindow extends java.lang.Object { - static class: java.lang.Class; - constructor(); - /** - * Constructs new object inherited from {@link UI.IWindow}. - * You need to implement all the interface methods in the object param. - */ - constructor(impl: { - close(): void; - frame(frm: number): void; - getContainer(): container.UiAbstractContainer; - getContent(): WindowContent; - getElements(): java.util.HashMap; - getStyle(): types.UIStyle; - invalidateDrawing(onCurrentThread: boolean): void; - invalidateElements(onCurrentThread: boolean): void; - isDynamic(): boolean; - isInventoryNeeded(): boolean; - isOpened(): boolean; - onBackPressed(): boolean; - open(): void; - setContainer(container: container.UiAbstractContainer): void; - setDebugEnabled(debug: boolean): void; - }); - /** - * Closes window without container. Use only if the window was opened - * without container. - */ - close(): void; - /** - * Called up to 66 times a second to update window's content. - * @param time current time in milliseconds - */ - frame(time: number): void; - /** - * @returns New {@link UI.Container} - * that was used to open this window or null, if - * the window wasn't opened in container. - */ - getContainer(): Nullable; - /** - * @returns Window's content object - * (usually specified in the window's constructor). - */ - getContent(): WindowContent; - /** - * Gets all the elements in the window. - * @returns HashMap containing string element name as keys and - * element instances as values. - */ - getElements(): java.util.HashMap; - /** - * @returns Object containing current style of the window. - */ - getStyle(): types.UIStyle; - /** - * Forces ui drawables of the window to refresh. - * @param onCurrentThread if `true`, the drawables will be refreshed - * immediately, otherwise refresh event will be posted; ensure you are - * in the UI thread if you pass `true` as the parameter - * @default onCurrentThread: false - */ - invalidateDrawing(onCurrentThread: boolean): void; - /** - * Forces ui elements of the window to refresh. - * @param onCurrentThread if `true`, the drawables will be refreshed - * immediately, otherwise refresh event will be posted; ensure you are - * in the UI thread if you pass `true` as the parameter - * @default onCurrentThread: false - */ - invalidateElements(onCurrentThread: boolean): void; - /** - * @returns `true` if the window can change it's contents position. - */ - isDynamic(): boolean; - /** - * @returns `true` if the window has an inventory that should be updated. - */ - isInventoryNeeded(): boolean; - /** - * @returns `true` if the window is opened, `false` otherwise. - */ - isOpened(): boolean; - /** - * @returns Whether the window can be closed on pressing back navigation button. - */ - onBackPressed(): boolean; - /** - * Opens window without container. - */ - open(): void; - /** - * Sets container for the current window. Be careful when calling it - * manually. You should prefer opening the window via - * {@link com.zhekasmirnov.innercore.api.mod.ui.container.Container.openAs Container.openAs} call. - * @param container {@link UI.Container} - * to be associated with current window or null to associate no container with current window - */ - setContainer(container: Nullable): void; - /** - * Turns debug mode for the window on and off. - * @param debug if `true`, additional debug information will be drawn on - * the window canvas - */ - setDebugEnabled(debug: boolean): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/IWindowEventListener.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/IWindowEventListener.d.ts deleted file mode 100644 index 3e9ded01c..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/IWindowEventListener.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module window { - export class IWindowEventListener extends java.lang.Object { - static class: java.lang.Class; - constructor(implementation: { - onClose(win: UIWindow): void; - onOpen(win: UIWindow): void; - }); - onClose(win: UIWindow): void; - onOpen(win: UIWindow): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIAdaptiveWindow.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIAdaptiveWindow.d.ts deleted file mode 100644 index c8e1d6a29..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIAdaptiveWindow.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module window { - export class UIAdaptiveWindow extends UIWindowGroup { - static class: java.lang.Class; - constructor(content: WindowContent); - setContent(content: WindowContent): void; - /** - * Sets style profile for the current {@link UI.AdaptiveWindow}. - * @param profile 0 for classic profile, 1 for default profile - */ - setProfile(profile: 0 | 1): void; - /** - * Forces {@link UI.AdaptiveWindow} to be displayed using some profile. - * @param profile 0 for classic profile, 1 for default profile or -1 not - * to force any profile. By default forced profile is -1 - */ - setForcedProfile(profile: 0 | 1): void; - open(): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UITabbedWindow.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UITabbedWindow.d.ts deleted file mode 100644 index 8e51c2fe5..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UITabbedWindow.d.ts +++ /dev/null @@ -1,156 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module window { - export interface TabbedWindowContent extends WindowContent { - isButtonHidden?: boolean - } - export class UITabbedWindow extends java.lang.Object implements IWindow { - static class: java.lang.Class; - closeOnBackPressed: boolean; - currentTab: number; - /** - * Sets window location (bounds) to draw window within. - * @param location location to be used for the tabbed window - */ - setLocation(location: UIWindowLocation): void; - /** - * @returns Tab content window width in units. - */ - getInnerWindowWidth(): number; - /** - * @returns Tab content window height in units. - */ - getInnerWindowHeight(): number; - /** - * @returns Tab selector window width in units. - */ - getWindowTabSize(): number; - /** - * @returns Tab selector window width in global units. - */ - getGlobalTabSize(): number; - /** - * Constructs new {@link UI.TabbedWindow} with specified location. - * @param loc location to be used for the tabbed window - */ - constructor(loc: UIWindowLocation); - /** - * Constructs new {@link UI.TabbedWindow} with specified content. - * @param content object containing window description - */ - constructor(content: TabbedWindowContent); - /** - * Sets content of the tab. - * @param index index of the tab; there are 12 tabs available, from 0 to - * 11 - * @param tabOverlay content of the tab selector - * @param tabContent content of the window to be created for the tab - * @param isAlwaysSelected if `true`, tab is always displayed as selected; - * default value is `false` - * @remarks - * The location of the tabs is as follows: - * ```text - * 0 6 - * 1 7 - * 2 8 - * 3 9 - * 4 10 - * 5 11 - * ``` - */ - setTab(index: number, tabOverlay: UI.ElementSet, tabContent: WindowContent, isAlwaysSelected: boolean): void; - /** - * Sets content of the tab. - * @param index index of the tab; there are 12 tabs available, from 0 to - * 11 - * @param tabOverlay content of the tab selector - * @param tabContent content of the window to be created for the tab - * @remarks - * The location of the tabs is as follows: - * ```text - * 0 6 - * 1 7 - * 2 8 - * 3 9 - * 4 10 - * 5 11 - * ``` - */ - setTab(index: number, tabOverlay: UI.ElementSet, tabContent: WindowContent): void; - /** - * Creates fake tab with no content. - * @param index index of the tab, see {@link com.zhekasmirnov.innercore.api.mod.ui.window.UITabbedWindow.setTab UI.TabbedWindow.setTab} for - * details - * @param tabOverlay content of the tab selector - */ - setFakeTab(index: number, tabOverlay: UI.ElementSet): void; - /** - * @param index index of the tab - * @returns New {@link UI.Window} instance - * created for the specified tab or null if - * no window was created for specified window. - */ - getWindowForTab(index: number): Nullable; - open(): void; - close(): void; - frame(time: number): void; - invalidateElements(onCurrentThread: boolean): void; - invalidateDrawing(onCurrentThread: boolean): void; - isOpened(): boolean; - isInventoryNeeded(): boolean; - isDynamic(): boolean; - getElements(): java.util.HashMap; - getContent(): Nullable; - getContainer(): Nullable; - setContainer(container: container.UiAbstractContainer): void; - setDebugEnabled(debug: boolean): void; - setEventListener(listener: IWindowEventListener): void; - setTabEventListener(index: number, listener: IWindowEventListener): void; - onTabSelected(index: number): void; - /** - * Specifies whether the window should darken and block background. - * @param enabled pass `true` if you want the window to block - * background - * @default false - */ - setBlockingBackground(enabled: boolean): void; - /** - * @returns Current default tab index. If no default tab was specified - * via {@link com.zhekasmirnov.innercore.api.mod.ui.window.UITabbedWindow.setDefaultTab UI.TabbedWindow.setDefaultTab}, - * the first tab added becomes default. - */ - getDefaultTab(): number; - /** - * Sets default tab index. - * @param tab index of the tab to be opened by default - */ - setDefaultTab(tab: number): void; - /** - * Sets new style object as current window's style. If the new style is - * a different object then an old one, forces window invalidation. - * @param style {@link UI.Style} object to be used as style for the window - */ - setStyle(style: types.UIStyle): void; - /** - * Overrides style properties of the current style by the values - * specified in the style parameter. - * @param style js object where keys represent binding names and values - * represent texture gui names - */ - setStyle(style: types.BindingSet): void; - getStyle(): Nullable; - getStyleSafe(): types.UIStyle; - setCloseOnBackPressed(cobp: boolean): void; - onBackPressed(): boolean; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIWindow.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIWindow.d.ts deleted file mode 100644 index a6ae0f69c..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIWindow.d.ts +++ /dev/null @@ -1,444 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module window { - /** - * Specifies contents and additional parameters for all types of windows. - */ - export interface WindowContent { - /** - * Specifies window's location, used for - * {@link UI.Window}, {@link UI.TabbedWindow} - * and {@link UI.StandartWindow}. - */ - location?: WindowLocationDescription, - /** - * If {@link com.zhekasmirnov.innercore.api.mod.ui.window.WindowContent.style WindowContent.style} is not specified, - * this argument will be used instead. - */ - params?: types.BindingSet; - /** - * Specifies window's style, an object containing keys as style binding - * names and values as gui texture names corresponding to the binding. - */ - style?: types.BindingSet; - /** - * Array of drawings - */ - drawing?: UI.DrawingSet; - /** - * Object containing keys as gui elements names and {@link UI.Elements} - * instances as values. Gui elements are interactive components that are - * used to create interfaces functionality. - */ - elements?: UI.ElementSet; - } - export namespace StandardWindowDescriptionTypes { - export interface StandardWindowBackground { - /** - * If `true`, default window is created. - */ - standard?: boolean, - /** - * Background color integer value, produced by - * {@link android.graphics.Color} class. - * @default 0xfff // white - */ - color?: number, - /** - * Background bitmap texture name. If the bitmap size doesn't - * match the screen size, bitmap will be stretched to fit. - */ - bitmap?: string, - /** - * Specifies window's frame parameters. - */ - frame?: { - /** - * Frame bitmap scale. - * @default 3 - */ - scale?: number, - /** - * Frame bitmap gui texture name. Defaults to *"frame"* - * style binding or, if not specified, to - * *"default_frame_8"* gui texture - */ - bitmap?: string - } - } - export interface StandardWindowHeaderText { - /** - * Specifies header text. - * @default "No Title" - */ - text?: string, - /** - * Specifies font params for the header text. Only - * {@link com.zhekasmirnov.innercore.api.mod.ui.window.StandardWindowDescriptionTypes.StandardWindowHeaderText.size size}, - * {@link com.zhekasmirnov.innercore.api.mod.ui.window.StandardWindowDescriptionTypes.StandardWindowHeaderText.color color} - * and {@link com.zhekasmirnov.innercore.api.mod.ui.window.StandardWindowDescriptionTypes.StandardWindowHeaderText.shadow shadow} - * properties are used. - */ - font?: types.FontDescription, - /** - * If {@link com.zhekasmirnov.innercore.api.mod.ui.window.StandardWindowDescriptionTypes.StandardWindowHeaderText.font font} is not specified, used as - * {@link com.zhekasmirnov.innercore.api.mod.ui.window.StandardWindowDescriptionTypes.StandardWindowHeaderText.size size} value. - */ - size?: number, - /** - * If {@link com.zhekasmirnov.innercore.api.mod.ui.window.StandardWindowDescriptionTypes.StandardWindowHeaderText.font font} is not specified, used as - * {@link com.zhekasmirnov.innercore.api.mod.ui.window.StandardWindowDescriptionTypes.StandardWindowHeaderText.color color} value. - */ - color?: number, - /** - * If {@link com.zhekasmirnov.innercore.api.mod.ui.window.StandardWindowDescriptionTypes.StandardWindowHeaderText.font font} is not specified, used as - * {@link com.zhekasmirnov.innercore.api.mod.ui.window.StandardWindowDescriptionTypes.StandardWindowHeaderText.shadow shadow} value. - */ - shadow?: number, - } - export interface StandardWindowHeader { - /** - * Specifies whether the header should have shadow or not. If - * `true`, the shadow is not displayed. - * @default false - */ - hideShadow?: boolean, - /** - * Specifies header height in units. - * @default 80 - */ - height?: number, - /** - * If *height* is not specified, used to specify header height - * in units. - */ - width?: number, - /** - * Frame bitmap gui texture name. Defaults to *"headerFrame"* - * style binding or, if not specified, to - * *"default_frame_7"* gui texture. - */ - frame?: string, - /** - * Header background color integer value, produced by - * {@link android.graphics.Color} class. Default is - * *Color.rgb(0x72, 0x6a, 0x70)*. - */ - color?: number, - /** - * Specifies header text styles and value. - */ - text?: StandardWindowHeaderText - /** - * If `true`, close button is not displayed. - * @default false - */ - hideButton?: boolean - } - export interface StandardWindowInventory { - /** - * Inventory width in units. Defaults to 300 units. - */ - width?: number, - /** - * Specifies additional padding for the inventory in units. - * Defaults to 20 units. - */ - padding?: number, - /** - * If `true`, default window is created. - */ - standard?: boolean - } - export interface StandardWindowParams { - /** - * Specifies minimum contents window height. If actual height is - * less then desired, scrolling is used. - */ - minHeight?: number, - /** - * Specifies background properties. - */ - background?: StandardWindowBackground; - /** - * Specifies additional parameters for standard window's header. - */ - header?: StandardWindowHeader - /** - * Specifies parameters for standard inventory window. - */ - inventory?: StandardWindowInventory - } - } - /** - * Extended {@link com.zhekasmirnov.innercore.api.mod.ui.window.WindowContent WindowContent} object with additional params for - * {@link UI.StandartWindow} and {@link UI.StandardWindow}. - */ - export interface StandardWindowContent extends WindowContent { - /** - * Used for {@link UI.StandartWindow}s and {@link UI.StandardWindow StandardWindows}. - * Specifies additional parameters for standard windows. - */ - standard?: StandardWindowDescriptionTypes.StandardWindowParams - } - export class UIWindow extends java.lang.Object implements IWindow { - static class: java.lang.Class; - closeOnBackPressed: boolean; - content: WindowContent; - elementProvider: IElementProvider; - elementView: android.widget.ImageView; - isBackgroundDirty: boolean; - isForegroundDirty: boolean; - layout: android.view.ViewGroup; - location: UIWindowLocation; - updateWindowLocation(): void; - constructor(location: UIWindowLocation); - constructor(content: WindowContent); - /** - * Opens window without container. - */ - open(): void; - /** - * Adds another window as adjacent window, so that several windows open - * at the same time. This allows to divide window into separate parts - * and treat them separately. - * @param window another window to be added as adjacent - */ - addAdjacentWindow(window: UIWindow): void; - /** - * Removes adjacent window from the adjacent windows list. - * @param window another window that was added as adjacent - */ - removeAdjacentWindow(window: UIWindow): void; - preOpen(): void; - postOpen(): void; - /** - * Closes window without container. Use only if the window was opened - * without container. - */ - close(): void; - /** - * Called up to 66 times a second to update window's content. - * @param time current time in milliseconds - */ - frame(time: number): void; - /** - * Forces ui elements of the window to refresh. - * @param onCurrentThread if `true`, the drawables will be refreshed - * immediately, otherwise refresh event will be posted; ensure you are - * in the UI thread if you pass `true` as the parameter - * @default onCurrentThread: false - */ - invalidateElements(onCurrentThread: boolean): void; - /** - * Forces ui drawables of the window to refresh. - * @param onCurrentThread if `true`, the drawables will be refreshed - * immediately, otherwise refresh event will be posted; ensure you are - * in the UI thread if you pass `true` as the parameter - * @default onCurrentThread: false - */ - invalidateDrawing(onCurrentThread: boolean): void; - /** - * @returns `true` if the window is opened, `false` otherwise. - */ - isOpened(): boolean; - postElementRefresh(): void; - postBackgroundRefresh(): void; - forceRefresh(): void; - /** - * Specifies whether touch events should be handled by this window or - * passed to underlying windows (to the game). By default all windows - * are touchable. - * @param touchable pass `true` if the window should handle touch events, - * `false` otherwise - */ - setTouchable(touchable: boolean): void; - /** - * @returns `true` if the window is touchable, `false` otherwise. - */ - isTouchable(): boolean; - /** - * @returns `true` if window blocks background. - */ - isBlockingBackground(): boolean; - /** - * Specifies whether the window should darken and block background. - * @param blockingBackground pass `true` if you want the window to block - * background - * @default false - */ - setBlockingBackground(blockingBackground: boolean): void; - /** - * @returns `true` if the window is game overlay, `false` otherwise. - */ - isNotFocusable(): boolean; - /** - * Allows window to be displayed as game overlay without blocking - * Minecraft sounds. Note that this drops window's FPS. - * @param inGameOverlay if `true`, the window is opened in PopupWindow - * to avoid blocking Minecraft sounds - * @default false - */ - setAsGameOverlay(inGameOverlay: boolean): void; - /** - * Set background color of window. - * @param color integer color value (you can specify it using hex value) - */ - setBackgroundColor(color: number): void; - /** - * @returns `true` if the window has an inventory that should be updated. - */ - isInventoryNeeded(): boolean; - /** - * @returns `true` if the window can change it's contents position. - */ - isDynamic(): boolean; - /** - * Gets all the elements in the window. - * @returns Hashes containing string element names - * as keys and element instances as values. - */ - getElements(): java.util.HashMap; - /** - * @returns Window's content object (usually specified in the window's - * constructor). - */ - getContent(): WindowContent; - /** - * Specifies the content of the window. - * @param content content object to be applied to the window - */ - setContent(content: WindowContent): void; - /** - * @param dynamic specify `true`, if the window contains dynamic - * (animated) elements, `false` otherwise. By default all windows are - * dynamic. Make them static for better performance - */ - setDynamic(dynamic: boolean): void; - /** - * @param inventoryNeeded specify `true` if the window requires player's - * inventory - * @default false - */ - setInventoryNeeded(inventoryNeeded: boolean): void; - invalidateBackground(): void; - invalidateForeground(): void; - /** - * @returns Window's current location object. - */ - getLocation(): UIWindowLocation; - getElementProvider(): IElementProvider; - getBackgroundProvider(): IBackgroundProvider; - getContentProvider(): ContentProvider; - /** - * @returns Unit size (in pixel) in the window's bounds. - */ - getScale(): number; - /** - * @returns Object containing current style of the window. - */ - getStyle(): types.UIStyle; - /** - * Overrides style properties of the current style by the values - * specified in the style parameter. - * @param style js object where keys represent binding names and values - * represent texture gui names - */ - setStyle(style: types.BindingSet): void; - /** - * Sets new style object as current window's style. If the new style is - * a different object then an old one, forces window invalidation. - * @param style {@link UI.Style} object to be used as style for the window - */ - setStyle(style: types.UIStyle): void; - invalidateAllContent(): void; - /** - * Gets custom property by it's name. Custom properties can be used to - * store some values containing window's current state. Note that these - * properties are not saved between Inner Core launches. - * @param name custom property name - * @returns Value set by {@link com.zhekasmirnov.innercore.api.mod.ui.window.UIWindow.putProperty Window.putProperty} - * or null if no value was specified for this name. - */ - getProperty(name: string): T; - /** - * Sets custom property value. - * @param name custom property name - * @param value custom property value - */ - putProperty(name: string, value: T): void; - /** - * @returns Currently {@link UI.Container} - * that was used to open this window or null, if - * the window wasn't opened in container. - */ - getContainer(): Nullable; - /** - * Sets container for the current window. Be careful when calling it - * manually. You should prefer opening the window via it. - * {@link com.zhekasmirnov.innercore.api.mod.ui.container.Container.openAs Container.openAs} call - * @param container {@link UI.Container} - * to be associated with current window - * or null to associate no container with current window - */ - setContainer(container: Nullable): void; - /** - * Turns debug mode for the window on and off. - * @param enabled if `true`, additional debug information will be drawn on - * the window canvas - */ - setDebugEnabled(enabled: boolean): void; - /** - * Sets any window as current window's parent. If current window closes, - * parent window closes too. - * @param parent window to be used as parent window for the current - * window. - */ - setParentWindow(parent: IWindow): void; - /** - * @returns Current window's parent window. - */ - getParentWindow(): Nullable; - /** - * Sets listener to be notified about window opening/closing events. - */ - setEventListener(listener: UI.WindowEventListener | IWindowEventListener): void; - /** - * Gets listener to be notified about window opening/closing events. - * @since 2.3.1b116 - */ - getEventListener(): UI.WindowEventListener | IWindowEventListener; - - runCachePreparation(async: boolean): void; - /** - * Writes debug information about current window to the log. - */ - debug(): void; - /** - * Gives the property to be closed on pressing back navigation button to the given window. - */ - setCloseOnBackPressed(val: boolean): void; - /** - * @returns Whether the window can be closed on pressing back navigation button. - */ - onBackPressed(): boolean; - /** - * @since 2.2.1b96 - */ - updateScrollDimensions(): void; - /** - * @since 2.2.1b96 - */ - updateWindowPositionAndSize(): void; - } - } - } - } - } - } - } -} diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIWindowBackgroundDrawable.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIWindowBackgroundDrawable.d.ts index 78c41339d..978a88a86 100644 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIWindowBackgroundDrawable.d.ts +++ b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIWindowBackgroundDrawable.d.ts @@ -1,16 +1,16 @@ declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module window { - export class UIWindowBackgroundDrawable extends android.graphics.drawable.Drawable implements IBackgroundProvider { + namespace zhekasmirnov { + namespace innercore { + namespace api { + namespace mod { + namespace ui { + namespace window { + class UIWindowBackgroundDrawable extends android.graphics.drawable.Drawable implements UI.IBackgroundProvider { static class: java.lang.Class; - window: UIWindow; - constructor(win: UIWindow); + window: UI.Window; + constructor(win: UI.Window); setBackgroundColor(color: number): void; - addDrawing(drawing: background.IDrawing): void; + addDrawing(drawing: UI.IDrawing): void; clearAll(): void; draw(canvas: NonNullable): void; prepareCache(): void; @@ -32,4 +32,4 @@ declare module com { } } } -} \ No newline at end of file +} diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIWindowElementDrawable.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIWindowElementDrawable.d.ts index 2cf1b4325..7ead052bf 100644 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIWindowElementDrawable.d.ts +++ b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIWindowElementDrawable.d.ts @@ -1,28 +1,28 @@ declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module window { - export class UIWindowElementDrawable extends android.graphics.drawable.Drawable implements IElementProvider, types.ITouchEventListener { + namespace zhekasmirnov { + namespace innercore { + namespace api { + namespace mod { + namespace ui { + namespace window { + class UIWindowElementDrawable extends android.graphics.drawable.Drawable implements UI.IElementProvider { static class: java.lang.Class; isDebugEnabled: boolean; - window: UIWindow; - windowElements: java.util.ArrayList; - constructor(win: UIWindow); - setBackgroundProvider(provider: IBackgroundProvider): void; - addOrRefreshElement(element: elements.UIElement): void; - removeElement(element: elements.UIElement): void; + window: UI.Window; + windowElements: java.util.ArrayList; + constructor(win: UI.Window); + setBackgroundProvider(provider: UI.IBackgroundProvider): void; + addOrRefreshElement(element: UI.IElement): void; + removeElement(element: UI.IElement): void; releaseAll(): void; resetAll(): void; invalidateAll(): void; runCachePreparation(): void; - getStyleFor(element: elements.UIElement): types.UIStyle; - setWindowStyle(style: types.UIStyle): void; + getStyleFor(element: UI.IElement): UI.Style; + setWindowStyle(style: UI.Style): void; draw(canvas: NonNullable): void; drawDirty(canvas: android.graphics.Canvas, scale: number): void; - onTouchEvent(event: types.TouchEvent): void; + onTouchEvent(event: UI.ITouchEvent): void; setAlpha(alpha: number): void; /** * Just for TS not to be angry. @@ -33,7 +33,6 @@ declare module com { * @default -3 */ getOpacity(): number; - toString(): string; } } } @@ -41,4 +40,4 @@ declare module com { } } } -} \ No newline at end of file +} diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIWindowGroup.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIWindowGroup.d.ts deleted file mode 100644 index bd7848ec1..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIWindowGroup.d.ts +++ /dev/null @@ -1,166 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module window { - export class UIWindowGroup extends java.lang.Object implements IWindow { - static class: java.lang.Class; - closeOnBackPressed: boolean; - /** - * Removes window from group by it's name. - * @param name window name - */ - removeWindow(name: string): void; - /** - * Adds window instance with specified name to the group. - * @param name window name - * @param window window to be added to the group - */ - addWindowInstance(name: string, window: IWindow): void; - /** - * Creates a new window using provided description and adds it to the - * group. - * @param name window name - * @param content window description object - * @returns Created {@link UI.Window} object. - */ - addWindow(name: string, content: WindowContent): UIWindow; - /** - * @param name window name - * @returns Window from the group by it's name or null if no window with - * such a name was added. - */ - getWindow(name: string): UIWindow; - /** - * @param name window name - * @returns Window's description object if a window with specified name - * exists or null otherwise. - */ - getWindowContent(name: string): Nullable; - /** - * Sets content for the window by it's name. - * @param name window name - * @param content content object - */ - setWindowContent(name: string, content: WindowContent): void; - /** - * @returns Collection object containing all the - * {@link UI.Window}s in the group. - */ - getAllWindows(): java.util.Collection; - /** - * @returns Collection object containing string names of the - * windows in the group. - */ - getWindowNames(): java.util.Collection; - /** - * Forces window refresh by it's name. - * @param name name of the window to refresh - */ - refreshWindow(name: string): void; - /** - * Forces refresh for all windows. - */ - refreshAll(): void; - /** - * Moves window with specified name to the top of the group. - * @param name window name - */ - moveOnTop(name: string): void; - /** - * Opens window without container. - */ - open(): void; - /** - * Closes window without container. Use only if the window was opened - * without container. - */ - close(): void; - /** - * Called up to 66 times a second to update window's content. - * @param time current time in milliseconds - */ - frame(time: number): void; - /** - * @returns `true` if the window is opened, `false` otherwise. - */ - isOpened(): boolean; - /** - * @returns `true` if the window has an inventory that should be updated. - */ - isInventoryNeeded(): boolean; - /** - * @returns `true` if the window can change it's contents position. - */ - isDynamic(): boolean; - /** - * Gets all the elements in the window. - * @returns Hashes containing string element name - * as keys and element instances as values. - */ - getElements(): java.util.HashMap; - /** - * @returns `null` for {@link com.zhekasmirnov.innercore.api.mod.ui.window.UIWindowGroup UIWindowGroup}. - * */ - getContent(): Nullable; - /** - * @returns Currently {@link UI.Container} - * that was used to open this window or null, if the window wasn't opened in container. - */ - getContainer(): Nullable; - /** - * Sets container for the current window. Be careful when calling it - * manually. You should prefer opening the window via - * {@link com.zhekasmirnov.innercore.api.mod.ui.container.Container.openAs Container.openAs} call. - * @param container {@link UI.Container} - * to be associated with current window or null to associate no container with current window - */ - setContainer(container: Nullable): void; - /** - * Turns debug mode for the window on and off. - * @param enabled if `true`, additional debug information will be drawn on - * the window canvas - */ - setDebugEnabled(enabled: boolean): void; - invalidateAllContent(): void; - setStyle(style: types.UIStyle): void; - setStyle(style: types.BindingSet): void; - /** - * @returns Object containing current style of the window. - */ - getStyle(): types.UIStyle; - setBlockingBackground(bb: boolean): void; - /** - * Forces ui elements of the window to refresh. - * @param onCurrentThread if `true`, the drawables will be refreshed - * immediately, otherwise refresh event will be posted; ensure you are - * in the UI thread if you pass `true` as the parameter - * @default onCurrentThread: false - */ - invalidateElements(onCurrentThread: boolean): void; - /** - * Forces ui drawables of the window to refresh. - * @param onCurrentThread if `true`, the drawables will be refreshed - * immediately, otherwise refresh event will be posted; ensure you are - * in the UI thread if you pass `true` as the parameter - * @default onCurrentThread: false - */ - invalidateDrawing(onCurrentThread: boolean): void; - /** - * Gives the property to be closed on pressing back navigation button to the given window group. - */ - setCloseOnBackPressed(val: boolean): void; - /** - * @returns Whether the window group can be closed on pressing back navigation button. - */ - onBackPressed(): boolean; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIWindowLocation.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIWindowLocation.d.ts deleted file mode 100644 index 055cd7f18..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIWindowLocation.d.ts +++ /dev/null @@ -1,230 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module window { - export interface IWindowLocation { - /** - * X coordinate of the window in units. - * @default 0 - */ - x?: number, - /** - * Y coordinate of the window in units. - * @default 0 - */ - y?: number, - /** - * Width of the window in units, by default calculated to match right - * screen bound. - */ - width?: number, - /** - * Height of the window in units, by default calculated to match bottom - * screen bound. - */ - height?: number, - /** - * Defines scrollable window size along the X axis. - */ - scrollX?: number, - /** - * Defines scrollable window size along the Y axis. - */ - scrollY?: number; - } - /** - * Object representing window location used in window content object and - * {@link com.zhekasmirnov.innercore.api.mod.ui.window.UIWindowLocation IWindowLocation} constructor. - */ - export interface WindowLocationDescription extends IWindowLocation { - forceScrollX?: boolean, forceScrollY?: boolean, - /** - * Determines whether the interface needs to be resized based - * on its size or a global unit system should be used. - * @since 2.3.1b115 - */ - globalScale?: boolean, - /** - * Paddings are distances from the window bounds to the elements in the - * window. - */ - padding?: { top?: number, bottom?: number, left?: number, right?: number }; - } - export class UIWindowLocation extends java.lang.Object { - static class: java.lang.Class; - /** - * Constant used to represent bottom padding. - */ - static readonly PADDING_BOTTOM: number; - /** - * Constant used to represent left padding. - */ - static readonly PADDING_LEFT: number; - /** - * Constant used to represent right padding. - */ - static readonly PADDING_RIGHT: number; - /** - * Constant used to represent top padding. - */ - static readonly PADDING_TOP: number; - forceScrollX: boolean; - forceScrollY: boolean; - /** - * Determines whether the interface needs to be resized based - * on its size or a global unit system should be used. - * @since 2.3.1b115 - */ - globalScale: boolean; - /** - * Window height. - */ - height: number; - /** - * Window scale. - */ - scale: number; - /** - * Horizontal window scroll. - */ - scrollX: number; - /** - * Vertical window scroll. - */ - scrollY: number; - /** - * Window width. - */ - width: number; - /** - * Window horizontal position. - */ - x: number; - /** - * Window vertical position. - */ - y: number; - /** - * Window position on layers. - */ - zIndex: number; - /** - * Constructs new {@link com.zhekasmirnov.innercore.api.mod.ui.window.UIWindowLocation UIWindowLocation} instance with default position and - * size (fullscreen window). - */ - constructor(); - /** - * Constructs new {@link com.zhekasmirnov.innercore.api.mod.ui.window.UIWindowLocation UIWindowLocation} instance with specified parameters. - * @param params - */ - constructor(params: WindowLocationDescription); - /** - * Sets scrollable window size. Should be greater then window - * width/height for the changes to take effect. - * @param x scrollable window size along the X axis - * @param y scrollable window size along the Y axis - */ - setScroll(x: number, y: number): void; - /** - * Sets the size of the window. - * @param x window's width - * @param y window's height - */ - setSize(x: number, y: number): void; - /** - * @returns Window location as a js object. Note that paddings are not - * included into the object. - */ - asScriptable(): IWindowLocation; - /** - * Creates a copy of current {@link com.zhekasmirnov.innercore.api.mod.ui.window.UIWindowLocation UIWindowLocation} object. - * @returns Newly created copy of the object. - */ - copy(): UIWindowLocation; - /** - * Sets window location parameters. - * @param x X coordinate of the window - * @param y Y coordinate of the window - * @param width width of the window - * @param height height of the window - */ - set(x: number, y: number, width: number, height: number): void; - /** - * Sets window location parameters from another {@link com.zhekasmirnov.innercore.api.mod.ui.window.UIWindowLocation UIWindowLocation}. - * Note that paddings are not copied instance. - * @param location another {@link com.zhekasmirnov.innercore.api.mod.ui.window.UIWindowLocation UIWindowLocation} instance to copy - * parameters from - */ - set(location: UIWindowLocation): void; - /** - * Sets window's scroll size to the windows size to remove scroll. - */ - removeScroll(): void; - /** - * Sets padding of the window. - * @param padding one of the {@link com.zhekasmirnov.innercore.api.mod.ui.window.UIWindowLocation.PADDING_TOP UIWindowLocation.PADDING_TOP}, - * {@link com.zhekasmirnov.innercore.api.mod.ui.window.UIWindowLocation.PADDING_BOTTOM UIWindowLocation.PADDING_BOTTOM}, - * {@link com.zhekasmirnov.innercore.api.mod.ui.window.UIWindowLocation.PADDING_LEFT UIWindowLocation.PADDING_LEFT}, - * {@link com.zhekasmirnov.innercore.api.mod.ui.window.UIWindowLocation.PADDING_RIGHT UIWindowLocation.PADDING_RIGHT} constants - * @param value value of the padding to be assigned to appropriate - * window bound - */ - setPadding(padding: 0 | 1 | 2 | 3, value: number): void; - /** - * Sets the four paddings of the window for the appropriate bounds. - */ - setPadding(top: number, bottom: number, left: number, right: number): void; - /** - * @returns Unit size (in pixels) in the fullscreen context (` / 1000`). - */ - getScale(): number; - /** - * @returns Unit size (in pixels) in the window's bounds. - */ - getDrawingScale(): number; - /** - * @returns Window's rectangle in the {@link android.graphics.Rect} object. - */ - getRect(): android.graphics.Rect; - showPopupWindow(win: android.widget.PopupWindow): void; - updatePopupWindow(win: android.widget.PopupWindow): void; - getLayoutParams(a1: number, a2: number, a3: number): android.view.WindowManager.LayoutParams; - setupAndShowPopupWindow(win: android.widget.PopupWindow): void; - /** - * Sets window's Z index. Z index determines how the window will be - * displayed when several windows are open. - * @param z window Z index - */ - setZ(z: number): void; - /** - * @returns Window's width in units - * (always 1000 by definition of the unit). - */ - getWindowWidth(): 1000; - /** - * @returns Window's height in units. - */ - getWindowHeight(): number; - /** - * Transforms dimension in fullscreen units to the dimension within - * window's bounds. - * @param val value to be transformed - */ - globalToWindow(val: number): number; - /** - * Transforms dimension within window's bounds to the dimension in - * fullscreen units. - * @param val value to be transformed - */ - windowToGlobal(val: number): number; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIWindowStandard.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIWindowStandard.d.ts deleted file mode 100644 index d382f8bc6..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/UIWindowStandard.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module window { - export abstract class UIWindowStandard extends UIWindowGroup { - static class: java.lang.Class; - constructor(content: StandardWindowContent); - getContent(): StandardWindowContent; - getStyleSafe(): types.UIStyle; - setContent(content: StandardWindowContent): void; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/WindowParent.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/WindowParent.d.ts index ed080fbbe..1e071d8ba 100644 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/WindowParent.d.ts +++ b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/WindowParent.d.ts @@ -1,15 +1,15 @@ declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module window { - export class WindowParent extends java.lang.Object { + namespace zhekasmirnov { + namespace innercore { + namespace api { + namespace mod { + namespace ui { + namespace window { + class WindowParent extends java.lang.Object { static class: java.lang.Class; - static openWindow(window: UIWindow): void; - static closeWindow(window: UIWindow): void; - static applyWindowInsets(window: UIWindow, insets: android.view.WindowInsets): void; + static openWindow(window: UI.Window): void; + static closeWindow(window: UI.Window): void; + static applyWindowInsets(window: UI.Window, insets: android.view.WindowInsets): void; static releaseWindowLayout(layout: android.view.View): void; } } @@ -18,4 +18,4 @@ declare module com { } } } -} \ No newline at end of file +} diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/WindowProvider.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/WindowProvider.d.ts index d846cf194..f792f3d48 100644 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/WindowProvider.d.ts +++ b/core-engine/com/zhekasmirnov/innercore/api/mod/ui/window/WindowProvider.d.ts @@ -1,16 +1,16 @@ declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module ui { - export module window { - export class WindowProvider extends java.lang.Object { + namespace zhekasmirnov { + namespace innercore { + namespace api { + namespace mod { + namespace ui { + namespace window { + class WindowProvider extends java.lang.Object { static class: java.lang.Class; static readonly instance: WindowProvider; static getFrame(): number; - onWindowOpened(window: IWindow): void; - onWindowClosed(window: IWindow): void; + onWindowOpened(window: UI.IWindow): void; + onWindowClosed(window: UI.IWindow): void; onBackPressed(): boolean; onActivityStopped(): void; } @@ -20,4 +20,4 @@ declare module com { } } } -} \ No newline at end of file +} diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/util/ConfigVisualizer.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/util/ConfigVisualizer.d.ts deleted file mode 100644 index 0a9da1889..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/util/ConfigVisualizer.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module util { - export class ConfigVisualizer extends java.lang.Object { - static class: java.lang.Class; - /** - * Constructs new {@link UI.ConfigVisualizer} instance with specified elements - * names prefix. - * @param config configuration file to be loaded - * @param prefix elements names prefix used for this visualizer - */ - constructor(config: innercore.mod.build.Config, prefix: string); - /** - * Constructs new {@link UI.ConfigVisualizer} instance with default elements - * names prefix (*config_vis*). - * @param config configuration file to be loaded - */ - constructor(config: innercore.mod.build.Config); - /** - * Removes all elements with current element name prefix. In other - * words, removes all elements that were created by this. - * {@link UI.ConfigVisualizer} instance - * @param elements target {@link com.zhekasmirnov.innercore.api.mod.ui.window.WindowContent.elements WindowContent.elements} section - */ - clearVisualContent(elements: UI.ElementSet): void; - /** - * Creates elements in the window to visualize configuration file. - * @param elements target {@link com.zhekasmirnov.innercore.api.mod.ui.window.WindowContent.elements WindowContent.elements} section - * @param prefs top left position of the first element. Default position - * is (0, 0, 0) - */ - createVisualContent(elements: UI.ElementSet, prefs?: Partial): void; - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/mod/util/ScriptableWatcher.d.ts b/core-engine/com/zhekasmirnov/innercore/api/mod/util/ScriptableWatcher.d.ts deleted file mode 100644 index 977a8741f..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/mod/util/ScriptableWatcher.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module mod { - export module util { - export class ScriptableWatcher extends java.lang.Object { - static class: java.lang.Class; - object: object; - constructor(obj: object); - isDirty(): boolean; - validate(): void; - invalidate(): void; - setTarget(obj: object): void; - refresh(): void; - toString(): string; - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/api/unlimited/BlockShape.d.ts b/core-engine/com/zhekasmirnov/innercore/api/unlimited/BlockShape.d.ts index ce1755cc5..ebbabfdbe 100644 --- a/core-engine/com/zhekasmirnov/innercore/api/unlimited/BlockShape.d.ts +++ b/core-engine/com/zhekasmirnov/innercore/api/unlimited/BlockShape.d.ts @@ -1,9 +1,9 @@ declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module unlimited { - export class BlockShape extends java.lang.Object { + namespace zhekasmirnov { + namespace innercore { + namespace api { + namespace unlimited { + class BlockShape extends java.lang.Object { static class: java.lang.Class; x1: number; x2: number; @@ -20,4 +20,4 @@ declare module com { } } } -} \ No newline at end of file +} diff --git a/core-engine/com/zhekasmirnov/innercore/api/unlimited/BlockVariant.d.ts b/core-engine/com/zhekasmirnov/innercore/api/unlimited/BlockVariant.d.ts deleted file mode 100644 index eaeb95bd4..000000000 --- a/core-engine/com/zhekasmirnov/innercore/api/unlimited/BlockVariant.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module api { - export module unlimited { - interface IBlockVariant extends Block.BlockVariation { isTech?: boolean } - export class BlockVariant extends java.lang.Object { - static class: java.lang.Class; - readonly data: number; - readonly inCreative: boolean; - isTechnical: boolean; - readonly name: string; - renderType: number; - shape: BlockShape; - readonly textureIds: number[]; - readonly textures: string[]; - readonly uid: number; - constructor(uid: number, data: number, name: string, textures: string[], textureIds: number[], inCreative: boolean); - constructor(uid: number, data: number, object: IBlockVariant); - getGuiBlockModel(): mod.ui.GuiBlockModel; - getSpriteTexturePath(): string; - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/mod/build/Config.d.ts b/core-engine/com/zhekasmirnov/innercore/mod/build/Config.d.ts deleted file mode 100644 index 8bf356565..000000000 --- a/core-engine/com/zhekasmirnov/innercore/mod/build/Config.d.ts +++ /dev/null @@ -1,148 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module mod { - export module build { - /** - * Json configuration file reading/writing utility. - */ - export class Config extends java.lang.Object { - static class: java.lang.Class; - /** - * Creates new {@link com.zhekasmirnov.innercore.mod.build.Config Config} instance using specified file. - * @param file {@link java.io.File} instance of the file to use - */ - constructor(file: java.io.File); - /** - * Creates new {@link com.zhekasmirnov.innercore.mod.build.Config Config} instance using specified file. - * @param path path to configuration file - */ - constructor(path: string); - /** - * @since 2.2.1b96 - */ - getPath(): string; - /** - * @since 2.2.1b96 - */ - reload(): void; - /** - * Writes configuration JSON to the file. - */ - save(): void; - /** - * @returns Read-only ArrayList instance containing - * all the names in the current config file. - */ - getNames(): java.util.ArrayList; - /** - * Gets property from the config. - * @param name option name, supports multi-layer calls, separated by **'.'** - * @returns Config instance with current config as parent if the - * property is object, {@link org.json.JSONArray} instance if the property is an - * array, raw type if the property is of that raw type, `null` otherwise. - * @example - * ```ts - * config.get("generation.ore_copper.max_height"); - * ``` - */ - get>(name: string): T; - /** - * Same as {@link com.zhekasmirnov.innercore.mod.build.Config.get Config.get}. - */ - access>(name: string): T; - /** - * @param name option name, supports multi-layer calls, separated by **'.'** - * @returns Boolean config value specified in config or false if no value was - * specified. - */ - getBool(name: string): boolean; - /** - * @param name option name, supports multi-layer calls, separated by **'.'** - * @returns Number object instance, containing numeric value by given name - * from the config, or `0` if no value was specified. - */ - getNumber(name: string): java.lang.Number; - /** - * @param name option name, supports multi-layer calls, separated by **'.'** - * @returns Integer of value by given name from the config, or `0` if no value was specified. - */ - getInteger(name: string): number; - /** - * @param name option name, supports multi-layer calls, separated by **'.'** - * @returns Floating-point number of value by given name from the config, or `0.0` if no value was specified. - */ - getFloat(name: string): number; - /** - * @param name option name, supports multi-layer calls, separated by **'.'** - * @returns Double number of value by given name from the config, or `0.0` if no value was specified. - */ - getDouble(name: string): number; - /** - * @param name option name, supports multi-layer calls, separated by **'.'** - * @returns String by given name from the config, or `null` if no value was specified. - */ - getString(name: string): Nullable; - /** - * Sets config value. Do not use {@link org.json.JSONObject} instances to create - * nested objects, consider using dot-separated names instead. - * @param name option name, supports multi-layer calls, separated by **'.'** - * @param val value, may be {@link org.json.JSONArray} instance, - * {@link org.json.JSONObject} instance or raw data type - */ - set(name: string, val: T): boolean; - /** - * @param path option name, supports multi-layer calls, separated by **'.'** - * @returns Editable {@link com.zhekasmirnov.innercore.mod.build.Config.ConfigValue Config.ConfigValue} - * instance that can be used to manipulate this config option separately. - */ - getValue(path: string): Nullable; - /** - * Ensures that config has all the properties the data pattern contains, if - * not, puts default values to match the pattern. - * @param jsonstr string representation of JSON object representing the data pattern - */ - checkAndRestore(jsonstr: string): void; - /** - * Ensures that config has all the properties the data pattern contains, if - * not, puts default values to match the pattern. - * @param jsonobj javascript object representing the data pattern checkAndRestore - */ - checkAndRestore(jsonobj: Scriptable): void; - /** - * Ensures that config has all the properties the data pattern contains, if - * not, puts default values to match the pattern. - * @param json {@link org.json.JSONObject} instance to be used as data pattern - */ - checkAndRestore(json: org.json.JSONObject): void; - } - export module Config { - /** - * Class representing config value with it's path withing - * {@link com.zhekasmirnov.innercore.mod.build.Config Config} object. - */ - export class ConfigValue extends java.lang.Object { - static class: java.lang.Class; - /** - * Sets config value and saves configuration file. - * @param value value, may be {@link org.json.JSONArray} instance, - * {@link org.json.JSONObject} instance or raw data type. - */ - set(value: T): void; - /** - * @returns Config value, result is the same as the result of - * {@link com.zhekasmirnov.innercore.mod.build.Config.get Config.get} call. - */ - get>(): T; - /** - * @returns Readable config value name - * representation along with class name. - */ - toString(): string; - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/mod/resource/ResourcePackManager.d.ts b/core-engine/com/zhekasmirnov/innercore/mod/resource/ResourcePackManager.d.ts index c0bd8ea89..e363a6fd2 100644 --- a/core-engine/com/zhekasmirnov/innercore/mod/resource/ResourcePackManager.d.ts +++ b/core-engine/com/zhekasmirnov/innercore/mod/resource/ResourcePackManager.d.ts @@ -1,25 +1,23 @@ declare module com { - export module zhekasmirnov { - export module innercore { - export module mod { - export module resource { - export class ResourcePackManager extends java.lang.Object { + namespace zhekasmirnov { + namespace innercore { + namespace mod { + namespace resource { + class ResourcePackManager extends java.lang.Object { static class: java.lang.Class; static readonly LOGGER_TAG = "INNERCORE-RESOURCES"; static instance: ResourcePackManager; resourcePackDefinition: string; resourcePackList: string; - resourceStorage: ResourceStorage; constructor(); static getBlockTextureName(texture: string, meta: number): Nullable; static getItemTextureName(texture: string, meta: number): Nullable; static getSourcePath(): string; static isValidBlockTexture(texture: string, meta: number): boolean; static isValidItemTexture(texture: string, meta: number): boolean; - initializeResources(): void; } } } } } -} \ No newline at end of file +} diff --git a/core-engine/com/zhekasmirnov/innercore/mod/resource/ResourceStorage.d.ts b/core-engine/com/zhekasmirnov/innercore/mod/resource/ResourceStorage.d.ts deleted file mode 100644 index 31ac328a0..000000000 --- a/core-engine/com/zhekasmirnov/innercore/mod/resource/ResourceStorage.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module mod { - export module resource { - export class ResourceStorage extends java.lang.Object implements pack.IResourcePack { - static class: java.lang.Class; - static readonly VANILLA_RESOURCE = "resource_packs/vanilla/"; - animationList: org.json.JSONArray; - blockTexttureDescriptor: types.TextureAtlasDescription; - itemTextureDescriptor: types.TextureAtlasDescription; - textureList: org.json.JSONArray; - static addTextureToLoad(path: string): void; - static loadAllTextures(): void; - static nativeAddTextureToLoad(path: string): void; - addResourceFile(textureType: types.enums.TextureType, resource: horizon.modloader.resource.directory.Resource): void; - build(): void; - getAbsolutePath(): string; - getId(): string; - getLinkedFilePath(link: string): string; - getPackName(): string; - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/mod/resource/pack/IResourcePack.d.ts b/core-engine/com/zhekasmirnov/innercore/mod/resource/pack/IResourcePack.d.ts deleted file mode 100644 index c9f010a05..000000000 --- a/core-engine/com/zhekasmirnov/innercore/mod/resource/pack/IResourcePack.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module mod { - export module resource { - export module pack { - export class IResourcePack extends java.lang.Object { - static class: java.lang.Class; - getAbsolutePath(): string; - getPackName(): string; - constructor(); - constructor(impl: { - getAbsolutePath: () => string; - getPackName: () => string; - }); - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/mod/resource/pack/ResourcePack.d.ts b/core-engine/com/zhekasmirnov/innercore/mod/resource/pack/ResourcePack.d.ts deleted file mode 100644 index 58376c873..000000000 --- a/core-engine/com/zhekasmirnov/innercore/mod/resource/pack/ResourcePack.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module mod { - export module resource { - export module pack { - export class ResourcePack extends java.lang.Object implements IResourcePack { - static class: java.lang.Class; - isLoaded: boolean; - resourceFiles: java.util.ArrayList; - constructor(dir: string); - getAbsolutePath(): string; - getPackName(): string; - readAllFiles(): void; - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/mod/resource/types/ResourceFile.d.ts b/core-engine/com/zhekasmirnov/innercore/mod/resource/types/ResourceFile.d.ts deleted file mode 100644 index 8e1b5ef54..000000000 --- a/core-engine/com/zhekasmirnov/innercore/mod/resource/types/ResourceFile.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module mod { - export module resource { - export module types { - export class ResourceFile extends java.io.File { - static class: java.lang.Class; - constructor(rp: pack.IResourcePack, file: java.io.File); - constructor(path: NonNullable); - getAnimationType(): enums.AnimationType; - getLocalDir(): string; - getLocalPath(): string; - getParseError(): enums.ParseError; - getResourcePack(): pack.IResourcePack; - getTextureType(): enums.TextureType; - getType(): enums.FileType; - setResourcePack(rp: pack.IResourcePack): void; - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/mod/resource/types/TextureAnimationFile.d.ts b/core-engine/com/zhekasmirnov/innercore/mod/resource/types/TextureAnimationFile.d.ts deleted file mode 100644 index a73528dcf..000000000 --- a/core-engine/com/zhekasmirnov/innercore/mod/resource/types/TextureAnimationFile.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module mod { - export module resource { - export module types { - export class TextureAnimationFile extends ResourceFile { - static class: java.lang.Class; - constructor(rfile: ResourceFile); - constructor(path: NonNullable); - constructAnimation(): org.json.JSONObject; - isValid(): boolean; - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/mod/resource/types/TextureAtlasDescription.d.ts b/core-engine/com/zhekasmirnov/innercore/mod/resource/types/TextureAtlasDescription.d.ts deleted file mode 100644 index cc82ace4b..000000000 --- a/core-engine/com/zhekasmirnov/innercore/mod/resource/types/TextureAtlasDescription.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module mod { - export module resource { - export module types { - export class TextureAtlasDescription extends java.lang.Object { - static class: java.lang.Class; - jsonObject: org.json.JSONObject; - textureData: org.json.JSONObject; - constructor(path: string); - constructor(json: org.json.JSONObject); - addTextureFile(file: java.io.File, name: string): void; - addTexturePath(path: string, meta: number, name: string): void; - getTextureCount(texture: string): number; - getTextureName(texture: string, meta: number): string; - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/mod/resource/types/enums/AnimationType.d.ts b/core-engine/com/zhekasmirnov/innercore/mod/resource/types/enums/AnimationType.d.ts deleted file mode 100644 index f5f56fd9d..000000000 --- a/core-engine/com/zhekasmirnov/innercore/mod/resource/types/enums/AnimationType.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module mod { - export module resource { - export module types { - export module enums { - export class AnimationType extends java.lang.Object { - static class: java.lang.Class; - static readonly TEXTURE: AnimationType; - static readonly DESCRIPTOR: AnimationType; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/mod/resource/types/enums/FileType.d.ts b/core-engine/com/zhekasmirnov/innercore/mod/resource/types/enums/FileType.d.ts deleted file mode 100644 index e733b86f7..000000000 --- a/core-engine/com/zhekasmirnov/innercore/mod/resource/types/enums/FileType.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module mod { - export module resource { - export module types { - export module enums { - export class FileType extends java.lang.Object { - static class: java.lang.Class; - static readonly RAW: FileType; - static readonly JSON: FileType; - static readonly EXECUTABLE: FileType; - static readonly MANIFEST: FileType; - static readonly TEXTURE: FileType; - static readonly ANIMATION: FileType; - static readonly INVALID: FileType; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/mod/resource/types/enums/ParseError.d.ts b/core-engine/com/zhekasmirnov/innercore/mod/resource/types/enums/ParseError.d.ts deleted file mode 100644 index 2c177af6a..000000000 --- a/core-engine/com/zhekasmirnov/innercore/mod/resource/types/enums/ParseError.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module mod { - export module resource { - export module types { - export module enums { - export class ParseError extends java.lang.Object { - static class: java.lang.Class; - static readonly ANIMATION_INVALID_DELAY: ParseError; - static readonly ANIMATION_INVALID_FILE: ParseError; - static readonly ANIMATION_INVALID_JSON: ParseError; - static readonly ANIMATION_INVALID_NAME: ParseError; - static readonly ANIMATION_NAME_MISSING: ParseError; - static readonly ANIMATION_TILE_MISSING: ParseError; - static readonly NONE: ParseError; - toString(): string; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/com/zhekasmirnov/innercore/mod/resource/types/enums/TextureType.d.ts b/core-engine/com/zhekasmirnov/innercore/mod/resource/types/enums/TextureType.d.ts deleted file mode 100644 index 5448cd723..000000000 --- a/core-engine/com/zhekasmirnov/innercore/mod/resource/types/enums/TextureType.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -declare module com { - export module zhekasmirnov { - export module innercore { - export module mod { - export module resource { - export module types { - export module enums { - export class TextureType extends java.lang.Object { - static class: java.lang.Class; - static readonly BLOCK: TextureType; - static readonly DEFAULT: TextureType; - static readonly GUI: TextureType; - static readonly ITEM: TextureType; - static readonly PARTICLE: TextureType; - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/core-engine/types.d.ts b/core-engine/types.d.ts index 52ad70ee8..aa8c6fb4d 100644 --- a/core-engine/types.d.ts +++ b/core-engine/types.d.ts @@ -12,7 +12,7 @@ type Nullable = T | null; * Flattened hieracly, extendable in declarations. */ type Scriptable = { - [key: string]: any + [key: string]: any; } /** @@ -21,7 +21,7 @@ type Scriptable = { interface Vector { x: number, y: number, - z: number + z: number; } /** @@ -31,7 +31,7 @@ interface BlockPosition extends Vector { /** * Side of the block, one of the {@link EBlockSide} constants. */ - side: number + side: number; } /** @@ -40,7 +40,7 @@ interface BlockPosition extends Vector { interface Color { r: number, g: number, - b: number + b: number; } /** @@ -48,7 +48,7 @@ interface Color { */ interface LookAngle { pitch: number, - yaw: number + yaw: number; } /** @@ -73,7 +73,7 @@ interface ItemInstance { * Item extra data. Contains some additional item data such as enchants, * custom item name or some additional properties. */ - extra?: ItemExtraData + extra?: ItemExtraData; } /** @@ -87,7 +87,7 @@ type ItemInstanceArray = [number, number, number, ItemExtraData?]; */ interface Tile { id: number, - data: number + data: number; } /** @@ -101,5 +101,5 @@ interface Weather { /** * Current lightning level, from 0 (no lightning) to 10. */ - thunder: number + thunder: number; }