Skip to content

Commit e582262

Browse files
committed
Refactor build and mod metadata
- Updated build tasks to open build directories on Windows. - Changed mod ID and updated dependencies in `gradle.properties` and `neoforge.mods.toml`. - Modified NeoForge mod initialization and dependencies.
1 parent c099b5f commit e582262

5 files changed

Lines changed: 66 additions & 39 deletions

File tree

build.gradle

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
1-
task openBuildDir {
1+
task openBuildDirFabric {
22
doLast {
3-
def buildDir = file("${layout.buildDirectory.get().asFile.absolutePath}/libs").absolutePath
3+
def buildDir = file("D:/ProgrammingProjects/TimeLoop/fabric/build/libs").absolutePath
4+
if (System.properties['os.name'].toString().toLowerCase().contains('windows')) {
5+
def command = ['explorer', buildDir]
6+
new ProcessBuilder(command).start()
7+
} else {
8+
println "Skipping openBuildDir task as it is not running on Windows."
9+
}
10+
}
11+
}
12+
13+
task openBuildDirNeoForge {
14+
doLast {
15+
def buildDir = file("D:/ProgrammingProjects/TimeLoop/neoforge/build/libs").absolutePath
416
if (System.properties['os.name'].toString().toLowerCase().contains('windows')) {
517
def command = ['explorer', buildDir]
618
new ProcessBuilder(command).start()
@@ -52,12 +64,26 @@ subprojects {
5264
jar {
5365
exclude "assets/time-loop/icon.psd"
5466
}
55-
56-
if (project.name in ["fabric", "neoforge"]) {
67+
68+
if (project.name == "fabric") {
69+
tasks.named("jar") {
70+
finalizedBy rootProject.tasks.named("openBuildDirFabric")
71+
}
72+
} else if (project.name == "neoforge") {
5773
tasks.named("jar") {
58-
finalizedBy rootProject.tasks.named("openBuildDir")
74+
finalizedBy rootProject.tasks.named("openBuildDirNeoForge")
5975
}
6076
}
77+
78+
if (project.name in ["fabric", "neoforge"]) {
79+
dependencies
80+
{
81+
compileOnly project(":common")
82+
}
83+
84+
processResources { from project(":common").sourceSets.main.resources }
85+
tasks.named("compileJava", JavaCompile) { source project(":common").sourceSets.main.allSource }
86+
}
6187

6288
java {
6389
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Mod Properties
2-
mod_id=time-loop
2+
mod_id=timeloop
33
mod_version=1.7.5
44
mod_name=Time Loop
55
mod_description=A set of commands that 'loops' time by using the Motion Capture Mod. Motion Capture mod by mt1006. Inspired by Tombino. Original datapack by Penguin Mafia.

neoforge/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@ neoForge {
2929

3030
dependencies {
3131
implementation project(path: ':common', configuration: 'namedElements')
32+
api project(":common")
3233
implementation "maven.modrinth:motion-capture:${mod_mocap_version}-neoforge-${minecraft_version}"
3334
}

neoforge/src/main/java/com/vltno/timeloop/neoforge/TimeLoopNeoForge.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.vltno.timeloop.neoforge; // Changed package
1+
package com.vltno.timeloop.neoforge;
22

33
import com.vltno.timeloop.LoopCommands;
44
import com.vltno.timeloop.TimeLoop;
@@ -28,22 +28,19 @@ public class TimeLoopNeoForge {
2828

2929
public static final boolean isLogicalServer = !FMLEnvironment.dist.isClient();
3030

31-
public TimeLoopNeoForge(IEventBus modEventBus) { // NeoForge uses constructor injection for mod bus
31+
public TimeLoopNeoForge(IEventBus modEventBus) {
3232
LOOP_LOGGER.info("Initializing TimeLoop mod (NeoForge)");
33-
34-
// Pass the logical server status to common init
33+
3534
TimeLoop.init(isLogicalServer);
3635

37-
// Register command registration listener to the MOD event bus
38-
modEventBus.addListener(this::registerCommands);
39-
4036
// Register gameplay event listeners to the NeoForge EVENT bus
4137
NeoForge.EVENT_BUS.register(this);
4238

4339
LOOP_LOGGER.info("TimeLoop mod initialized successfully (NeoForge)");
4440
}
4541

4642
// Command registration handler
43+
@SubscribeEvent
4744
public void registerCommands(RegisterCommandsEvent event) {
4845
LOOP_LOGGER.info("Registering TimeLoop commands (NeoForge)");
4946
LoopCommands.register(event.getDispatcher());
Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,34 @@
1-
modLoader = "javafml"
2-
loaderVersion = "[4,)"
3-
#issueTrackerURL = ""
4-
license = "Insert License Here"
1+
modLoader="javafml"
2+
loaderVersion="*"
3+
license="${mod_license}"
4+
issueTrackerURL="${mod_issues}"
55

66
[[mods]]
7-
modId = "timeloop"
8-
version = "${version}"
9-
displayName = "Time Loop"
10-
authors = "Me!"
11-
description = '''
12-
This is an example description! Tell everyone what your mod is about!
13-
'''
14-
#logoFile = ""
7+
modId="${mod_id}"
8+
version="${mod_version}"
9+
displayName="${mod_name}"
10+
displayURL="${mod_homepage}"
11+
logoFile="logo.png"
12+
authors="${mod_author_1}, ${mod_author_2}"
13+
description='''${mod_description}'''
1514

16-
[[dependencies.timeloop]]
17-
modId = "neoforge"
18-
type = "required"
19-
versionRange = "[21.1,)"
20-
ordering = "NONE"
21-
side = "BOTH"
15+
[[dependencies.${mod_id}]]
16+
modId="neoforge"
17+
type="required"
18+
versionRange="*"
19+
ordering="NONE"
20+
side="BOTH"
2221

23-
[[dependencies.timeloop]]
24-
modId = "minecraft"
25-
type = "required"
26-
versionRange = "[1.21.1,)"
27-
ordering = "NONE"
28-
side = "BOTH"
22+
[[dependencies.${mod_id}]]
23+
modId="minecraft"
24+
type="required"
25+
versionRange="${minecraft_version}"
26+
ordering="NONE"
27+
side="BOTH"
2928

30-
[[mixins]]
31-
config = "timeloop.mixins.json"
29+
[[dependencies.${mod_id}]]
30+
modId="mocap"
31+
type="required"
32+
versionRange="${mod_mocap_version}"
33+
ordering="NONE"
34+
side="BOTH"

0 commit comments

Comments
 (0)