-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add compatibility with NeoForge and Mojmap Forge
- Loading branch information
Showing
20 changed files
with
423 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"mappings": { | ||
"de/kb1000/notelemetry/mixin/MinecraftClientMixin": { | ||
"isTelemetryEnabledByApi()Z": "Lnet/minecraft/unmapped/C_ayfeobid;m_oussibsz()Z", | ||
"net.minecraft.client.MinecraftClient": "net/minecraft/unmapped/C_ayfeobid" | ||
}, | ||
"de/kb1000/notelemetry/mixin/OptionsScreenMixin": { | ||
"Lnet/minecraft/client/gui/screen/option/OptionsScreen;TELEMETRY_TEXT:Lnet/minecraft/text/Text;": "Lnet/minecraft/unmapped/C_agyxinfj;f_bfgxwwch:Lnet/minecraft/unmapped/C_rdaqiwdt;", | ||
"Lnet/minecraft/client/gui/widget/GridWidget$Adder;add(Lnet/minecraft/client/gui/widget/Widget;)Lnet/minecraft/client/gui/widget/Widget;": "Lnet/minecraft/unmapped/C_qykucwmu$C_iamgoveg;m_xrbojlyf(Lnet/minecraft/unmapped/C_dpukplka;)Lnet/minecraft/unmapped/C_dpukplka;", | ||
"init": "Lnet/minecraft/unmapped/C_agyxinfj;m_xaqeivsh()V", | ||
"net.minecraft.client.gui.screen.option.OptionsScreen": "net/minecraft/unmapped/C_agyxinfj" | ||
}, | ||
"de/kb1000/notelemetry/mixin/Post1193TelemetryManagerMixin": { | ||
"Lnet/minecraft/SharedConstants;isDevelopment:Z": "Lnet/minecraft/unmapped/C_otltijcb;f_kgpztkbc:Z", | ||
"Lnet/minecraft/client/MinecraftClient;isTelemetryEnabledByApi()Z": "Lnet/minecraft/unmapped/C_ayfeobid;m_oussibsz()Z", | ||
"Lnet/minecraft/client/session/telemetry/TelemetryManager;computeSender": "net/minecraft/unmapped/C_cgkxybww;m_qsixfwvb()Lnet/minecraft/unmapped/C_wzhvxvch;", | ||
"net.minecraft.client.session.telemetry.TelemetryManager": "net/minecraft/unmapped/C_cgkxybww" | ||
}, | ||
"de/kb1000/notelemetry/mixin/Pre1193TelemetryManagerMixin": { | ||
"Lnet/minecraft/SharedConstants;isDevelopment:Z": "Lnet/minecraft/unmapped/C_otltijcb;f_kgpztkbc:Z", | ||
"net.minecraft.client.session.telemetry.TelemetryManager": "net/minecraft/unmapped/C_cgkxybww" | ||
} | ||
}, | ||
"data": { | ||
"named:intermediary": { | ||
"de/kb1000/notelemetry/mixin/MinecraftClientMixin": { | ||
"isTelemetryEnabledByApi()Z": "Lnet/minecraft/unmapped/C_ayfeobid;m_oussibsz()Z", | ||
"net.minecraft.client.MinecraftClient": "net/minecraft/unmapped/C_ayfeobid" | ||
}, | ||
"de/kb1000/notelemetry/mixin/OptionsScreenMixin": { | ||
"Lnet/minecraft/client/gui/screen/option/OptionsScreen;TELEMETRY_TEXT:Lnet/minecraft/text/Text;": "Lnet/minecraft/unmapped/C_agyxinfj;f_bfgxwwch:Lnet/minecraft/unmapped/C_rdaqiwdt;", | ||
"Lnet/minecraft/client/gui/widget/GridWidget$Adder;add(Lnet/minecraft/client/gui/widget/Widget;)Lnet/minecraft/client/gui/widget/Widget;": "Lnet/minecraft/unmapped/C_qykucwmu$C_iamgoveg;m_xrbojlyf(Lnet/minecraft/unmapped/C_dpukplka;)Lnet/minecraft/unmapped/C_dpukplka;", | ||
"init": "Lnet/minecraft/unmapped/C_agyxinfj;m_xaqeivsh()V", | ||
"net.minecraft.client.gui.screen.option.OptionsScreen": "net/minecraft/unmapped/C_agyxinfj" | ||
}, | ||
"de/kb1000/notelemetry/mixin/Post1193TelemetryManagerMixin": { | ||
"Lnet/minecraft/SharedConstants;isDevelopment:Z": "Lnet/minecraft/unmapped/C_otltijcb;f_kgpztkbc:Z", | ||
"Lnet/minecraft/client/MinecraftClient;isTelemetryEnabledByApi()Z": "Lnet/minecraft/unmapped/C_ayfeobid;m_oussibsz()Z", | ||
"Lnet/minecraft/client/session/telemetry/TelemetryManager;computeSender": "net/minecraft/unmapped/C_cgkxybww;m_qsixfwvb()Lnet/minecraft/unmapped/C_wzhvxvch;", | ||
"net.minecraft.client.session.telemetry.TelemetryManager": "net/minecraft/unmapped/C_cgkxybww" | ||
}, | ||
"de/kb1000/notelemetry/mixin/Pre1193TelemetryManagerMixin": { | ||
"Lnet/minecraft/SharedConstants;isDevelopment:Z": "Lnet/minecraft/unmapped/C_otltijcb;f_kgpztkbc:Z", | ||
"net.minecraft.client.session.telemetry.TelemetryManager": "net/minecraft/unmapped/C_cgkxybww" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
* | ||
* This Source Code Form is "Incompatible With Secondary Licenses", as | ||
* defined by the Mozilla Public License, v. 2.0. | ||
*/ | ||
package de.kb1000.notelemetry; | ||
|
||
import net.neoforged.fml.loading.FMLLoader; | ||
import org.apache.maven.artifact.versioning.DefaultArtifactVersion; | ||
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; | ||
import org.apache.maven.artifact.versioning.VersionRange; | ||
|
||
public class NeoForgeUtil { | ||
public static boolean minecraftNewerThan(String version) { | ||
try { | ||
return VersionRange.createFromVersionSpec("[" + version + ",)").containsVersion(new DefaultArtifactVersion(FMLLoader.versionInfo().mcVersion())); | ||
} catch (InvalidVersionSpecificationException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
src/main/java/de/kb1000/notelemetry/NoTelemetryForgeMixinConfigPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
* | ||
* This Source Code Form is "Incompatible With Secondary Licenses", as | ||
* defined by the Mozilla Public License, v. 2.0. | ||
*/ | ||
package de.kb1000.notelemetry; | ||
|
||
import org.objectweb.asm.tree.ClassNode; | ||
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; | ||
import org.spongepowered.asm.mixin.extensibility.IMixinInfo; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
public class NoTelemetryForgeMixinConfigPlugin implements IMixinConfigPlugin { | ||
private boolean isForgeNeo = false; | ||
|
||
@Override | ||
public void onLoad(String mixinPackage) { | ||
isForgeNeo = CommonUtil.isForgeNeo(); | ||
} | ||
|
||
@Override | ||
public String getRefMapperConfig() { | ||
if (isForgeNeo) { | ||
return null; | ||
} | ||
|
||
if (ForgeUtil.minecraftNewerThan("1.21")) { | ||
return "no-telemetry-mojank-refmap.json"; | ||
} else if (ForgeUtil.minecraftNewerThan("1.20.5")) { | ||
return "no-telemetry-mojank-1.20-refmap.json"; | ||
} | ||
|
||
return "no-telemetry-forge-refmap.json"; | ||
} | ||
|
||
@Override | ||
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { | ||
if (isForgeNeo) { | ||
return false; | ||
} | ||
|
||
return switch (mixinClassName) { | ||
// You can't use snapshots on Forge! | ||
case "de.kb1000.notelemetry.mixin.YggdrasilUserApiServiceMixin" -> false; | ||
case "de.kb1000.notelemetry.mixin.Pre1193TelemetryManagerMixin" -> | ||
!ForgeUtil.minecraftNewerThan("1.19.3-alpha.22.46.a"); | ||
case "de.kb1000.notelemetry.mixin.MinecraftClientMixin", "de.kb1000.notelemetry.mixin.OptionsScreenMixin", | ||
"de.kb1000.notelemetry.mixin.Post1193TelemetryManagerMixin" -> ForgeUtil.minecraftNewerThan("1.19.3-alpha.22.46.a"); | ||
default -> true; | ||
}; | ||
} | ||
|
||
@Override | ||
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) { | ||
} | ||
|
||
@Override | ||
public List<String> getMixins() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { | ||
} | ||
|
||
@Override | ||
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { | ||
} | ||
} |
Oops, something went wrong.