Skip to content

Commit 83c7573

Browse files
authored
Merge pull request #1 from DebuggyTeam/back_to_fabric
Back to fabric
2 parents 0a2827b + 758e415 commit 83c7573

7 files changed

Lines changed: 84 additions & 97 deletions

File tree

build.gradle

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,48 @@
11
plugins {
22
id "maven-publish"
3-
id "org.quiltmc.loom" version "1.+"
3+
id "fabric-loom" version "1.4-SNAPSHOT"
4+
id "signing"
45
}
56

67

78
base.archivesName = project.archives_base_name
8-
version = "${project.version}+${project.minecraft}"
9+
version = "${project.version}+${project.minecraft_version}"
910
group = project.maven_group
1011

1112
repositories {
1213
}
1314

1415
dependencies {
15-
minecraft "com.mojang:minecraft:${project.minecraft}"
16-
mappings "org.quiltmc:quilt-mappings:${project.minecraft}+build.${project.mappings}:intermediary-v2"
17-
18-
modImplementation "org.quiltmc:quilt-loader:${project.loader}"
19-
20-
modImplementation "org.quiltmc.quilted-fabric-api:quilted-fabric-api:${project.qfapi}"
16+
minecraft "com.mojang:minecraft:${project.minecraft_version}"
17+
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
18+
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
19+
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
2120
}
2221

2322
processResources {
2423
inputs.property 'version', version
2524

26-
filesMatching('quilt.mod.json') {
25+
filesMatching('fabric.mod.json') {
2726
expand "version": version
2827
}
2928
}
3029

3130
tasks.withType(JavaCompile).configureEach {
32-
it.options.encoding = 'UTF-8'
33-
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
31+
it.options.encoding = "UTF-8"
3432
it.options.release = 17
3533
}
3634

3735
java {
3836
// Still required by IDEs such as Eclipse and Visual Studio Code
3937
sourceCompatibility = JavaVersion.VERSION_17
4038
targetCompatibility = JavaVersion.VERSION_17
41-
42-
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task if it is present.
43-
// If you remove this line, sources will not be generated.
39+
4440
withSourcesJar()
45-
46-
// If this mod is going to be a library, then it should also generate Javadocs in order to aid with development.
47-
// Uncomment this line to generate them.
48-
// withJavadocJar()
4941
}
5042

5143
// If you plan to use a different file for the license, don't forget to change the file name here!
5244
jar {
53-
from('LICENSE') {
45+
from("LICENSE") {
5446
rename { "${it}_${archivesBaseName}" }
5547
}
5648
}
@@ -61,12 +53,14 @@ publishing {
6153
from components.java
6254
}
6355
}
64-
65-
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
56+
6657
repositories {
67-
// Add repositories to publish to here.
68-
// Notice: This block does NOT have the same function as the block in the top level.
69-
// The repositories here will be used for publishing your artifact, not for
70-
// retrieving dependencies.
58+
}
59+
}
60+
61+
signing {
62+
if (project.hasProperty("signing.keyId")) {
63+
sign configurations.archives;
64+
sign publishing.publications.mavenJava
7165
}
7266
}

gradle.properties

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ org.gradle.jvmargs = -Xmx1G
33
org.gradle.parallel = true
44

55
# Mod Properties
6-
version = 1.0.1
6+
version = 1.1.0
77
maven_group = gay.debuggy
88
archives_base_name = StaticData
99

1010
# Dependencies
11-
minecraft = 1.20
12-
mappings = 4
13-
loader = 0.19.0-beta.18
14-
qfapi = 7.0.1+0.83.0-1.20
11+
minecraft_version=1.20.4
12+
yarn_mappings=1.20.4+build.3
13+
loader_version=0.15.3
14+
fabric_version=0.92.0+1.20.4
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
44
networkTimeout=10000
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

src/main/java/gay/debuggy/staticdata/StaticDataMod.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
package gay.debuggy.staticdata;
22

3-
import org.quiltmc.loader.api.ModContainer;
4-
import org.quiltmc.qsl.base.api.entrypoint.ModInitializer;
3+
import net.fabricmc.api.ModInitializer;
54

