Skip to content

Commit 1bcc85b

Browse files
committed
Add support for 1.20.3/4
Closes #15
1 parent e44eb29 commit 1bcc85b

12 files changed

+74
-35
lines changed

build.gradle.kts

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import java.io.Reader
66
import java.io.StringReader
77

88
plugins {
9-
id("fabric-loom") version "1.0-SNAPSHOT"
10-
id("io.github.juuxel.loom-quiltflower") version "1.8.0"
9+
id("fabric-loom") version "1.4-SNAPSHOT"
1110
`maven-publish`
1211
}
1312

gradle.properties

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ org.gradle.jvmargs=-Xmx1G
33

44
# Fabric Properties
55
# check these on https://fabricmc.net/versions.html
6-
minecraft_version=1.19.4
7-
yarn_mappings=1.19.4+build.1
8-
loader_version=0.14.17
6+
minecraft_version=1.20.4
7+
yarn_mappings=1.20.4+build.1
8+
loader_version=0.15.1
99

1010
# Forge
11-
forge_version=1.19.4-45.0.18
11+
forge_version=1.20.4-49.0.3
1212

1313
# Mod Properties
14-
mod_version=1.7.0
14+
mod_version=1.8.0
1515
maven_group=de.kb1000
1616
archives_base_name=no-telemetry

gradle/wrapper/gradle-wrapper.jar

-17.7 KB
Binary file not shown.
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
44
networkTimeout=10000
5+
validateDistributionUrl=true
56
zipStoreBase=GRADLE_USER_HOME
67
zipStorePath=wrapper/dists

gradlew

+17-12
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,8 @@ done
8383
# This is normally unused
8484
# shellcheck disable=SC2034
8585
APP_BASE_NAME=${0##*/}
86-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
87-
88-
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89-
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
86+
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87+
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
9088

9189
# Use the maximum available, or set MAX_FD != -1 to use that value.
9290
MAX_FD=maximum
@@ -133,26 +131,29 @@ location of your Java installation."
133131
fi
134132
else
135133
JAVACMD=java
136-
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
134+
if ! command -v java >/dev/null 2>&1
135+
then
136+
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137137
138138
Please set the JAVA_HOME variable in your environment to match the
139139
location of your Java installation."
140+
fi
140141
fi
141142

142143
# Increase the maximum file descriptors if we can.
143144
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144145
case $MAX_FD in #(
145146
max*)
146147
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
147-
# shellcheck disable=SC3045
148+
# shellcheck disable=SC2039,SC3045
148149
MAX_FD=$( ulimit -H -n ) ||
149150
warn "Could not query maximum file descriptor limit"
150151
esac
151152
case $MAX_FD in #(
152153
'' | soft) :;; #(
153154
*)
154155
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
155-
# shellcheck disable=SC3045
156+
# shellcheck disable=SC2039,SC3045
156157
ulimit -n "$MAX_FD" ||
157158
warn "Could not set maximum file descriptor limit to $MAX_FD"
158159
esac
@@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then
197198
done
198199
fi
199200

200-
# Collect all arguments for the java command;
201-
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
202-
# shell script including quotes and variable substitutions, so put them in
203-
# double quotes to make sure that they get re-expanded; and
204-
# * put everything else in single quotes, so that it's not re-expanded.
201+
202+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204+
205+
# Collect all arguments for the java command:
206+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207+
# and any embedded shellness will be escaped.
208+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209+
# treated as '${Hostname}' itself on the command line.
205210

206211
set -- \
207212
"-Dorg.gradle.appname=$APP_BASE_NAME" \

src/main/java/de/kb1000/notelemetry/NoTelemetryMixinConfigPlugin.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
2525
return switch (mixinClassName) {
2626
case "de.kb1000.notelemetry.mixin.NewYggdrasilUserApiServiceMixin" ->
2727
CommonUtil.classExists("com.mojang.authlib.yggdrasil.response.UserAttributesResponse$Privileges");
28-
case "de.kb1000.notelemetry.mixin.Post1193TelemetryManagerMixin", "de.kb1000.notelemetry.mixin.Pre1193TelemetryManagerMixin" ->
29-
mixinClassName.equals("de.kb1000.notelemetry.mixin.Post1193TelemetryManagerMixin") == CommonUtil.minecraftNewerThan("1.19.3-alpha.22.46.a");
30-
case "de.kb1000.notelemetry.mixin.OptionsScreenMixin" -> CommonUtil.minecraftNewerThan("1.19.3-alpha.22.46.a");
28+
case "de.kb1000.notelemetry.mixin.Pre1193TelemetryManagerMixin" ->
29+
!CommonUtil.minecraftNewerThan("1.19.3-alpha.22.46.a");
30+
case "de.kb1000.notelemetry.mixin.MinecraftClientMixin", "de.kb1000.notelemetry.mixin.OptionsScreenMixin",
31+
"de.kb1000.notelemetry.mixin.Post1193TelemetryManagerMixin" -> CommonUtil.minecraftNewerThan("1.19.3-alpha.22.46.a");
3132
default -> true;
3233
};
3334
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package de.kb1000.notelemetry.mixin;
2+
3+
import org.spongepowered.asm.mixin.Mixin;
4+
import org.spongepowered.asm.mixin.injection.At;
5+
import org.spongepowered.asm.mixin.injection.Inject;
6+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
7+
8+
@Mixin(targets = "net.minecraft.client.MinecraftClient")
9+
public class MinecraftClientMixin {
10+
@Inject(method = "isTelemetryEnabledByApi()Z", at = @At("HEAD"), cancellable = true)
11+
public void isTelemetryEnabledByApi(CallbackInfoReturnable<Boolean> cir) {
12+
cir.setReturnValue(false);
13+
}
14+
}

