-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
95 lines (77 loc) · 2.3 KB
/
build.gradle
File metadata and controls
95 lines (77 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
plugins {
id 'java-library'
id 'maven-publish'
id 'net.neoforged.moddev' version '2.0.78'
}
apply plugin: 'java'
def getCurrentVersion() {
return version.toString().split('\\.').collect { it.toInteger() }
}
def incrementVersion() {
def currentVersion = getCurrentVersion()
currentVersion[2] += 1 // Increase the patch version
return currentVersion.join('.')
}
// Set the initial version if not defined
if (!version) {
version = '1.0.0' // Set your starting version here
}
// Task to increment the version
tasks.register('incrementVersion') {
doLast {
def newVersion = incrementVersion()
project.version = newVersion
// Optionally, write the new version back to a file
def versionFile = file('gradle.properties')
if (versionFile.exists()) {
def props = new Properties()
versionFile.withInputStream { props.load(it) }
props.setProperty('projectVersion', newVersion)
versionFile.withOutputStream { props.store(it, null) }
}
println "Version updated to $newVersion"
}
}
// Hook the increment version task to run before the build task
build.dependsOn incrementVersion
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
version = '1.0.0'
group = 'org.essentials.custom_background_music'
base {
archivesName = 'custom_background_music'
}
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
neoForge {
// This version handles the NeoForge dependency automatically
version = "21.1.213"
runs {
client {
client()
systemProperty 'neoforge.logging.console.level', 'debug'
}
server {
server()
programArgument '--nogui'
}
}
mods {
custom_background_music {
sourceSet sourceSets.main
}
}
}
repositories {
mavenLocal()
mavenCentral()
// NeoForge maven is usually handled by the plugin, but keeping it is fine
maven { url = "https://maven.neoforged.net/releases" }
}
dependencies {
// JLayer for compilation and runtime
implementation "javazoom:jlayer:1.0.1"
// This tells NeoForge to bundle the library into your mod jar
jarJar "javazoom:jlayer:1.0.1"
additionalRuntimeClasspath "javazoom:jlayer:1.0.1"
}