From 0465b164417e911ac86d6ca7fb60930f066c0f24 Mon Sep 17 00:00:00 2001 From: Aizistral Date: Wed, 18 Nov 2026 20:21:08 +0100 Subject: Wrap user properties on read --- .../aizistral/nochatrestrictions/mixins/MixinMinecraft.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Forge/src/main/java/com') diff --git a/Forge/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinMinecraft.java b/Forge/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinMinecraft.java index e470410..c74f907 100644 --- a/Forge/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinMinecraft.java +++ b/Forge/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinMinecraft.java @@ -7,7 +7,9 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import com.aizistral.nochatrestrictions.core.NCRCore; import com.aizistral.nochatrestrictions.core.WrappedUserApiService; +import com.aizistral.nochatrestrictions.core.WrappedUserProperties; import com.mojang.authlib.minecraft.UserApiService; +import com.mojang.authlib.minecraft.UserApiService.UserProperties; import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; import net.minecraft.client.Minecraft; @@ -26,6 +28,15 @@ public class MixinMinecraft { NCRCore.LOGGER.info("Successfully supplanted UserApiService with a wrapped version."); } + @Inject(method = { "m_307512_", "userProperties" }, at = @At("RETURN"), cancellable = true) + public void onGetUserProperties(CallbackInfoReturnable info) { + UserProperties properties = info.getReturnValue(); + + if (properties != null) { + info.setReturnValue(WrappedUserProperties.of(properties)); + } + } + @Inject(method = { "m_294837_", "isNameBanned" }, at = @At("HEAD"), cancellable = true) public void onCheckNameBan(CallbackInfoReturnable info) { info.setReturnValue(Boolean.FALSE); -- cgit v1.2.3