Skip to content

Commit fef9266

Browse files
Merge branch 'main' into kotlin
2 parents 6e7c611 + 9355588 commit fef9266

4 files changed

Lines changed: 48 additions & 37 deletions

File tree

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ You can find dependencies block in `gradle/scripts/dependencies.gradle`.
2626

2727
No more `rfg.deobf()` or `fg.deobf`. You **MUST** add mods by using `modImplementation` or `modRuntimeOnly`, or the game will crash when running.
2828

29+
Use `modLibrary` for libs/mods that you don't want to remap.
30+
2931
### Non-Mod Dependencies
3032
Two new configuration types `contain` and `shadow` are available, check more details in `dependencies.gradle`.
3133

@@ -44,10 +46,11 @@ You should change its location to fit your new package name.
4446
You can find its template under `src/main/java-templates`.
4547

4648
### Mixin
47-
1. Rename json config file to include your modid. You will need one json per phase (`PRE_INIT`, `DEFAULT`, `MOD`)
48-
2. Add your mixin classes there.
49-
3. Use `IMixinConfigPlugin` to control if certain mixin should be enabled. You can call `Loader.isModLoaded()` for `MOD` phase mixins.
50-
4. Don't worry about refmap, Unimined will handle it automatically. You can still `disableRefmap()` manually though
49+
1. Rename json config file to use your modid.
50+
2. Add **all** your mixin classes there.
51+
3. Use `IMixinConfigPlugin` to control if certain mixin should be enabled.
52+
4. mixin classes will be passed to the plugin only when target class is loading, so you don't need to call `Loader.isModLoaded()`
53+
5. Don't worry about refmap, Unimined will handle it automatically. You can still `disableRefmap()` manually though
5154

5255
### Access Transformer
5356
You **MUST** write AT file in MCP name. It will be remapped back to SRG name in artifact jar.

build.gradle.kts

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import org.jetbrains.gradle.ext.Gradle
22
import org.jetbrains.gradle.ext.compiler
33
import org.jetbrains.gradle.ext.runConfigurations
4-
import org.jetbrains.gradle.ext.taskTriggers
54
import org.jetbrains.gradle.ext.settings
5+
import org.jetbrains.gradle.ext.taskTriggers
66

