diff options
Diffstat (limited to 'Fabric/src/main')
6 files changed, 132 insertions, 0 deletions
diff --git a/Fabric/src/main/java/com/aizistral/nochatrestrictions/NoChatRestrictions.java b/Fabric/src/main/java/com/aizistral/nochatrestrictions/NoChatRestrictions.java new file mode 100644 index 0000000..5924e06 --- /dev/null +++ b/Fabric/src/main/java/com/aizistral/nochatrestrictions/NoChatRestrictions.java @@ -0,0 +1,12 @@ +package com.aizistral.nochatrestrictions; + +import net.fabricmc.api.ModInitializer; + +public class NoChatRestrictions implements ModInitializer { + + @Override + public void onInitialize() { + // NO-OP + } + +}
\ No newline at end of file diff --git a/Fabric/src/main/java/com/aizistral/nochatrestrictions/core/NCRCore.java b/Fabric/src/main/java/com/aizistral/nochatrestrictions/core/NCRCore.java new file mode 100644 index 0000000..40521d3 --- /dev/null +++ b/Fabric/src/main/java/com/aizistral/nochatrestrictions/core/NCRCore.java @@ -0,0 +1,8 @@ +package com.aizistral.nochatrestrictions.core; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class NCRCore { + public static final Logger LOGGER = LogManager.getLogger("NoChatRestrictions"); +} diff --git a/Fabric/src/main/java/com/aizistral/nochatrestrictions/core/WrappedSocialInteractionsService.java b/Fabric/src/main/java/com/aizistral/nochatrestrictions/core/WrappedSocialInteractionsService.java new file mode 100644 index 0000000..c761c9c --- /dev/null +++ b/Fabric/src/main/java/com/aizistral/nochatrestrictions/core/WrappedSocialInteractionsService.java @@ -0,0 +1,36 @@ +package com.aizistral.nochatrestrictions.core; + +import java.util.UUID; +import com.mojang.authlib.minecraft.SocialInteractionsService; + +public class WrappedSocialInteractionsService implements SocialInteractionsService { + private final SocialInteractionsService service; + + public WrappedSocialInteractionsService(SocialInteractionsService service) { + if (service == null) + throw new NullPointerException("'service' argument cannot be null!"); + + this.service = service; + } + + @Override + public boolean serversAllowed() { + return true; + } + + @Override + public boolean realmsAllowed() { + return true; + } + + @Override + public boolean chatAllowed() { + return true; + } + + @Override + public boolean isBlockedPlayer(UUID playerID) { + return this.service.isBlockedPlayer(playerID); + } + +} 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."); + } + +} diff --git a/Fabric/src/main/resources/fabric.mod.json b/Fabric/src/main/resources/fabric.mod.json new file mode 100644 index 0000000..f6bdf17 --- /dev/null +++ b/Fabric/src/main/resources/fabric.mod.json @@ -0,0 +1,31 @@ +{ + "schemaVersion": 1, + "id": "nochatrestrictions", + "version": "${version}", + "name": "No Chat Restrictions", + "description": "A mod dedicated to removing restrictions around the use of multiplayer features, including in-game chat.", + "authors": [ + "Aizistral" + ], + "contact": { + "homepage": "https://modrinth.com/project/no-chat-restrictions", + "sources": "https://github.com/Aizistral-Studios/No-Chat-Restrictions", + "issues": "https://github.com/Aizistral-Studios/No-Chat-Restrictions/issues" + }, + "license": "WTFPL", + "environment": "*", + "entrypoints": { + "main": [ + "com.aizistral.nochatrestrictions.NoChatRestrictions" + ] + }, + "mixins": [ + "nochatrestrictions.mixins.json" + ], + "depends": { + "fabricloader": ">=0.18.4", + "minecraft": "~1.16.4", + "java": ">=8", + "fabric": "*" + } +}
\ No newline at end of file diff --git a/Fabric/src/main/resources/nochatrestrictions.mixins.json b/Fabric/src/main/resources/nochatrestrictions.mixins.json new file mode 100644 index 0000000..18b9f1c --- /dev/null +++ b/Fabric/src/main/resources/nochatrestrictions.mixins.json @@ -0,0 +1,16 @@ +{ + "required": true, + "package": "com.aizistral.nochatrestrictions.mixins", + "compatibilityLevel": "JAVA_8", + "minVersion": "0.8", + "mixins": [], + "client": [ + "MixinMinecraft" + ], + "injectors": { + "defaultRequire": 1 + }, + "overwrites": { + "requireAnnotations": true + } +}
\ No newline at end of file |