src/main/java/de/kb1000/notelemetry/mixin/OptionsScreenMixin.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ public class OptionsScreenMixin {
1717
return widget;
1818
}
1919

20-
@Redirect(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/class_7845$class_7939;method_47612(Lnet/minecraft/class_339;)Lnet/minecraft/class_339;", ordinal = 0), slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screen/option/OptionsScreen;TELEMETRY_TEXT:Lnet/minecraft/text/Text;")))
2120
@Group(name = "removeTelemetryButton", min = 1, max = 1)
21+
@Redirect(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/class_7845$class_7939;method_47612(Lnet/minecraft/class_339;)Lnet/minecraft/class_339;", ordinal = 0), slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screen/option/OptionsScreen;TELEMETRY_TEXT:Lnet/minecraft/text/Text;")))
2222
private @Coerce Object removeTelemetryButtonOld(@Coerce Object adder, @Coerce Object widget) {
2323
return widget;
2424
}

src/main/java/de/kb1000/notelemetry/mixin/Post1193TelemetryManagerMixin.java

+12-4
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,23 @@
33
import net.fabricmc.api.EnvType;
44
import net.fabricmc.api.Environment;
55
import org.spongepowered.asm.mixin.Mixin;
6-
import org.spongepowered.asm.mixin.Pseudo;
76
import org.spongepowered.asm.mixin.injection.At;
7+
import org.spongepowered.asm.mixin.injection.Coerce;
8+
import org.spongepowered.asm.mixin.injection.Group;
89
import org.spongepowered.asm.mixin.injection.Redirect;
910

