From 05f7d5923cfa4e05ce06c3fd804e047342aa01f7 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Mon, 27 Apr 2020 14:27:58 -0400 Subject: [PATCH] Document Enums --- .../resources/scriptcraft/minecraft/core.ts | 36 ++++++++++++++++++- .../resources/scriptcraft/minecraft/tag.ts | 22 ++++++++++-- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/src/main/resources/scriptcraft/minecraft/core.ts b/src/main/resources/scriptcraft/minecraft/core.ts index dd92400..54ede96 100644 --- a/src/main/resources/scriptcraft/minecraft/core.ts +++ b/src/main/resources/scriptcraft/minecraft/core.ts @@ -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 - * ":" + * + * Formatted as ":" */ export class Identifier { readonly #namespace: string; diff --git a/src/main/resources/scriptcraft/minecraft/tag.ts b/src/main/resources/scriptcraft/minecraft/tag.ts index 95ee5ed..231c24b 100644 --- a/src/main/resources/scriptcraft/minecraft/tag.ts +++ b/src/main/resources/scriptcraft/minecraft/tag.ts @@ -23,11 +23,29 @@ function getTagValue(obj: [boolean, BridgeValueType]): Exclude * 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): 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): 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); } /**