diff options
Diffstat (limited to 'Fabric/src/main/java/com/aizistral/nochatrestrictions/mixins')
| -rw-r--r-- | Fabric/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinMinecraft.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Fabric/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinMinecraft.java b/Fabric/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinMinecraft.java new file mode 100644 index 0000000..86c35d4 --- /dev/null +++ b/Fabric/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinMinecraft.java @@ -0,0 +1,29 @@ +package com.aizistral.nochatrestrictions.mixins; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import com.aizistral.nochatrestrictions.core.NCRCore; +import com.aizistral.nochatrestrictions.core.WrappedSocialInteractionsService; +import com.mojang.authlib.minecraft.SocialInteractionsService; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.main.GameConfig; + +@Mixin(Minecraft.class) +public class MixinMinecraft { + + @Inject(method = { "func_244735_a", "createSocialInteractions" }, at = @At("RETURN"), cancellable = true) + public void onCreateSocialInteractions(YggdrasilAuthenticationService authService, GameConfig gameConfig, + CallbackInfoReturnable<SocialInteractionsService> info) { + SocialInteractionsService returnedService = info.getReturnValue(); + assert returnedService != null; + info.setReturnValue(new WrappedSocialInteractionsService(returnedService)); + + NCRCore.LOGGER.info("Successfully supplanted SocialInteractionsService with a wrapped version."); + } + +} |