10-
@Mixin(targets = "net.minecraft.client.util.telemetry.TelemetryManager")
11+
@Mixin(targets = "net.minecraft.client.session.telemetry.TelemetryManager")
1112
@Environment(EnvType.CLIENT)
1213
public class Post1193TelemetryManagerMixin {
13-
@Redirect(method = "Lnet/minecraft/client/util/telemetry/TelemetryManager;getSender", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z"), remap = true)
14-
private boolean disableTelemetrySession() {
14+
@Group(name = "disableTelemetrySessionPost1193", min = 1, max = 1)
15+
@Redirect(method = "Lnet/minecraft/client/session/telemetry/TelemetryManager;computeSender", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z"))
16+
private boolean disableTelemetrySessionPre1203() {
1517
return true;
1618
}
19+
20+
@Group(name = "disableTelemetrySessionPost1193", min = 1, max = 1)
21+
@Redirect(method = "Lnet/minecraft/client/session/telemetry/TelemetryManager;computeSender", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;isTelemetryEnabledByApi()Z"))
22+
private boolean disableTelemetrySessionPost1203(@Coerce Object minecraftClient) {
23+
return false;
24+
}
1725
}

src/main/java/de/kb1000/notelemetry/mixin/Pre1193TelemetryManagerMixin.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import org.spongepowered.asm.mixin.injection.Redirect;
99

1010
@Pseudo
11-
@Mixin(targets = "net.minecraft.client.util.telemetry.TelemetryManager")
11+
@Mixin(targets = "net.minecraft.client.session.telemetry.TelemetryManager")
1212
@Environment(EnvType.CLIENT)
1313
public class Pre1193TelemetryManagerMixin {
1414
@Redirect(method = "<init>", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z"))

src/main/resources/no-telemetry-forge-refmap.json

+16-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
22
"mappings": {
3+
"de/kb1000/notelemetry/mixin/MinecraftClientMixin": {
4+
"isTelemetryEnabledByApi()Z": "Lnet/minecraft/client/Minecraft;m_261210_()Z",
5+
"net.minecraft.client.MinecraftClient": "net/minecraft/client/Minecraft"
6+
},
37
"de/kb1000/notelemetry/mixin/Pre1193TelemetryManagerMixin": {
4-
"net.minecraft.client.util.telemetry.TelemetryManager": "net/minecraft/client/ClientTelemetryManager",
8+
"net.minecraft.client.session.telemetry.TelemetryManager": "net/minecraft/client/ClientTelemetryManager",
59
"Lnet/minecraft/SharedConstants;isDevelopment:Z": "Lnet/minecraft/SharedConstants;f_136183_:Z"
610
},
711
"de/kb1000/notelemetry/mixin/OptionsScreenMixin": {
@@ -12,15 +16,20 @@
1216
"net.minecraft.client.gui.screen.option.OptionsScreen": "net/minecraft/client/gui/screens/OptionsScreen"
1317
},
1418
"de/kb1000/notelemetry/mixin/Post1193TelemetryManagerMixin": {
15-
"net.minecraft.client.util.telemetry.TelemetryManager": "net/minecraft/client/telemetry/ClientTelemetryManager",
19+
"net.minecraft.client.session.telemetry.TelemetryManager": "net/minecraft/client/telemetry/ClientTelemetryManager",
1620
"Lnet/minecraft/SharedConstants;isDevelopment:Z": "Lnet/minecraft/SharedConstants;f_136183_:Z",
17-
"Lnet/minecraft/client/util/telemetry/TelemetryManager;getSender": "Lnet/minecraft/client/telemetry/ClientTelemetryManager;m_261052_()Lnet/minecraft/client/telemetry/TelemetryEventSender;"
21+
"Lnet/minecraft/client/session/telemetry/TelemetryManager;computeSender": "Lnet/minecraft/client/telemetry/ClientTelemetryManager;m_261052_()Lnet/minecraft/client/telemetry/TelemetryEventSender;",
22+
"Lnet/minecraft/client/MinecraftClient;isTelemetryEnabledByApi()Z": "Lnet/minecraft/client/Minecraft;m_261210_()Z"
1823
}
1924
},
2025
"data": {
2126
"searge": {
27+
"de/kb1000/notelemetry/mixin/MinecraftClientMixin": {
28+
"isTelemetryEnabledByApi()Z": "Lnet/minecraft/client/Minecraft;m_261210_()Z",
29+
"net.minecraft.client.MinecraftClient": "net/minecraft/client/Minecraft"
30+
},
2231
"de/kb1000/notelemetry/mixin/Pre1193TelemetryManagerMixin": {
23-
"net.minecraft.client.util.telemetry.TelemetryManager": "net/minecraft/client/ClientTelemetryManager",
32+
"net.minecraft.client.session.telemetry.TelemetryManager": "net/minecraft/client/ClientTelemetryManager",
2433
"Lnet/minecraft/SharedConstants;isDevelopment:Z": "Lnet/minecraft/SharedConstants;f_136183_:Z"
2534
},
2635
"de/kb1000/notelemetry/mixin/OptionsScreenMixin": {
@@ -31,9 +40,10 @@
3140
"net.minecraft.client.gui.screen.option.OptionsScreen": "net/minecraft/client/gui/screens/OptionsScreen"
3241
},
3342
"de/kb1000/notelemetry/mixin/Post1193TelemetryManagerMixin": {
34-
"net.minecraft.client.util.telemetry.TelemetryManager": "net/minecraft/client/telemetry/ClientTelemetryManager",
43+
"net.minecraft.client.session.telemetry.TelemetryManager": "net/minecraft/client/telemetry/ClientTelemetryManager",
3544
"Lnet/minecraft/SharedConstants;isDevelopment:Z": "Lnet/minecraft/SharedConstants;f_136183_:Z",
36-
"Lnet/minecraft/client/util/telemetry/TelemetryManager;getSender": "Lnet/minecraft/client/telemetry/ClientTelemetryManager;m_261052_()Lnet/minecraft/client/telemetry/TelemetryEventSender;"
45+
"Lnet/minecraft/client/session/telemetry/TelemetryManager;computeSender": "Lnet/minecraft/client/telemetry/ClientTelemetryManager;m_261052_()Lnet/minecraft/client/telemetry/TelemetryEventSender;",
46+
"Lnet/minecraft/client/MinecraftClient;isTelemetryEnabledByApi()Z": "Lnet/minecraft/client/Minecraft;m_261210_()Z"
3747
}
3848
}
3949
}

src/main/resources/no-telemetry.mixins.json

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"compatibilityLevel": "JAVA_16",
66
"plugin": "de.kb1000.notelemetry.NoTelemetryMixinConfigPlugin",
77
"client": [
8+
"MinecraftClientMixin",
89
"NewYggdrasilUserApiServiceMixin",
910
"OptionsScreenMixin",
1011
"Post1193TelemetryManagerMixin",

0 commit comments

Comments
 (0)