mirror of
https://github.com/KAMKEEL/CustomNPC-Gecko-Addon.git
synced 2026-11-20 19:19:45 +00:00
Submodule Building approach to Gecko Addon, CNPC+, Gecko Lib
This commit is contained in:
1 parent
6aa3c3e596
commit
66e2066fcc
14 files changed
+166
-15
No files matched your search
@@ -36,3 +36,6 @@ addon.local.gradle.kts
|
||||
addon.late.local.gradle
|
||||
addon.late.local.gradle.kts
|
||||
layout.json
|
||||
|
||||
# Generated D.TS files (rebuilt by gradle on every build)
|
||||
src/main/resources/assets/npcgecko/api
|
||||
+6
-3
@@ -1,4 +1,7 @@
|
||||
[submodule "src/api"]
|
||||
path = src/api
|
||||
url = https://github.com/KAMKEEL/CustomNPC-Plus-API.git
|
||||
[submodule "CustomNPC-Plus"]
|
||||
path = CustomNPC-Plus
|
||||
url = https://github.com/KAMKEEL/CustomNPC-Plus.git
|
||||
branch = dev
|
||||
[submodule "GeckoLib"]
|
||||
path = GeckoLib
|
||||
url = https://github.com/Goodbird-git/Geckolib-Unofficial-1.7.10.git
|
||||
Submodule
+1
Submodule CustomNPC-Plus added at 6bf33e4296.
Submodule
+1
Submodule GeckoLib added at 19da3e3fc0.
+24
-1
@@ -2,7 +2,30 @@
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhconvention'
|
||||
id 'dts.typescript-generator'
|
||||
}
|
||||
|
||||
apply from: 'gradle.submodules.gradle'
|
||||
|
||||
version = "1.3"
|
||||
group= "com.goodbird.npcgecko"
|
||||
group = "com.goodbird.npcgecko"
|
||||
|
||||
// ============================================================================
|
||||
// TypeScript Definition Generation Task
|
||||
// Generates .d.ts files from Java API sources for scripting IDE support
|
||||
// ============================================================================
|
||||
tasks.named("generateTypeScriptDefinitions").configure {
|
||||
sourceDirectories = ['src/main/java']
|
||||
outputDirectory = "src/main/resources/assets/${project.property("modId")}/api"
|
||||
apiPackages = ['com.goodbird.npcgecko.api'] as Set
|
||||
cleanOutputFirst = true
|
||||
patchesDirectory = "dts-patches"
|
||||
implementationPackages = [
|
||||
'com.goodbird.npcgecko.data',
|
||||
'com.goodbird.npcgecko.entity',
|
||||
'com.goodbird.npcgecko.tile',
|
||||
'com.goodbird.npcgecko.client'
|
||||
] as Set
|
||||
}
|
||||
processResources.dependsOn generateTypeScriptDefinitions
|
||||
sourcesJar.dependsOn generateTypeScriptDefinitions
|
||||
+3
-3
@@ -34,9 +34,9 @@
|
||||
* For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph
|
||||
*/
|
||||
dependencies {
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.5.4-GTNH:dev")
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.8.74-GTNH:dev")
|
||||
runtimeOnlyNonPublishable("curse.maven:Nashorn-374413:2924946")
|
||||
|
||||
implementation rfg.deobf(name: "CustomNPC-Plus-1.10.2")
|
||||
implementation name: "geckolib3-1.0.4-beta"
|
||||
// CustomNPC+ and GeckoLib are managed as submodule dependencies
|
||||
// See gradle.submodules.gradle for details
|
||||
}
|
||||
+6
-1
@@ -3,11 +3,16 @@ modName = CustomNPC-Plus-Gecko-Addon
|
||||
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
|
||||
modId = npcgecko
|
||||
modGroup = com.goodbird.npcgecko
|
||||
modVersion = 1.1
|
||||
modVersion = 1.3
|
||||
|
||||
gtnh.modules.codeStyle=true
|
||||
gtnh.modules.gitVersion=false
|
||||
|
||||
# JVM args for Gradle daemon - increase for faster builds
|
||||
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=1g
|
||||
org.gradle.parallel=true
|
||||
org.gradle.caching=true
|
||||
|
||||
# Whether to use modGroup as the maven publishing group.
|
||||
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
|
||||
useModGroupForPublishing = false
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
// ============================================================================
|
||||
// Submodule Dependency Management
|
||||
// ============================================================================
|
||||
// Manages CustomNPC+ and GeckoLib as git submodule dependencies.
|
||||
//
|
||||
// How it works:
|
||||
// - Both mods are git submodules built automatically alongside this mod
|
||||
// - Their dev JARs are referenced as devOnlyNonPublishable dependencies
|
||||
// - This means: available at COMPILE + RUNTIME, but NOT in the output JAR
|
||||
// - ./gradlew build -> builds CNPC+ & GeckoLib first, then clean addon-only JAR
|
||||
// - ./gradlew runClient -> builds CNPC+ & GeckoLib first, then runs with all on classpath
|
||||
//
|
||||
// First-time setup:
|
||||
// ./gradlew initSubmodules (clones/updates submodules recursively)
|
||||
// ============================================================================
|
||||
|
||||
def isWindows = System.getProperty('os.name').toLowerCase().contains('windows')
|
||||
|
||||
// Resolve the gradlew executable for a submodule directory
|
||||
def gradlewFor = { File submoduleDir ->
|
||||
if (isWindows) {
|
||||
return new File(submoduleDir, 'gradlew.bat').absolutePath
|
||||
} else {
|
||||
return new File(submoduleDir, 'gradlew').absolutePath
|
||||
}
|
||||
}
|
||||
|
||||
// Helper: find the dev JAR in a submodule's build output (resolved at execution time)
|
||||
def findDevJar = { String submoduleDir ->
|
||||
def libsDir = file("${submoduleDir}/build/libs")
|
||||
if (!libsDir.exists()) return []
|
||||
return libsDir.listFiles()?.findAll { it.name.endsWith('-dev.jar') && !it.name.contains('-preshadow') } ?: []
|
||||
}
|
||||
|
||||
// ---- Submodule Init Task ----
|
||||
tasks.register('initSubmodules', Exec) {
|
||||
group = 'submodules'
|
||||
description = 'Initialize and update all git submodules recursively'
|
||||
commandLine 'git', 'submodule', 'update', '--init', '--recursive'
|
||||
}
|
||||
|
||||
// Helper: clean old dev JARs from a submodule's build/libs before rebuilding
|
||||
// Prevents stale JARs from different versions accumulating on the classpath
|
||||
def cleanDevJars = { String submoduleDir ->
|
||||
def libsDir = file("${submoduleDir}/build/libs")
|
||||
if (libsDir.exists()) {
|
||||
libsDir.listFiles()?.each { if (it.name.endsWith('.jar')) it.delete() }
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Build CustomNPC+ ----
|
||||
// Uses -Pnomixin to avoid embedding Mixin into the JAR (UniMixins provides it at runtime)
|
||||
tasks.register('buildCNPC', Exec) {
|
||||
group = 'submodules'
|
||||
description = 'Builds CustomNPC+ dev JAR from submodule source (no embedded Mixin)'
|
||||
workingDir file('CustomNPC-Plus')
|
||||
|
||||
doFirst { cleanDevJars('CustomNPC-Plus') }
|
||||
|
||||
def gradlew = gradlewFor(file('CustomNPC-Plus'))
|
||||
if (isWindows) {
|
||||
commandLine 'cmd', '/c', gradlew, 'build', '-Pnomixin', '-x', 'test'
|
||||
} else {
|
||||
commandLine gradlew, 'build', '-Pnomixin', '-x', 'test'
|
||||
}
|
||||
|
||||
// Gradle up-to-date checking
|
||||
inputs.dir file('CustomNPC-Plus/src')
|
||||
outputs.dir file('CustomNPC-Plus/build/libs')
|
||||
}
|
||||
|
||||
// ---- Build GeckoLib ----
|
||||
tasks.register('buildGeckoLib', Exec) {
|
||||
group = 'submodules'
|
||||
description = 'Builds GeckoLib dev JAR from submodule source'
|
||||
workingDir file('GeckoLib')
|
||||
|
||||
doFirst { cleanDevJars('GeckoLib') }
|
||||
|
||||
def gradlew = gradlewFor(file('GeckoLib'))
|
||||
if (isWindows) {
|
||||
commandLine 'cmd', '/c', gradlew, 'build', '-x', 'test'
|
||||
} else {
|
||||
commandLine gradlew, 'build', '-x', 'test'
|
||||
}
|
||||
|
||||
// Gradle up-to-date checking
|
||||
inputs.dir file('GeckoLib/src')
|
||||
outputs.dir file('GeckoLib/build/libs')
|
||||
}
|
||||
|
||||
// ---- Convenience: build all submodules ----
|
||||
tasks.register('buildSubmodules') {
|
||||
group = 'submodules'
|
||||
description = 'Builds all submodule dev JARs'
|
||||
dependsOn 'buildCNPC', 'buildGeckoLib'
|
||||
}
|
||||
|
||||
// ---- Auto-build: submodules compile before this mod ----
|
||||
tasks.named('compileJava').configure {
|
||||
dependsOn 'buildCNPC', 'buildGeckoLib'
|
||||
}
|
||||
|
||||
// ---- Dependency Declarations ----
|
||||
// devOnlyNonPublishable = compile + runtime, but NOT in output JAR and NOT published
|
||||
// Dev JARs are already deobfuscated (MCP names), so no rfg.deobf() needed
|
||||
// Using lazy file resolution so JARs are found AFTER submodule build tasks execute
|
||||
dependencies {
|
||||
devOnlyNonPublishable files({ findDevJar('CustomNPC-Plus') })
|
||||
devOnlyNonPublishable files({ findDevJar('GeckoLib') })
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+2
-4
@@ -1,7 +1,5 @@
|
||||
// Add any additional repositories for your dependencies here
|
||||
// Additional repositories for dependencies
|
||||
// Submodule dependencies (CustomNPC+, GeckoLib) are managed via gradle.submodules.gradle
|
||||
|
||||
repositories {
|
||||
flatDir {
|
||||
dirs 'lib'
|
||||
}
|
||||
}
|
||||
+7
-1
@@ -10,6 +10,7 @@ pluginManagement {
|
||||
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
||||
}
|
||||
}
|
||||
maven { url "https://jitpack.io" }
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
@@ -17,5 +18,10 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.15'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.27'
|
||||
}
|
||||
|
||||
// Include the D.TS generator plugin from CustomNPC+ submodule
|
||||
if (file('CustomNPC-Plus/gradle-plugins/settings.gradle').exists()) {
|
||||
includeBuild 'CustomNPC-Plus/gradle-plugins'
|
||||
}
|
||||
@@ -143,7 +143,7 @@ public class RenderCustomModel extends GeoEntityRenderer<EntityCustomModel> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
|
||||
public ResourceLocation getEntityTexture(Entity p_110775_1_) {
|
||||
return super.getTextureLocation((EntityCustomModel) p_110775_1_);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user