65
public class StaticDataMod implements ModInitializer {
76

87
@Override
9-
public void onInitialize(ModContainer mod) {
8+
public void onInitialize() {
109
// we don't really need to do anything here for a library mod, this is just here to satisfy assumptions about mods.
1110
}
1211

src/main/java/gay/debuggy/staticdata/api/StaticData.java

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77
import java.util.List;
88
import java.util.Set;
99

10-
import org.quiltmc.loader.api.ModContainer;
11-
import org.quiltmc.loader.api.QuiltLoader;
12-
1310
import gay.debuggy.staticdata.impl.StaticDataImpl;
11+
import net.fabricmc.loader.api.FabricLoader;
12+
import net.fabricmc.loader.api.ModContainer;
1413
import net.minecraft.util.Identifier;
1514

1615
/**
@@ -51,7 +50,7 @@ public class StaticData {
5150
* @return The staticdata folder path
5251
*/
5352
public static Path getStaticDataDir() {
54-
return QuiltLoader.getGameDir().resolve("staticdata");
53+
return FabricLoader.getInstance().getGameDir().resolve("staticdata");
5554
}
5655

5756
/**
@@ -64,15 +63,17 @@ public static List<StaticDataItem> getExactData(Identifier resourceId) {
6463
synchronized(GLOBAL_MUTEX) {
6564
List<StaticDataItem> result = new ArrayList<>();
6665

67-
for(ModContainer container : QuiltLoader.getAllMods()) {
68-
if (FORBIDDEN_CONTAINERS.contains(container.metadata().id())) continue;
66+
for(ModContainer container : FabricLoader.getInstance().getAllMods()) {
67+
if (FORBIDDEN_CONTAINERS.contains(container.getMetadata().getId())) continue;
6968

70-
StaticDataImpl.addExactData(
71-
container.metadata().id(),
69+
for(Path p : container.getRootPaths()) {
70+
StaticDataImpl.addExactData(
71+
container.getMetadata().getId(),
7272
resourceId,
73-
container.rootPath().resolve("staticdata"),
73+
p.resolve("staticdata"),
7474
result
75-
);
75+
);
76+
}
7677
}
7778

7879
Path saticDataDir = getStaticDataDir();
@@ -111,16 +112,18 @@ public static List<StaticDataItem> getDataInDirectory(Identifier resourceId, boo
111112
synchronized(GLOBAL_MUTEX) {
112113
List<StaticDataItem> result = new ArrayList<>();
113114

114-
for(ModContainer container : QuiltLoader.getAllMods()) {
115-
if (FORBIDDEN_CONTAINERS.contains(container.metadata().id())) continue;
115+
for(ModContainer container : FabricLoader.getInstance().getAllMods()) {
116+
if (FORBIDDEN_CONTAINERS.contains(container.getMetadata().getId())) continue;
116117

117-
StaticDataImpl.addDirectoryData(
118-
container.metadata().id(),
119-
resourceId,
120-
container.rootPath().resolve("staticdata"),
121-
recursive,
122-
result
123-
);
118+
for(Path p : container.getRootPaths()) {
119+
StaticDataImpl.addDirectoryData(
120+
container.getMetadata().getId(),
121+
resourceId,
122+
p.resolve("staticdata"),
123+
recursive,
124+
result
125+
);
126+
}
124127
}
125128

126129
Path saticDataDir = getStaticDataDir();

src/main/resources/fabric.mod.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"schemaVersion": 1,
3+
"id": "staticdata",
4+
"version": "${version}",
5+
"name": "StaticData",
6+
"description": "Effortless mod integration through early access to shared data.",
7+
"authors": [
8+
"Falkreon"
9+
],
10+
"contact": {
11+
"homepage": "https://github.com/DebuggyTeam/StaticData",
12+
"issues": "https://github.com/DebuggyTeam/StaticData/issues",
13+
"sources": "https://github.com/DebuggyTeam/StaticData"
14+
},
15+
"license": "MIT",
16+
"icon": "assets/staticdata/icon.png",
17+
"environment": "*",
18+
"entrypoints": {
19+
"main": [
20+
"gay.debuggy.staticdata.StaticDataMod"
21+
]
22+
},
23+
"mixins": [],
24+
"depends": {
25+
"fabricloader": ">=0.15.0",
26+
"minecraft": "~1.20.4",
27+
"java": ">=17",
28+
"fabric-api": "*"
29+
},
30+
"custom": {
31+
"modmenu": {
32+
"badges": [ "library" ]
33+
}
34+
}
35+
}

src/main/resources/quilt.mod.json

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)