77
plugins {
88
java
@@ -11,7 +11,7 @@ plugins {
1111
kotlin("jvm") version "2.4.0"
1212
id("com.gradleup.shadow") version "9.5.1"
1313
id("org.jetbrains.gradle.plugin.idea-ext") version "1.4.1"
14-
id("xyz.wagyourtail.unimined") version "1.4.35-kappa"
14+
id("xyz.wagyourtail.unimined") version "1.4.36-kappa"
1515
id("net.kyori.blossom") version "2.2.0"
1616
}
1717

@@ -180,9 +180,14 @@ sourceSets {
180180
property("mod_name", mod_name)
181181
property("mod_version", mod_version)
182182
property("mod_description", mod_description)
183-
property("mod_authors", mod_authors.takeIf { it.isNotBlank() }
184-
?.split(",")?.filter { it.isNotBlank() }
185-
?.joinToString("\", \"") { it.trim() } ?: "")
183+
property(
184+
"mod_authors",
185+
mod_authors
186+
.takeIf { it.isNotBlank() }
187+
?.split(",")
188+
?.filter { it.isNotBlank() }
189+
?.joinToString("\", \"") { it.trim() } ?: "",
190+
)
186191
property("mod_credits", mod_credits)
187192
property("mod_url", mod_url)
188193
property("mod_update_json", mod_update_json)
@@ -204,15 +209,21 @@ idea {
204209
project {
205210
settings {
206211
runConfigurations {
207-
add(Gradle("1. Build").apply {
208-
setProperty("taskNames", listOf("build"))
209-
})
210-
add(Gradle("2. Run Client").apply {
211-
setProperty("taskNames", listOf("runClient"))
212-
})
213-
add(Gradle("3. Run Server").apply {
214-
setProperty("taskNames", listOf("runServer"))
215-
})
212+
add(
213+
Gradle("1. Build").apply {
214+
setProperty("taskNames", listOf("build"))
215+
},
216+
)
217+
add(
218+
Gradle("2. Run Client").apply {
219+
setProperty("taskNames", listOf("runClient"))
220+
},
221+
)
222+
add(
223+
Gradle("3. Run Server").apply {
224+
setProperty("taskNames", listOf("runServer"))
225+
},
226+
)
216227
}
217228
compiler.javac {
218229
afterEvaluate {
@@ -263,15 +274,6 @@ tasks.shadowJar {
263274
archiveClassifier = "shadow"
264275
}
265276

266-
tasks.named(remapTaskName) {
267-
doFirst {
268-
logging.captureStandardOutput(LogLevel.INFO)
269-
}
270-
doLast {
271-
logging.captureStandardOutput(LogLevel.QUIET)
272-
}
273-
}
274-
275277
java {
276278
sourceCompatibility = JavaVersion.VERSION_25
277279
targetCompatibility = JavaVersion.VERSION_25

buildSrc/src/main/kotlin/dependencies.gradle.kts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ dependencies {
3333
compileOnly("com.cleanroommc:lwjglx:1.0.0")
3434
}
3535

36-
add("modImplementation", "io.github.chaosunity.forgelin:Forgelin-Continuous:2.4.0.0")
37-
add("modImplementation", "mezz:jei:4.33.0:dev")
36+
add("modLibrary", "io.github.chaosunity.forgelin:Forgelin-Continuous:2.4.0.0:dev")
37+
add("modLibrary", "mezz:jei:4.33.0:dev")
3838

3939
// Example - Dependency descriptor:
4040
// 'com.google.code.gson:gson:2.8.6' << group: com.google.code.gson, name:gson, version:2.8.6
@@ -57,6 +57,7 @@ dependencies {
5757
// shadow = bundle dependencies into shadow output artifact (relocation configurable in shadowJar task)
5858
// modImplementation = mod dependency available at both compile time and runtime
5959
// modCompileOnly = mod dependency available only at compile time
60+
// modLibrary = won't be remap but will be forced injected into classpath later
6061

6162
// Transitive dependencies:
6263
// (Dependencies that your dependency depends on)

src/main/kotlin/com/example/modid/ExampleMod.kt

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,24 @@ import org.apache.logging.log4j.Logger
1010

1111
@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION)
1212
class ExampleMod {
13-
14-
val LOGGER: Logger = LogManager.getLogger(Reference.MOD_NAME)
15-
@SidedProxy(modId = Reference.MOD_ID, clientSide = "com.example.modid.proxy.ClientProxy", serverSide = "com.example.modid.proxy.CommonProxy")
13+
val logger: Logger = LogManager.getLogger(Reference.MOD_NAME)
14+
15+
@SidedProxy(
16+
modId = Reference.MOD_ID,
17+
clientSide = "com.example.modid.proxy.ClientProxy",
18+
serverSide = "com.example.modid.proxy.CommonProxy",
19+
)
1620
var proxy: IProxy? = null
21+
1722
/**
1823
* [
1924
* Take a look at how many FMLStateEvents you can listen to via the @Mod.EventHandler annotation here
20-
](https://cleanroommc.com/wiki/forge-mod-development/event#overview) *
25+
](https://cleanroommc.com/wiki/forge-mod-development/event#overview) *
2126
*/
2227
@Mod.EventHandler
2328
fun preInit(event: FMLPreInitializationEvent?) {
24-
LOGGER.info("Hello From {}!", Reference.MOD_NAME)
25-
LOGGER.info("Proxy is {}", proxy)
26-
LOGGER.info("Language: {}", Minecraft.getMinecraft().languageManager.currentLanguage)
29+
logger.info("Hello From {}!", Reference.MOD_NAME)
30+
logger.info("Proxy is {}", proxy)
31+
logger.info("Language: {}", Minecraft.getMinecraft().languageManager.currentLanguage)
2732
}
28-
}
33+
}

0 commit comments

Comments
 (0)