Skip to content

Commit 07dfaf8

Browse files
committed
Initialize project with Gradle setup, build configuration, and basic mod structure
1 parent 58c20e6 commit 07dfaf8

File tree

13 files changed

+673
-0
lines changed

13 files changed

+673
-0
lines changed

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Disable autocrlf on generated files, they always generate with LF
2+
# Add any extra files or paths here to make git stop saying they
3+
# are changed when only line endings change.
4+
src/generated/**/.cache/cache text eol=lf
5+
src/generated/**/*.json text eol=lf

.github/workflows/build.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Build
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout repository
10+
uses: actions/checkout@v4
11+
with:
12+
fetch-depth: 0
13+
fetch-tags: true
14+
15+
- name: Setup JDK 21
16+
uses: actions/setup-java@v4
17+
with:
18+
java-version: '21'
19+
distribution: 'temurin'
20+
21+
- name: Setup Gradle
22+
uses: gradle/actions/setup-gradle@v4
23+
24+
# This is needed to be able to run ./gradlew below
25+
# You can run `git update-index --chmod +x gradlew` then remove this step.
26+
- name: Make Gradle wrapper executable
27+
run: chmod +x ./gradlew
28+
29+
- name: Build with Gradle
30+
run: ./gradlew build

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# eclipse
2+
bin
3+
*.launch
4+
.settings
5+
.metadata
6+
.classpath
7+
.project
8+
9+
# idea
10+
out
11+
*.ipr
12+
*.iws
13+
*.iml
14+
.idea
15+
16+
# gradle
17+
build
18+
.gradle
19+
20+
# other
21+
eclipse
22+
run
23+
runs
24+
run-data
25+
26+
repo

TEMPLATE_LICENSE.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
MIT License
2+
3+
Copyright (c) 2023 NeoForged project
4+
5+
This license applies to the template files as supplied by github.com/NeoForged/MDK
6+
7+
8+
Permission is hereby granted, free of charge, to any person obtaining a copy
9+
of this software and associated documentation files (the "Software"), to deal
10+
in the Software without restriction, including without limitation the rights
11+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
copies of the Software, and to permit persons to whom the Software is
13+
furnished to do so, subject to the following conditions:
14+
15+
The above copyright notice and this permission notice shall be included in all
16+
copies or substantial portions of the Software.
17+
18+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24+
SOFTWARE.

build.gradle

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
plugins {
2+
id 'java-library'
3+
id 'maven-publish'
4+
id 'net.neoforged.moddev' version '2.0.107'
5+
id 'idea'
6+
}
7+
8+
tasks.named('wrapper', Wrapper).configure {
9+
distributionType = Wrapper.DistributionType.BIN
10+
}
11+
12+
version = mod_version
13+
group = mod_group_id
14+
15+
repositories {
16+
maven {
17+
url "https://maven.latvian.dev/releases"
18+
content {
19+
includeGroup "dev.latvian.mods"
20+
includeGroup "dev.latvian.apps"
21+
}
22+
}
23+
24+
maven {
25+
url 'https://jitpack.io'
26+
content {
27+
includeGroup "com.github.rtyley"
28+
}
29+
}
30+
}
31+
32+
base {
33+
archivesName = mod_id
34+
}
35+
36+
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
37+
38+
neoForge {
39+
version = project.neo_version
40+
41+
parchment {
42+
mappingsVersion = project.parchment_mappings_version
43+
minecraftVersion = project.parchment_minecraft_version
44+
}
45+
46+
runs {
47+
client {
48+
client()
49+
50+
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
51+
}
52+
53+
server {
54+
server()
55+
programArgument '--nogui'
56+
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
57+
}
58+
59+
gameTestServer {
60+
type = "gameTestServer"
61+
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
62+
}
63+
64+
data {
65+
data()
66+
67+
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
68+
}
69+
70+
configureEach {
71+
systemProperty 'forge.logging.markers', 'REGISTRIES'
72+
73+
logLevel = org.slf4j.event.Level.DEBUG
74+
}
75+
}
76+
77+
mods {
78+
"${mod_id}" {
79+
sourceSet(sourceSets.main)
80+
}
81+
}
82+
}
83+
84+
sourceSets.main.resources { srcDir 'src/generated/resources' }
85+
86+
configurations {
87+
runtimeClasspath.extendsFrom localRuntime
88+
}
89+
90+
dependencies {
91+
api("dev.latvian.mods:kubejs-neoforge:$kubejs_version")
92+
interfaceInjectionData("dev.latvian.mods:kubejs-neoforge:$kubejs_version") // optional
93+
}
94+
95+
var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) {
96+
var replaceProperties = [
97+
minecraft_version : minecraft_version,
98+
minecraft_version_range: minecraft_version_range,
99+
neo_version : neo_version,
100+
loader_version_range : loader_version_range,
101+
mod_id : mod_id,
102+
mod_name : mod_name,
103+
mod_license : mod_license,
104+
mod_version : mod_version,
105+
mod_authors : mod_authors,
106+
mod_description : mod_description,
107+
kubejs_version : kubejs_version,
108+
kubejs_version_range : kubejs_version_range
109+
]
110+
inputs.properties replaceProperties
111+
expand replaceProperties
112+
from "src/main/templates"
113+
into "build/generated/sources/modMetadata"
114+
}
115+
sourceSets.main.resources.srcDir generateModMetadata
116+
neoForge.ideSyncTask generateModMetadata
117+
118+
publishing {
119+
publications {
120+
register('mavenJava', MavenPublication) {
121+
from components.java
122+
}
123+
}
124+
repositories {
125+
maven {
126+
url "file://${project.projectDir}/repo"
127+
}
128+
}
129+
}
130+
131+
tasks.withType(JavaCompile).configureEach {
132+
options.encoding = 'UTF-8'
133+
}
134+
135+
idea {
136+
module {
137+
downloadSources = true
138+
downloadJavadoc = true
139+
}
140+
}

gradle.properties

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
org.gradle.jvmargs=-Xmx4G
2+
org.gradle.daemon=true
3+
org.gradle.parallel=true
4+
org.gradle.caching=true
5+
org.gradle.configuration-cache=true
6+
7+
parchment_minecraft_version=1.21.1
8+
parchment_mappings_version=2024.11.17
9+
10+
# Environment Properties
11+
minecraft_version=1.21.1
12+
minecraft_version_range=[1.21.1]
13+
neo_version=21.1.197
14+
loader_version_range=[1,)
15+
kubejs_version=2101.7.2-build.233
16+
kubejs_version_range=[2101.7.2-build.233,)
17+
18+
## Mod Properties
19+
mod_id=compateventjs
20+
mod_name=CompatEventJS
21+
mod_license=AGPL v3.0
22+
mod_version=1.0.0
23+
mod_group_id=dev.mangojellypudding.compateventjs
24+
mod_authors=MangoJellyPudding
25+
mod_description=Extend more NeoForge Events to KubeJS

gradle/wrapper/gradle-wrapper.jar

42.7 KB
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)