diff --git a/build.gradle b/build.gradle index fbf26a5..0706a03 100644 --- a/build.gradle +++ b/build.gradle @@ -35,14 +35,14 @@ for (JNIPlatform platform : jniPlatforms) { buildDir.mkdir() } - tasks.create(name: "cmake-${platform.name}", type: Exec) { + tasks.create(name: "cmake-${platform.name}", group: 'jni', type: Exec) { workingDir buildDir executable 'cmake' args platform.cmakeArgs + ['..'] } - tasks.create(name: "compileJNI-${platform.name}", type: Exec) { + tasks.create(name: "compileJNI-${platform.name}", group: 'jni', type: Exec) { workingDir buildDir executable 'make' @@ -52,7 +52,7 @@ for (JNIPlatform platform : jniPlatforms) { compileJNI.dependsOn tasks.getByName("compileJNI-${platform.name}") - tasks.create(name: "cleanJNI-${platform.name}", type: Delete) { + tasks.create(name: "cleanJNI-${platform.name}", group: 'jni', type: Delete) { delete buildDir.absolutePath } @@ -96,7 +96,7 @@ def typescriptRoot = rootProject.typescript_root as String def resources = new File(rootProject.rootDir, 'src/main/resources') def typescriptRootFile = new File(resources, typescriptRoot) -task compileTypescript { +task typescript(group: 'build') { inputs.dir typescriptRootFile outputs.dir typescriptOut @@ -115,11 +115,11 @@ task compileTypescript { } } -processResources.dependsOn compileTypescript +processResources.dependsOn typescript def typedocOut = new File(buildDir, 'typedoc') -task typedoc { +task typedoc(group: 'documentation') { inputs.dir typescriptRootFile outputs.dir typedocOut diff --git a/src/main/resources/scriptcraft/minecraft/tag.ts b/src/main/resources/scriptcraft/minecraft/tag.ts index 05c3563..95ee5ed 100644 --- a/src/main/resources/scriptcraft/minecraft/tag.ts +++ b/src/main/resources/scriptcraft/minecraft/tag.ts @@ -5,7 +5,7 @@ type TagType = number | boolean | string | CompoundTag | ListTag; /** * @internal */ -function getTagValue(obj: [boolean, BridgeValueType]): TagType { +function getTagValue(obj: [boolean, BridgeValueType]): Exclude { if (typeof obj[1] === 'object') { if (obj[0]) { return new ListTag(obj[1] as JavaObject); @@ -13,7 +13,7 @@ function getTagValue(obj: [boolean, BridgeValueType]): TagType { return new CompoundTag(obj[1] as JavaObject); } } else if (obj[1]) { - return obj[1]; + return obj[1] as Exclude; } else { return null; } @@ -49,10 +49,12 @@ export class CompoundTag { /** * Get Value In Tag + * + * Note: This will never return a boolean, because booleans are stored as numbers in NBT. * @param key Key * @returns Value */ - get(key: string): TagType { + get(key: string): Exclude { const obj = useBridge('CompoundTag.get', this.javaObject, key) as [boolean, BridgeValueType]; return getTagValue(obj); } @@ -109,10 +111,12 @@ export class ListTag { /** * Get Value In Tag + * + * Note: This will never return a boolean, because booleans are stored as numbers in NBT. * @param key Key * @returns Value */ - get(key: number): TagType { + get(key: number): Exclude { const obj = useBridge('ListTag.get', this.javaObject, key) as [boolean, BridgeValueType]; return getTagValue(obj); }