Skip to content

Commit 345d34b

Browse files
committed
移植尝试
0 parents  commit 345d34b

175 files changed

Lines changed: 12238 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.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: 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

build.gradle

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
plugins {
2+
id 'idea'
3+
id 'java-library'
4+
id 'maven-publish'
5+
id 'net.neoforged.moddev.legacyforge' version '2.0.141'
6+
}
7+
8+
tasks.named('wrapper', Wrapper).configure {
9+
// Define wrapper values here so as to not have to always do so when updating gradlew.properties.
10+
// Switching this to Wrapper.DistributionType.ALL will download the full gradle sources that comes with
11+
// documentation attached on cursor hover of gradle classes and methods. However, this comes with increased
12+
// file size for Gradle. If you do switch this to ALL, run the Gradle wrapper task twice afterwards.
13+
// (Verify by checking gradle/wrapper/gradle-wrapper.properties to see if distributionUrl now points to `-all`)
14+
distributionType = Wrapper.DistributionType.BIN
15+
}
16+
17+
version = mod_version
18+
group = mod_group_id
19+
20+
repositories {
21+
mavenLocal()
22+
flatDir {
23+
dirs 'libs'
24+
}
25+
}
26+
27+
base {
28+
archivesName = mod_id
29+
}
30+
31+
// Mojang ships Java 17 to end users in 1.20.1, so mods should target Java 17.
32+
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
33+
34+
legacyForge {
35+
// Specify the version of MinecraftForge to use.
36+
version = project.minecraft_version + '-' + project.forge_version
37+
38+
parchment {
39+
mappingsVersion = project.parchment_mappings_version
40+
minecraftVersion = project.parchment_minecraft_version
41+
}
42+
43+
// This line is optional. Access Transformers are automatically detected
44+
// accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg')
45+
46+
// Default run configurations.
47+
// These can be tweaked, removed, or duplicated as needed.
48+
runs {
49+
client {
50+
client()
51+
52+
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
53+
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
54+
}
55+
56+
server {
57+
server()
58+
programArgument '--nogui'
59+
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
60+
}
61+
62+
// This run config launches GameTestServer and runs all registered gametests, then exits.
63+
// By default, the server will crash when no gametests are provided.
64+
// The gametest system is also enabled by default for other run configs under the /test command.
65+
gameTestServer {
66+
type = "gameTestServer"
67+
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
68+
}
69+
70+
data {
71+
data()
72+
73+
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
74+
// gameDirectory = project.file('run-data')
75+
76+
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
77+
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
78+
}
79+
80+
// applies to all the run configs above
81+
configureEach {
82+
// Recommended logging data for a userdev environment
83+
// The markers can be added/remove as needed separated by commas.
84+
// "SCAN": For mods scan.
85+
// "REGISTRIES": For firing of registry events.
86+
// "REGISTRYDUMP": For getting the contents of all registries.
87+
systemProperty 'forge.logging.markers', 'REGISTRIES'
88+
89+
// Recommended logging level for the console
90+
// You can set various levels here.
91+
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
92+
logLevel = org.slf4j.event.Level.DEBUG
93+
}
94+
}
95+
96+
mods {
97+
// define mod <-> source bindings
98+
// these are used to tell the game which sources are for which mod
99+
// mostly optional in a single mod project
100+
// but multi mod projects should define one per mod
101+
"${mod_id}" {
102+
sourceSet(sourceSets.main)
103+
}
104+
}
105+
}
106+
107+
// Include resources generated by data generators.
108+
sourceSets.main.resources { srcDir 'src/generated/resources' }
109+
110+
// Sets up a dependency configuration called 'localRuntime' and a deobfuscating one called 'modLocalRuntime'
111+
// These configurations should be used instead of 'runtimeOnly' to declare
112+
// a dependency that will be present for runtime testing but that is
113+
// "optional", meaning it will not be pulled by dependents of this mod.
114+
configurations {
115+
runtimeClasspath.extendsFrom localRuntime
116+
}
117+
obfuscation {
118+
createRemappingConfiguration(configurations.localRuntime)
119+
}
120+
121+
dependencies {
122+
// If you wish to declare dependencies against mods, make sure to use the 'mod*' configurations so that they're remapped.
123+
// See https://github.com/neoforged/ModDevGradle/blob/main/LEGACY.md#remapping-mod-dependencies for more information.
124+
125+
// Example optional mod dependency with JEI
126+
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
127+
// modCompileOnly "mezz.jei:jei-${mc_version}-common-api:${jei_version}"
128+
// modCompileOnly "mezz.jei:jei-${mc_version}-neoforge-api:${jei_version}"
129+
// We add the full version to localRuntime, not runtimeOnly, so that we do not publish a dependency on it
130+
// modLocalRuntime "mezz.jei:jei-${mc_version}-neoforge:${jei_version}"
131+
132+
// Example mod dependency using a mod jar from ./libs with a flat dir repository
133+
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
134+
// The group id is ignored when searching -- in this case, it is "blank"
135+
// modImplementation "blank:coolmod-${mc_version}:${coolmod_version}"
136+
137+
// Example mod dependency using a file as dependency
138+
// modImplementation files("libs/coolmod-${mc_version}-${coolmod_version}.jar")
139+
140+
// Example project dependency using a sister or child project:
141+
// modImplementation project(":myproject")
142+
143+
// For more info:
144+
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
145+
// http://www.gradle.org/docs/current/userguide/dependency_management.html
146+
147+
modImplementation("blank:MesdagPortLib-${portlib_version}:universal")
148+
}
149+
150+
// Uncomment the lines below if you wish to configure mixin. The mixin file should be named modid.mixins.json.
151+
152+
mixin {
153+
add sourceSets.main, "${mod_id}.refmap.json"
154+
config "${mod_id}.mixins.json"
155+
}
156+
157+
dependencies {
158+
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
159+
}
160+
161+
jar {
162+
manifest.attributes([
163+
"MixinConfigs": "${mod_id}.mixins.json"
164+
])
165+
}
166+
167+
168+
// This block of code expands all declared replace properties in the specified resource targets.
169+
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
170+
tasks.withType(ProcessResources).configureEach {
171+
var replaceProperties = [
172+
minecraft_version : minecraft_version,
173+
minecraft_version_range: minecraft_version_range,
174+
forge_version : forge_version,
175+
forge_version_range : forge_version_range,
176+
loader_version_range : loader_version_range,
177+
mod_id : mod_id,
178+
mod_name : mod_name,
179+
mod_license : mod_license,
180+
mod_version : mod_version,
181+
mod_authors : mod_authors,
182+
mod_description : mod_description
183+
]
184+
inputs.properties replaceProperties
185+
186+
filesMatching(['META-INF/mods.toml']) {
187+
expand replaceProperties
188+
}
189+
}
190+
191+
// Example configuration to allow publishing using the maven-publish plugin
192+
publishing {
193+
publications {
194+
register('mavenJava', MavenPublication) {
195+
from components.java
196+
}
197+
}
198+
repositories {
199+
maven {
200+
url "file://${project.projectDir}/repo"
201+
}
202+
}
203+
}
204+
205+
tasks.withType(JavaCompile).configureEach {
206+
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
207+
}
208+
209+
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
210+
idea {
211+
module {
212+
downloadSources = true
213+
downloadJavadoc = true
214+
}
215+
}

