Skip to content

Commit 535bb23

Browse files
committed
[+] Initial version.
Signed-off-by: 秋雨落 <[email protected]>
1 parent a26d746 commit 535bb23

22 files changed

+1066
-1
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: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
- name: Build with Gradle
25+
run: ./gradlew build

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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
27+
output/

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,19 @@
1-
# ToastPack
1+
# ToastPack
2+
3+
The data-pack generator script for Catopia Minecraft server.
4+
5+
## Build
6+
7+
Prerequisites:
8+
- Java 21
9+
10+
Steps:
11+
- Run `gradlew runData` in your command line.
12+
- The pack was in the directory named `output`.
13+
- Copy this directory into `<your save>/datapack`.
14+
- Or zip package it, and import in the create new world screen.
15+
16+
## License
17+
18+
All rights reserved.
19+
Free to build, use, distribute or modify for non-commercial propose.

build.gradle

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
plugins {
2+
id 'java-library'
3+
id 'maven-publish'
4+
id 'net.neoforged.moddev' version '2.0.75'
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+
mavenLocal()
17+
}
18+
19+
base {
20+
archivesName = mod_id
21+
}
22+
23+
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
24+
25+
neoForge {
26+
version = project.neo_version
27+
28+
parchment {
29+
mappingsVersion = project.parchment_mappings_version
30+
minecraftVersion = project.parchment_minecraft_version
31+
}
32+
33+
// accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg')
34+
35+
runs {
36+
data {
37+
data()
38+
logLevel = org.slf4j.event.Level.INFO
39+
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('output').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
40+
}
41+
}
42+
43+
mods {
44+
"${mod_id}" {
45+
sourceSet(sourceSets.main)
46+
}
47+
}
48+
}
49+
50+
sourceSets.main.resources { srcDir 'src/generated/resources' }
51+
52+
configurations {
53+
runtimeClasspath.extendsFrom localRuntime
54+
}
55+
56+
dependencies {
57+
}
58+
59+
var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) {
60+
var replaceProperties = [
61+
minecraft_version : minecraft_version,
62+
minecraft_version_range: minecraft_version_range,
63+
neo_version : neo_version,
64+
neo_version_range : neo_version_range,
65+
loader_version_range : loader_version_range,
66+
mod_id : mod_id,
67+
mod_name : mod_name,
68+
mod_license : mod_license,
69+
mod_version : mod_version,
70+
mod_authors : mod_authors,
71+
mod_description : mod_description
72+
]
73+
inputs.properties replaceProperties
74+
expand replaceProperties
75+
from "src/main/templates"
76+
into "build/generated/sources/modMetadata"
77+
}
78+
79+
sourceSets.main.resources.srcDir generateModMetadata
80+
neoForge.ideSyncTask generateModMetadata
81+
82+
publishing {
83+
publications {
84+
register('mavenJava', MavenPublication) {
85+
from components.java
86+
}
87+
}
88+
repositories {
89+
maven {
90+
url "file://${project.projectDir}/repo"
91+
}
92+
}
93+
}
94+
95+
tasks.withType(JavaCompile).configureEach {
96+
options.encoding = 'UTF-8'
97+
}
98+
99+
idea {
100+
module {
101+
downloadSources = true
102+
downloadJavadoc = true
103+
}
104+
}

gradle.properties

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
2+
org.gradle.jvmargs=-Xmx1G
3+
org.gradle.daemon=true
4+
org.gradle.parallel=true
5+
org.gradle.caching=true
6+
org.gradle.configuration-cache=true
7+
8+
#read more on this at https://github.com/neoforged/ModDevGradle?tab=readme-ov-file#better-minecraft-parameter-names--javadoc-parchment
9+
# you can also find the latest versions at: https://parchmentmc.org/docs/getting-started
10+
parchment_minecraft_version=1.21.3
11+
parchment_mappings_version=2024.12.07
12+
# Environment Properties
13+
# You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge
14+
# The Minecraft version must agree with the Neo version to get a valid artifact
15+
minecraft_version=1.21.3
16+
# The Minecraft version range can use any release version of Minecraft as bounds.
17+
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
18+
# as they do not follow standard versioning conventions.
19+
minecraft_version_range=[1.21.3]
20+
# The Neo version must agree with the Minecraft version to get a valid artifact
21+
neo_version=21.3.58
22+
# The Neo version range can use any version of Neo as bounds
23+
neo_version_range=[21.3.58,)
24+
# The loader version range can only use the major version of FML as bounds
25+
loader_version_range=[1,)
26+
27+
## Mod Properties
28+
29+
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
30+
# Must match the String constant located in the main mod class annotated with @Mod.
31+
mod_id=toast_pack
32+
# The human-readable display name for the mod.
33+
mod_name=ToastPackGenerator
34+
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
35+
mod_license=All Rights Reserved
36+
# The mod version. See https://semver.org/
37+
mod_version=1.0.0
38+
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
39+
# This should match the base package used for the mod sources.
40+
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
41+
mod_group_id=cx.rain.mc.toast
42+
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
43+
mod_authors=qyl27
44+
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
45+
mod_description=The data-pack generator script for Catopia Minecraft server.

gradle/wrapper/gradle-wrapper.jar

42.6 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.12-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)