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