2024-02-13 01:27:30 -05:00
|
|
|
//version: 1707058017
|
|
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
|
id 'com.gtnewhorizons.gtnhconvention'
|
2024-02-13 14:32:32 -05:00
|
|
|
id 'idea'
|
2026-01-07 17:30:17 +02:00
|
|
|
id "dts.typescript-generator"
|
2024-02-13 01:27:30 -05:00
|
|
|
}
|
|
|
|
|
|
2026-08-13 23:14:01 -04:00
|
|
|
version = "1.11.2"
|
2024-02-13 01:27:30 -05:00
|
|
|
group= "kamkeel.customnpc-plus"
|
|
|
|
|
archivesBaseName = "CustomNPC-Plus"
|
|
|
|
|
|
|
|
|
|
def embedMixin = !project.hasProperty("nomixin");
|
|
|
|
|
if(!embedMixin){
|
|
|
|
|
version += "-nomixin"
|
2021-04-27 11:56:36 -04:00
|
|
|
}
|
|
|
|
|
|
2024-02-13 14:32:32 -05:00
|
|
|
// API Task
|
|
|
|
|
tasks.create('updateAPI', Exec) {
|
|
|
|
|
description 'Updates (and Inits) git submodules'
|
2022-11-25 16:20:16 -05:00
|
|
|
commandLine 'git', 'submodule', 'update', '--init', '--recursive'
|
2024-02-13 14:32:32 -05:00
|
|
|
group 'CustomNPC+'
|
2022-11-25 16:20:16 -05:00
|
|
|
}
|
|
|
|
|
|
2024-02-13 14:32:32 -05:00
|
|
|
// No Mixin Build Task
|
2025-07-23 21:31:34 -04:00
|
|
|
def gradleWrapper = System.getProperty('os.name').toLowerCase().contains('windows') ? 'gradlew.bat' : './gradlew'
|
|
|
|
|
|
2024-02-13 14:32:32 -05:00
|
|
|
tasks.create('buildNoMixin', Exec) {
|
|
|
|
|
description 'Builds mod without embed'
|
|
|
|
|
group 'CustomNPC+'
|
2025-07-23 21:31:34 -04:00
|
|
|
workingDir project.rootDir
|
|
|
|
|
commandLine gradleWrapper, 'build', '-Pnomixin'
|
2024-02-13 14:32:32 -05:00
|
|
|
}
|
|
|
|
|
|
2026-02-04 01:09:48 -05:00
|
|
|
// No Nashorn Run Tasks
|
|
|
|
|
tasks.create('runClientNoNashorn', Exec) {
|
|
|
|
|
description 'Runs the client without Nashorn'
|
|
|
|
|
group 'CustomNPC+'
|
|
|
|
|
workingDir project.rootDir
|
|
|
|
|
commandLine gradleWrapper, 'runClient', '-PnoNashorn'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tasks.create('runServerNoNashorn', Exec) {
|
|
|
|
|
description 'Runs the server without Nashorn'
|
|
|
|
|
group 'CustomNPC+'
|
|
|
|
|
workingDir project.rootDir
|
|
|
|
|
commandLine gradleWrapper, 'runServer', '-PnoNashorn'
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-20 02:43:42 +03:00
|
|
|
sourceSets.main.java {
|
|
|
|
|
def apiDir = file('src/api/java')
|
2025-12-30 17:50:29 -05:00
|
|
|
|
2025-12-20 02:43:42 +03:00
|
|
|
if (!apiDir.exists()) {
|
|
|
|
|
throw new GradleException("Missing API sources: Run './gradlew updateAPI' or enable checkout submodules in CI.")
|
2022-11-15 15:25:53 -05:00
|
|
|
}
|
2025-12-20 02:43:42 +03:00
|
|
|
|
|
|
|
|
srcDirs += apiDir
|
2021-04-27 11:56:36 -04:00
|
|
|
}
|
|
|
|
|
|
2026-01-07 17:30:17 +02:00
|
|
|
// ============================================================================
|
|
|
|
|
// TypeScript Definition Generation Task
|
|
|
|
|
// Generates .d.ts files from Java API sources for scripting IDE support
|
|
|
|
|
// ============================================================================
|
|
|
|
|
// TypeScript plugin is applied above in the main plugins block
|
|
|
|
|
|
|
|
|
|
tasks.named("generateTypeScriptDefinitions").configure {
|
2026-02-25 16:37:41 +02:00
|
|
|
sourceDirectories = ['src/api/java', 'src/main/java']
|
2026-01-07 17:30:17 +02:00
|
|
|
outputDirectory = "src/main/resources/assets/${project.property("modId")}/api"
|
2026-01-07 18:11:52 +02:00
|
|
|
apiPackages = ['noppes.npcs.api', 'net.minecraft'] as Set
|
2026-01-07 17:30:17 +02:00
|
|
|
cleanOutputFirst = true // Clean old generated files before regenerating
|
2026-03-04 13:21:40 +02:00
|
|
|
patchesDirectory = "dts-patches"
|
2026-02-25 16:37:41 +02:00
|
|
|
implementationPackages = [
|
|
|
|
|
'noppes.npcs.scripted',
|
|
|
|
|
'noppes.npcs.controllers.data',
|
|
|
|
|
'noppes.npcs.entity.data',
|
|
|
|
|
'noppes.npcs.quests',
|
|
|
|
|
'kamkeel.npcs.controllers.data'
|
|
|
|
|
] as Set
|
2026-01-07 17:30:17 +02:00
|
|
|
}
|
2026-02-04 05:27:45 +02:00
|
|
|
processResources.dependsOn generateTypeScriptDefinitions
|
2026-02-04 18:06:49 -05:00
|
|
|
sourcesJar.dependsOn generateTypeScriptDefinitions
|
2026-03-09 16:22:10 -04:00
|
|
|
|
|
|
|
|
|
2026-03-10 17:07:20 -04:00
|
|
|
// Javadoc configuration
|
|
|
|
|
javadoc {
|
|
|
|
|
options.encoding = 'UTF-8'
|
|
|
|
|
options.charSet = 'UTF-8'
|
|
|
|
|
options.docEncoding = 'UTF-8'
|
|
|
|
|
|
2026-03-09 16:20:18 -04:00
|
|
|
options.tags = [
|
|
|
|
|
'hookName:a:Hook Name:'
|
|
|
|
|
]
|
2026-03-10 17:07:20 -04:00
|
|
|
|
|
|
|
|
options.stylesheetFile = file('.github/javadoc/javadoc-theme.css')
|
|
|
|
|
options.header = file('.github/javadoc/javadoc-header.html').text.replaceAll('\\s+', ' ').trim()
|
|
|
|
|
|
|
|
|
|
options.addBooleanOption('-allow-script-in-comments', true)
|
|
|
|
|
options.footer = file('.github/javadoc/javadoc-footer.html').text.replaceAll('\\s+', ' ').trim()
|
|
|
|
|
|
|
|
|
|
// Only document the public API, not net.minecraft stubs
|
|
|
|
|
include 'noppes/npcs/api/**'
|
|
|
|
|
|
|
|
|
|
options.links(
|
|
|
|
|
'https://docs.oracle.com/en/java/javase/11/docs/api/'
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
javadocTool = javaToolchains.javadocToolFor {
|
|
|
|
|
languageVersion = JavaLanguageVersion.of(11)
|
|
|
|
|
}
|
2026-03-09 16:20:18 -04:00
|
|
|
}
|
|
|
|
|
|
2024-03-20 02:38:57 -04:00
|
|
|
// Modify the existing 'build' task to depend on 'updateAPI'
|
2025-02-12 12:15:33 -06:00
|
|
|
//tasks.apiClasses.dependsOn 'updateAPI'
|