Skip to content

Commit

Permalink
Initial changes for Forge and NeoForge on 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
kb-1000 committed Dec 19, 2024
1 parent 9a12f5a commit 1f4690a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* defined by the Mozilla Public License, v. 2.0.
*/
plugins {
id("fabric-loom") version "1.4-SNAPSHOT"
id("fabric-loom") version "1.6-SNAPSHOT"
`maven-publish`
}

Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/versions.html
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.1
loader_version=0.15.1
minecraft_version=1.21
yarn_mappings=1.21+build.2
loader_version=0.15.11

# Forge
forge_version=1.20.4-49.0.3
forge_version=1.21-51.0.8

# Mod Properties
mod_version=1.8.0
mod_version=1.9.0
maven_group=de.kb1000
archives_base_name=no-telemetry
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/de/kb1000/notelemetry/CommonUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,18 @@
package de.kb1000.notelemetry;

class CommonUtil {
static boolean isNeoForge() {
return false; // TODO
}

static boolean isForge() {
return classExists("net.minecraftforge.fml.common.Mod") && !classExists("net.fabricmc.loader.api.FabricLoader");
}

static boolean isMojank() {
return isNeoForge() || (isForge() && minecraftNewerThan("1.20.5"));
}

static boolean classExists(String name) {
try {
return NoTelemetryMixinConfigPlugin.class.getClassLoader().loadClass(name) != null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ public void onLoad(String mixinPackage) {

@Override
public String getRefMapperConfig() {
if (CommonUtil.isForge()) {
if (CommonUtil.isMojank() && CommonUtil.minecraftNewerThan("1.21")) {
return "no-telemetry-mojank-refmap.json";
} else if (CommonUtil.isMojank()) {
return "no-telemetry-mojank-1.20-refmap.json";
} else if (CommonUtil.isForge()) {
return "no-telemetry-forge-refmap.json";
}
return "no-telemetry-refmap.json";
Expand Down

0 comments on commit 1f4690a

Please sign in to comment.