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 * Action Result
*/ */
export enum ActionResult { export enum ActionResult {
/**
* Do Nothing
*/
PASS = 'PASS', PASS = 'PASS',
/**
* Success
*/
SUCCESS = 'SUCCESS', SUCCESS = 'SUCCESS',
/**
* Failure
*/
CONSUME = 'CONSUME' CONSUME = 'CONSUME'
} }
@ -25,7 +34,13 @@ export enum ActionResult {
* Hand * Hand
*/ */
export enum Hand { export enum Hand {
/**
* Main Hand
*/
MAIN_HAND = 'MAIN_HAND', MAIN_HAND = 'MAIN_HAND',
/**
* Off Hand
*/
OFF_HAND = 'OFF_HAND' OFF_HAND = 'OFF_HAND'
} }
@ -33,11 +48,29 @@ export enum Hand {
* Direction * Direction
*/ */
export enum Direction { export enum Direction {
/**
* Down
*/
DOWN = 'DOWN', DOWN = 'DOWN',
/**
* Up
*/
UP = 'UP', UP = 'UP',
/**
* North
*/
NORTH = 'NORTH', NORTH = 'NORTH',
/**
* South
*/
SOUTH = 'SOUTH', SOUTH = 'SOUTH',
/**
* West
*/
WEST = 'WEST', WEST = 'WEST',
/**
* East
*/
EAST = 'EAST' EAST = 'EAST'
} }
@ -75,7 +108,8 @@ export class DirectionUtil {
/** /**
* Namespaced Identifier * Namespaced Identifier
* "<namespace>:<path>" *
* Formatted as "<namespace>:<path>"
*/ */
export class Identifier { export class Identifier {
readonly #namespace: string; readonly #namespace: string;

View File

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