Skip to content

Commit fbe871e

Browse files
Use toki.mod.json. Version 0.1.2
1 parent f5855a1 commit fbe871e

File tree

12 files changed

+169
-88
lines changed

12 files changed

+169
-88
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ mcVersion=1.19
99

1010
# Toki info
1111
gameVersion=1.19.4
12-
tokiVersion=0.1.1
12+
tokiVersion=0.1.2
1313
spigotMappingsRef=177811e1fa90f674897a302820f3ed84e4d65688
1414
mojangMappingsRef=bc44f6dd84cd2f3ad8c0caad850eaca9e82067e3
1515

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Denery <dorofeevij@gmail.com>
3+
Date: Mon, 1 May 2023 13:11:24 +0300
4+
Subject: [PATCH] Toki branding
5+
6+
7+
diff --git a/build.gradle b/build.gradle
8+
index d3b1e2208dc7c5202ec09b9e43349f91855fabb6..451fc2e0f404cfe84b9621224132a41baf6ed804 100644
9+
--- a/build.gradle
10+
+++ b/build.gradle
11+
@@ -93,7 +93,7 @@ dependencies {
12+
processResources {
13+
inputs.property "version", project.version
14+
15+
- filesMatching("fabric.mod.json") {
16+
+ filesMatching("toki.mod.json") { // Toki
17+
expand "version": project.version
18+
}
19+
}
20+
diff --git a/src/main/java/net/fabricmc/loader/impl/discovery/ArgumentModCandidateFinder.java b/src/main/java/net/fabricmc/loader/impl/discovery/ArgumentModCandidateFinder.java
21+
index 5705d5b3b951e422a11c99bf41544cbf8b653dd6..62ee03c60e77877d484e429263aa0406569db57c 100644
22+
--- a/src/main/java/net/fabricmc/loader/impl/discovery/ArgumentModCandidateFinder.java
23+
+++ b/src/main/java/net/fabricmc/loader/impl/discovery/ArgumentModCandidateFinder.java
24+
@@ -93,7 +93,7 @@ public class ArgumentModCandidateFinder implements ModCandidateFinder {
25+
return;
26+
}
27+
28+
- if (Files.exists(path.resolve("fabric.mod.json"))) { // extracted mod
29+
+ if (Files.exists(path.resolve("toki.mod.json"))) { // extracted mod // Toki
30+
out.accept(path, requiresRemap);
31+
} else { // dir containing jars
32+
try {
33+
diff --git a/src/main/java/net/fabricmc/loader/impl/discovery/ClasspathModCandidateFinder.java b/src/main/java/net/fabricmc/loader/impl/discovery/ClasspathModCandidateFinder.java
34+
index 55caa1b1c94bac01b1d74cf1e77f06426c745c5a..e86e256e60291693f810dd9b77d3e645667d57f4 100644
35+
--- a/src/main/java/net/fabricmc/loader/impl/discovery/ClasspathModCandidateFinder.java
36+
+++ b/src/main/java/net/fabricmc/loader/impl/discovery/ClasspathModCandidateFinder.java
37+
@@ -48,13 +48,13 @@ public class ClasspathModCandidateFinder implements ModCandidateFinder {
38+
39+
// Search for URLs which point to 'fabric.mod.json' entries, to be considered as mods.
40+
try {
41+
- Enumeration<URL> mods = FabricLauncherBase.getLauncher().getTargetClassLoader().getResources("fabric.mod.json");
42+
+ Enumeration<URL> mods = FabricLauncherBase.getLauncher().getTargetClassLoader().getResources("toki.mod.json"); // Toki
43+
44+
while (mods.hasMoreElements()) {
45+
URL url = mods.nextElement();
46+
47+
try {
48+
- Path path = LoaderUtil.normalizeExistingPath(UrlUtil.getCodeSource(url, "fabric.mod.json"));
49+
+ Path path = LoaderUtil.normalizeExistingPath(UrlUtil.getCodeSource(url, "toki.mod.json")); // Toki
50+
List<Path> paths = pathGroups.get(path);
51+
52+
if (paths == null) {
53+
@@ -63,7 +63,7 @@ public class ClasspathModCandidateFinder implements ModCandidateFinder {
54+
out.accept(paths, false);
55+
}
56+
} catch (UrlConversionException e) {
57+
- Log.debug(LogCategory.DISCOVERY, "Error determining location for fabric.mod.json from %s", url, e);
58+
+ Log.debug(LogCategory.DISCOVERY, "Error determining location for toki.mod.json from %s", url, e); // Toki
59+
}
60+
}
61+
} catch (IOException e) {
62+
diff --git a/src/main/java/net/fabricmc/loader/impl/discovery/ModDiscoverer.java b/src/main/java/net/fabricmc/loader/impl/discovery/ModDiscoverer.java
63+
index 9d786e0a5c4deef81efac7432bbbe8fe45a81af1..fe6e7942c5405e2fef92231f934010b2032ded99 100644
64+
--- a/src/main/java/net/fabricmc/loader/impl/discovery/ModDiscoverer.java
65+
+++ b/src/main/java/net/fabricmc/loader/impl/discovery/ModDiscoverer.java
66+
@@ -268,7 +268,7 @@ public final class ModDiscoverer {
67+
}
68+
69+
private ModCandidate computeDir(Path path) throws IOException, ParseMetadataException {
70+
- Path modJson = path.resolve("fabric.mod.json");
71+
+ Path modJson = path.resolve("toki.mod.json");
72+
if (!Files.exists(modJson)) return null;
73+
74+
LoaderModMetadata metadata;
75+
@@ -282,7 +282,7 @@ public final class ModDiscoverer {
76+
77+
private ModCandidate computeJarFile(Path path) throws IOException, ParseMetadataException {
78+
try (ZipFile zf = new ZipFile(path.toFile())) {
79+
- ZipEntry entry = zf.getEntry("fabric.mod.json");
80+
+ ZipEntry entry = zf.getEntry("toki.mod.json"); // Toki
81+
if (entry == null) return null;
82+
83+
LoaderModMetadata metadata;
84+
@@ -355,7 +355,7 @@ public final class ModDiscoverer {
85+
86+
try (ZipInputStream zis = new ZipInputStream(is)) {
87+
while ((entry = zis.getNextEntry()) != null) {
88+
- if (entry.getName().equals("fabric.mod.json")) {
89+
+ if (entry.getName().equals("toki.mod.json")) { // Toki
90+
metadata = parseMetadata(zis, localPath);
91+
break;
92+
}
93+
diff --git a/src/main/java/net/fabricmc/loader/impl/metadata/ModMetadataParser.java b/src/main/java/net/fabricmc/loader/impl/metadata/ModMetadataParser.java
94+
index 875c2a104207f6063f7a3abfa0b55b9ce765e3d5..04f88da151ffe280319d568bc907b1f958b82f0a 100644
95+
--- a/src/main/java/net/fabricmc/loader/impl/metadata/ModMetadataParser.java
96+
+++ b/src/main/java/net/fabricmc/loader/impl/metadata/ModMetadataParser.java
97+
@@ -80,7 +80,7 @@ public final class ModMetadataParser {
98+
reader.setRewindEnabled(true);
99+
100+
if (reader.peek() != JsonToken.BEGIN_OBJECT) {
101+
- throw new ParseMetadataException("Root of \"fabric.mod.json\" must be an object", reader);
102+
+ throw new ParseMetadataException("Root of \"toki.mod.json\" must be an object", reader); // Toki
103+
}
104+
105+
reader.beginObject();
106+
@@ -128,7 +128,7 @@ public final class ModMetadataParser {
107+
reader.endObject();
108+
109+
if (isDevelopment) {
110+
- Log.warn(LogCategory.METADATA, "\"fabric.mod.json\" from mod %s did not have \"schemaVersion\" as first field.", ret.getId());
111+
+ Log.warn(LogCategory.METADATA, "\"toki.mod.json\" from mod %s did not have \"schemaVersion\" as first field.", ret.getId()); // Toki
112+
}
113+
114+
return ret;
115+
diff --git a/src/main/java/net/fabricmc/loader/impl/metadata/ParseMetadataException.java b/src/main/java/net/fabricmc/loader/impl/metadata/ParseMetadataException.java
116+
index e4d114abb1fbae64b24327326d26ace4b464b88f..32bdf559ffdf4a9ac27fae273797f76c69ef6861 100644
117+
--- a/src/main/java/net/fabricmc/loader/impl/metadata/ParseMetadataException.java
118+
+++ b/src/main/java/net/fabricmc/loader/impl/metadata/ParseMetadataException.java
119+
@@ -48,7 +48,7 @@ public class ParseMetadataException extends Exception {
120+
121+
@Override
122+
public String getMessage() {
123+
- String ret = "Error reading fabric.mod.json file for mod at ";
124+
+ String ret = "Error reading toki.mod.json file for mod at "; // Toki
125+
126+
if (modPaths == null) {
127+
ret += "unknown location";
128+
diff --git a/src/main/java/net/fabricmc/loader/impl/metadata/V1ModMetadata.java b/src/main/java/net/fabricmc/loader/impl/metadata/V1ModMetadata.java
129+
index d369064dbf8ddf6bdf99a0fb2f6d75dcf234a608..dc5fe1feb432f433987c6b84d477c65af1428e8e 100644
130+
--- a/src/main/java/net/fabricmc/loader/impl/metadata/V1ModMetadata.java
131+
+++ b/src/main/java/net/fabricmc/loader/impl/metadata/V1ModMetadata.java
132+
@@ -276,7 +276,7 @@ final class V1ModMetadata extends AbstractModMetadata implements LoaderModMetada
133+
@Override
134+
public void emitFormatWarnings() {
135+
if (hasRequires) {
136+
- Log.warn(LogCategory.METADATA, "Mod `%s` (%s) uses 'requires' key in fabric.mod.json, which is not supported - use 'depends'", this.id, this.version);
137+
+ Log.warn(LogCategory.METADATA, "Mod `%s` (%s) uses 'requires' key in toki.mod.json, which is not supported - use 'depends'", this.id, this.version); // Toki
138+
}
139+
}
140+
141+
diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/toki.mod.json
142+
similarity index 100%
143+
rename from src/main/resources/fabric.mod.json
144+
rename to src/main/resources/toki.mod.json
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Denery <dorofeevij@gmail.com>
3+
Date: Mon, 1 May 2023 13:12:02 +0300
4+
Subject: [PATCH] Toki branding
5+
6+
7+
diff --git a/java17/src/main/java/net/fabricmc/installer/LoaderVersion.java b/java17/src/main/java/net/fabricmc/installer/LoaderVersion.java
8+
index b7b85708496ab6c72966f423eb74b8046917620d..8b0a9736972ffc3f43dd4704c67b84f7ec37dd83 100644
9+
--- a/java17/src/main/java/net/fabricmc/installer/LoaderVersion.java
10+
+++ b/java17/src/main/java/net/fabricmc/installer/LoaderVersion.java
11+
@@ -38,8 +38,8 @@ public final class LoaderVersion {
12+
13+
public LoaderVersion(Path path) throws IOException {
14+
try (ZipFile zf = new ZipFile(path.toFile())) {
15+
- ZipEntry entry = zf.getEntry("fabric.mod.json");
16+
- if (entry == null) throw new FileNotFoundException("fabric.mod.json");
17+
+ ZipEntry entry = zf.getEntry("toki.mod.json"); // Toki
18+
+ if (entry == null) throw new FileNotFoundException("toki.mod.json"); // Toki
19+
20+
String modJsonContent;
21+

settings.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ include(
1616
"paper-api",
1717
"paper-server",
1818
"paper-mojang-api",
19-
"test-plugin",
2019
"fabric-loader",
2120
"fabric-loader:minecraft",
2221
"fabric-loader:junit",
2322
"paperclip",
2423
"paperclip:java6",
25-
"paperclip:java17",
26-
"test-toki-mod"
24+
"paperclip:java17"
2725
)
2826

27+
/*
2928
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
3029
include("fabric-loader:minecraft:minecraft-test")
3130
} else {
3231
println("Minecraft test sub project requires java 17 or higher!")
3332
}
33+
*/

test-plugin/build.gradle.kts

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

test-plugin/src/main/java/net/tetratau/testplugin/TestPlugin.java

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

test-plugin/src/main/resources/plugin.toml

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

test-toki-mod/build.gradle.kts

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

test-toki-mod/src/main/java/net/tetratau/toki/TokiMod.java

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

test-toki-mod/src/main/java/net/tetratau/toki/mixin/BootstrapMixin.java

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

0 commit comments

Comments
 (0)