From 4e0a9840d39848d79fe8865778d1f4b8a256e823 Mon Sep 17 00:00:00 2001 From: MrFrydae Date: Sun, 30 Jun 2024 10:23:59 -0400 Subject: [PATCH] Disable EMC Nameplate changes for singleplayer --- .gitignore | 14 ++++++++++++++ .../waffle/emcutils/mixin/PlayerEntityMixin.java | 3 +++ gradle.properties | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b9eb4d4..e1fa6dc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,18 +1,32 @@ +# Gradle files .gradle/ build/ out/ classes/ *.launch +gradle/wrapper +gradlew +gradlew.bat + +# IntelliJ IDEA files .idea/ *.iml *.ipr *.iws .settings/ + +# VS Code files .vscode/ + +# Eclipse files bin/ .classpath .project + +# MacOS files *.DS_Store + +# Java files run/ generated/ .architectury-transformer/ diff --git a/common/src/main/java/coffee/waffle/emcutils/mixin/PlayerEntityMixin.java b/common/src/main/java/coffee/waffle/emcutils/mixin/PlayerEntityMixin.java index 0a0e26b..0298fc7 100644 --- a/common/src/main/java/coffee/waffle/emcutils/mixin/PlayerEntityMixin.java +++ b/common/src/main/java/coffee/waffle/emcutils/mixin/PlayerEntityMixin.java @@ -2,6 +2,7 @@ import coffee.waffle.emcutils.Caches; import coffee.waffle.emcutils.Util; +import net.minecraft.client.MinecraftClient; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.text.Text; import org.spongepowered.asm.mixin.Mixin; @@ -15,6 +16,8 @@ abstract class PlayerEntityMixin { @Inject(method = "getDisplayName", at = @At("HEAD"), cancellable = true) private void emcutils$getDisplayName(CallbackInfoReturnable cir) { + if (MinecraftClient.getInstance().isInSingleplayer()) return; // Don't run anything for singleplayer + if (Util.isOnEMC) { PlayerEntity e = ((PlayerEntity) (Object) this); diff --git a/gradle.properties b/gradle.properties index d541383..27363ec 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,4 +2,4 @@ org.gradle.jvmargs=-Xmx4G org.gradle.parallel=true -mod_version=9.0.0 +mod_version=9.0.1