mirror of
https://github.com/Aizistral-Studios/No-Chat-Restrictions.git
synced 2026-05-14 12:53:32 +08:00
Time to snort some caffeine baby 🚀 🚀 🚀
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
package com.aizistral.nochatrestrictions;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
|
||||
public class NoChatRestrictions implements ModInitializer {
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.");
|
||||
}
|
||||
|
||||
}
|
||||
31
Fabric/src/main/resources/fabric.mod.json
Normal file
31
Fabric/src/main/resources/fabric.mod.json
Normal file
@@ -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": "*"
|
||||
}
|
||||
}
|
||||
16
Fabric/src/main/resources/nochatrestrictions.mixins.json
Normal file
16
Fabric/src/main/resources/nochatrestrictions.mixins.json
Normal file
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user