Skip to content

Commit

Permalink
Use toki.mod.json. Version 0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
maestro-denery committed May 1, 2023
1 parent f5855a1 commit fbe871e
Show file tree
Hide file tree
Showing 12 changed files with 169 additions and 88 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mcVersion=1.19

# Toki info
gameVersion=1.19.4
tokiVersion=0.1.1
tokiVersion=0.1.2
spigotMappingsRef=177811e1fa90f674897a302820f3ed84e4d65688
mojangMappingsRef=bc44f6dd84cd2f3ad8c0caad850eaca9e82067e3

Expand Down
144 changes: 144 additions & 0 deletions patches/fabricloader/0003-Toki-branding.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Denery <dorofeevij@gmail.com>
Date: Mon, 1 May 2023 13:11:24 +0300
Subject: [PATCH] Toki branding


diff --git a/build.gradle b/build.gradle
index d3b1e2208dc7c5202ec09b9e43349f91855fabb6..451fc2e0f404cfe84b9621224132a41baf6ed804 100644
--- a/build.gradle
+++ b/build.gradle
@@ -93,7 +93,7 @@ dependencies {
processResources {
inputs.property "version", project.version

- filesMatching("fabric.mod.json") {
+ filesMatching("toki.mod.json") { // Toki
expand "version": project.version
}
}
diff --git a/src/main/java/net/fabricmc/loader/impl/discovery/ArgumentModCandidateFinder.java b/src/main/java/net/fabricmc/loader/impl/discovery/ArgumentModCandidateFinder.java
index 5705d5b3b951e422a11c99bf41544cbf8b653dd6..62ee03c60e77877d484e429263aa0406569db57c 100644
--- a/src/main/java/net/fabricmc/loader/impl/discovery/ArgumentModCandidateFinder.java
+++ b/src/main/java/net/fabricmc/loader/impl/discovery/ArgumentModCandidateFinder.java
@@ -93,7 +93,7 @@ public class ArgumentModCandidateFinder implements ModCandidateFinder {
return;
}

- if (Files.exists(path.resolve("fabric.mod.json"))) { // extracted mod
+ if (Files.exists(path.resolve("toki.mod.json"))) { // extracted mod // Toki
out.accept(path, requiresRemap);
} else { // dir containing jars
try {
diff --git a/src/main/java/net/fabricmc/loader/impl/discovery/ClasspathModCandidateFinder.java b/src/main/java/net/fabricmc/loader/impl/discovery/ClasspathModCandidateFinder.java
index 55caa1b1c94bac01b1d74cf1e77f06426c745c5a..e86e256e60291693f810dd9b77d3e645667d57f4 100644
--- a/src/main/java/net/fabricmc/loader/impl/discovery/ClasspathModCandidateFinder.java
+++ b/src/main/java/net/fabricmc/loader/impl/discovery/ClasspathModCandidateFinder.java
@@ -48,13 +48,13 @@ public class ClasspathModCandidateFinder implements ModCandidateFinder {

// Search for URLs which point to 'fabric.mod.json' entries, to be considered as mods.
try {
- Enumeration<URL> mods = FabricLauncherBase.getLauncher().getTargetClassLoader().getResources("fabric.mod.json");
+ Enumeration<URL> mods = FabricLauncherBase.getLauncher().getTargetClassLoader().getResources("toki.mod.json"); // Toki

while (mods.hasMoreElements()) {
URL url = mods.nextElement();

try {
- Path path = LoaderUtil.normalizeExistingPath(UrlUtil.getCodeSource(url, "fabric.mod.json"));
+ Path path = LoaderUtil.normalizeExistingPath(UrlUtil.getCodeSource(url, "toki.mod.json")); // Toki
List<Path> paths = pathGroups.get(path);

if (paths == null) {
@@ -63,7 +63,7 @@ public class ClasspathModCandidateFinder implements ModCandidateFinder {
out.accept(paths, false);
}
} catch (UrlConversionException e) {
- Log.debug(LogCategory.DISCOVERY, "Error determining location for fabric.mod.json from %s", url, e);
+ Log.debug(LogCategory.DISCOVERY, "Error determining location for toki.mod.json from %s", url, e); // Toki
}
}
} catch (IOException e) {
diff --git a/src/main/java/net/fabricmc/loader/impl/discovery/ModDiscoverer.java b/src/main/java/net/fabricmc/loader/impl/discovery/ModDiscoverer.java
index 9d786e0a5c4deef81efac7432bbbe8fe45a81af1..fe6e7942c5405e2fef92231f934010b2032ded99 100644
--- a/src/main/java/net/fabricmc/loader/impl/discovery/ModDiscoverer.java
+++ b/src/main/java/net/fabricmc/loader/impl/discovery/ModDiscoverer.java
@@ -268,7 +268,7 @@ public final class ModDiscoverer {
}

private ModCandidate computeDir(Path path) throws IOException, ParseMetadataException {
- Path modJson = path.resolve("fabric.mod.json");
+ Path modJson = path.resolve("toki.mod.json");
if (!Files.exists(modJson)) return null;

LoaderModMetadata metadata;
@@ -282,7 +282,7 @@ public final class ModDiscoverer {

private ModCandidate computeJarFile(Path path) throws IOException, ParseMetadataException {
try (ZipFile zf = new ZipFile(path.toFile())) {
- ZipEntry entry = zf.getEntry("fabric.mod.json");
+ ZipEntry entry = zf.getEntry("toki.mod.json"); // Toki
if (entry == null) return null;

LoaderModMetadata metadata;
@@ -355,7 +355,7 @@ public final class ModDiscoverer {

try (ZipInputStream zis = new ZipInputStream(is)) {
while ((entry = zis.getNextEntry()) != null) {
- if (entry.getName().equals("fabric.mod.json")) {
+ if (entry.getName().equals("toki.mod.json")) { // Toki
metadata = parseMetadata(zis, localPath);
break;
}
diff --git a/src/main/java/net/fabricmc/loader/impl/metadata/ModMetadataParser.java b/src/main/java/net/fabricmc/loader/impl/metadata/ModMetadataParser.java
index 875c2a104207f6063f7a3abfa0b55b9ce765e3d5..04f88da151ffe280319d568bc907b1f958b82f0a 100644
--- a/src/main/java/net/fabricmc/loader/impl/metadata/ModMetadataParser.java
+++ b/src/main/java/net/fabricmc/loader/impl/metadata/ModMetadataParser.java
@@ -80,7 +80,7 @@ public final class ModMetadataParser {
reader.setRewindEnabled(true);

if (reader.peek() != JsonToken.BEGIN_OBJECT) {
- throw new ParseMetadataException("Root of \"fabric.mod.json\" must be an object", reader);
+ throw new ParseMetadataException("Root of \"toki.mod.json\" must be an object", reader); // Toki
}

reader.beginObject();
@@ -128,7 +128,7 @@ public final class ModMetadataParser {
reader.endObject();

if (isDevelopment) {
- Log.warn(LogCategory.METADATA, "\"fabric.mod.json\" from mod %s did not have \"schemaVersion\" as first field.", ret.getId());
+ Log.warn(LogCategory.METADATA, "\"toki.mod.json\" from mod %s did not have \"schemaVersion\" as first field.", ret.getId()); // Toki
}

return ret;
diff --git a/src/main/java/net/fabricmc/loader/impl/metadata/ParseMetadataException.java b/src/main/java/net/fabricmc/loader/impl/metadata/ParseMetadataException.java
index e4d114abb1fbae64b24327326d26ace4b464b88f..32bdf559ffdf4a9ac27fae273797f76c69ef6861 100644
--- a/src/main/java/net/fabricmc/loader/impl/metadata/ParseMetadataException.java
+++ b/src/main/java/net/fabricmc/loader/impl/metadata/ParseMetadataException.java
@@ -48,7 +48,7 @@ public class ParseMetadataException extends Exception {

@Override
public String getMessage() {
- String ret = "Error reading fabric.mod.json file for mod at ";
+ String ret = "Error reading toki.mod.json file for mod at "; // Toki

if (modPaths == null) {
ret += "unknown location";
diff --git a/src/main/java/net/fabricmc/loader/impl/metadata/V1ModMetadata.java b/src/main/java/net/fabricmc/loader/impl/metadata/V1ModMetadata.java
index d369064dbf8ddf6bdf99a0fb2f6d75dcf234a608..dc5fe1feb432f433987c6b84d477c65af1428e8e 100644
--- a/src/main/java/net/fabricmc/loader/impl/metadata/V1ModMetadata.java
+++ b/src/main/java/net/fabricmc/loader/impl/metadata/V1ModMetadata.java
@@ -276,7 +276,7 @@ final class V1ModMetadata extends AbstractModMetadata implements LoaderModMetada
@Override
public void emitFormatWarnings() {
if (hasRequires) {
- Log.warn(LogCategory.METADATA, "Mod `%s` (%s) uses 'requires' key in fabric.mod.json, which is not supported - use 'depends'", this.id, this.version);
+ 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
}
}

diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/toki.mod.json
similarity index 100%
rename from src/main/resources/fabric.mod.json
rename to src/main/resources/toki.mod.json
21 changes: 21 additions & 0 deletions patches/paperclip/0003-Toki-branding.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Denery <dorofeevij@gmail.com>
Date: Mon, 1 May 2023 13:12:02 +0300
Subject: [PATCH] Toki branding


diff --git a/java17/src/main/java/net/fabricmc/installer/LoaderVersion.java b/java17/src/main/java/net/fabricmc/installer/LoaderVersion.java
index b7b85708496ab6c72966f423eb74b8046917620d..8b0a9736972ffc3f43dd4704c67b84f7ec37dd83 100644
--- a/java17/src/main/java/net/fabricmc/installer/LoaderVersion.java
+++ b/java17/src/main/java/net/fabricmc/installer/LoaderVersion.java
@@ -38,8 +38,8 @@ public final class LoaderVersion {

public LoaderVersion(Path path) throws IOException {
try (ZipFile zf = new ZipFile(path.toFile())) {
- ZipEntry entry = zf.getEntry("fabric.mod.json");
- if (entry == null) throw new FileNotFoundException("fabric.mod.json");
+ ZipEntry entry = zf.getEntry("toki.mod.json"); // Toki
+ if (entry == null) throw new FileNotFoundException("toki.mod.json"); // Toki

String modJsonContent;

6 changes: 3 additions & 3 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ include(
"paper-api",
"paper-server",
"paper-mojang-api",
"test-plugin",
"fabric-loader",
"fabric-loader:minecraft",
"fabric-loader:junit",
"paperclip",
"paperclip:java6",
"paperclip:java17",
"test-toki-mod"
"paperclip:java17"
)

/*
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
include("fabric-loader:minecraft:minecraft-test")
} else {
println("Minecraft test sub project requires java 17 or higher!")
}
*/
7 changes: 0 additions & 7 deletions test-plugin/build.gradle.kts

This file was deleted.

This file was deleted.

5 changes: 0 additions & 5 deletions test-plugin/src/main/resources/plugin.toml

This file was deleted.

8 changes: 0 additions & 8 deletions test-toki-mod/build.gradle.kts

This file was deleted.

10 changes: 0 additions & 10 deletions test-toki-mod/src/main/java/net/tetratau/toki/TokiMod.java

This file was deleted.

This file was deleted.

22 changes: 0 additions & 22 deletions test-toki-mod/src/main/resources/fabric.mod.json

This file was deleted.

11 changes: 0 additions & 11 deletions test-toki-mod/src/main/resources/toki.test.mixins.server.json

This file was deleted.

0 comments on commit fbe871e

Please sign in to comment.