This commit is contained in:
parent
80559457f5
commit
90d93dd6d6
12
build.gradle
12
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
|
||||
|
||||
|
@ -5,7 +5,7 @@ type TagType = number | boolean | string | CompoundTag | ListTag;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
function getTagValue(obj: [boolean, BridgeValueType]): TagType {
|
||||
function getTagValue(obj: [boolean, BridgeValueType]): Exclude<TagType, boolean> {
|
||||
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<TagType, boolean>;
|
||||
} 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<TagType, boolean> {
|
||||
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<TagType, boolean> {
|
||||
const obj = useBridge('ListTag.get', this.javaObject, key) as [boolean, BridgeValueType];
|
||||
return getTagValue(obj);
|
||||
}
|
||||
|
Reference in New Issue
Block a user