gradle.properties

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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.20.1
11+
parchment_mappings_version=2023.09.03
12+
# Environment Properties
13+
# You can find the latest versions here: https://files.minecraftforge.net/net/minecraftforge/forge/index_1.20.1.html
14+
# The Minecraft version must agree with the Forge version to get a valid artifact
15+
minecraft_version=1.20.1
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.20.1, 1.21)
20+
# The Forge version must agree with the Minecraft version to get a valid artifact
21+
forge_version=47.1.3
22+
# The Forge version range can use any version of Forge as bounds
23+
forge_version_range=[47.1.3,)
24+
# The loader version range can only use the major version of FML as bounds
25+
loader_version_range=[47,)
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=confluence_magic_lib
32+
# The human-readable display name for the mod.
33+
mod_name=Confluence Magic Lib
34+
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
35+
mod_license=MIT
36+
# The mod version. See https://semver.org/
37+
mod_version=0.0.9
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=org.confluence.lib
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=Magic Team
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=Library for Confluence series
46+
47+
portlib_version=0.0.9
48+
49+
#systemProp.http.proxyHost=localhost
50+
#systemProp.http.proxyPort=7897
51+
#systemProp.https.proxyHost=localhost
52+
#systemProp.https.proxyPort=7897

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

0 commit comments

Comments
 (0)