Document Enums
All checks were successful
ScriptCraft/pipeline/head This commit looks good

This commit is contained in:
TheBrokenRail 2020-04-27 14:27:58 -04:00
parent 8f7a04e12c
commit 05f7d5923c
2 changed files with 55 additions and 3 deletions

View File

@ -16,8 +16,17 @@ export function useBridge(name: string, ...args: BridgeValueType[]): BridgeValue
* Action Result
*/
export enum ActionResult {
/**
* Do Nothing
*/
PASS = 'PASS',
/**
* Success
*/
SUCCESS = 'SUCCESS',
/**
* Failure
*/
CONSUME = 'CONSUME'
}
@ -25,7 +34,13 @@ export enum ActionResult {
* Hand
*/
export enum Hand {
/**
* Main Hand
*/
MAIN_HAND = 'MAIN_HAND',
/**
* Off Hand
*/
OFF_HAND = 'OFF_HAND'
}
@ -33,11 +48,29 @@ export enum Hand {
* Direction
*/
export enum Direction {
/**
* Down
*/
DOWN = 'DOWN',
/**
* Up
*/
UP = 'UP',
/**
* North
*/
NORTH = 'NORTH',
/**
* South
*/
SOUTH = 'SOUTH',
/**
* West
*/
WEST = 'WEST',
/**
* East
*/
EAST = 'EAST'
}
@ -75,7 +108,8 @@ export class DirectionUtil {
/**
* Namespaced Identifier
* "<namespace>:<path>"
*
* Formatted as "<namespace>:<path>"
*/
export class Identifier {
readonly #namespace: string;

View File

@ -23,11 +23,29 @@ function getTagValue(obj: [boolean, BridgeValueType]): Exclude<TagType, boolean>
* Number Types
*/
export enum NumberType {
/**
* Integer
*/
INT = 'INT',
/**
* Byte
*/
BYTE = 'BYTE',
/**
* Double (JS Number)
*/
DOUBLE = 'DOUBLE',
/**
* Long
*/
LONG = 'LONG',
/**
* Float
*/
FLOAT = 'FLOAT',
/**
* Short
*/
SHORT = 'SHORT'
}
@ -68,7 +86,7 @@ export class CompoundTag {
set(key: string, value: number, numberType: NumberType): void;
set(key: string, value: Exclude<TagType, number>): void;
set(key: string, value: TagType, numberType?: NumberType) {
useBridge('CompoundTag.set', this.javaObject, key, (value instanceof CompoundTag || value instanceof ListTag) ? value.javaObject : value, numberType);
useBridge('CompoundTag.set', this.javaObject, key, (value instanceof CompoundTag || value instanceof ListTag) ? value.javaObject : value, numberType != null ? numberType : NumberType.DOUBLE);
}
/**
@ -130,7 +148,7 @@ export class ListTag {
set(key: number, value: number, numberType: NumberType): void;
set(key: number, value: Exclude<TagType, number>): void;
set(key: number, value: TagType, numberType?: NumberType) {
useBridge('ListTag.set', this.javaObject, key, (value instanceof CompoundTag || value instanceof ListTag) ? value.javaObject : value, numberType);
useBridge('ListTag.set', this.javaObject, key, (value instanceof CompoundTag || value instanceof ListTag) ? value.javaObject : value, numberType != null ? numberType : NumberType.DOUBLE);
}
/**