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.minecraftforge.fml.common.Mod;
|
||||
|
||||
@Mod("nochatrestrictions")
|
||||
public class NoChatRestrictions {
|
||||
|
||||
public NoChatRestrictions() {
|
||||
// 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,31 @@
|
||||
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.CallbackInfo;
|
||||
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 com.mojang.authlib.yggdrasil.YggdrasilSocialInteractionsService;
|
||||
|
||||
import net.minecraft.client.GameConfiguration;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
@Mixin(Minecraft.class)
|
||||
public class MixinMinecraft {
|
||||
|
||||
@Inject(method = { "func_244735_a", "createSocialInteractions" }, at = @At("RETURN"), cancellable = true)
|
||||
public void onCreateSocialInteractions(YggdrasilAuthenticationService authService, GameConfiguration 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.");
|
||||
}
|
||||
|
||||
}
|
||||
25
Forge/src/main/resources/META-INF/mods.toml
Normal file
25
Forge/src/main/resources/META-INF/mods.toml
Normal file
@@ -0,0 +1,25 @@
|
||||
modLoader="javafml"
|
||||
loaderVersion="[35,)"
|
||||
license="WTFPL"
|
||||
issueTrackerURL="https://github.com/Aizistral-Studios/No-Chat-Restrictions/issues"
|
||||
|
||||
[[mods]]
|
||||
modId="nochatrestrictions"
|
||||
version="${file.jarVersion}"
|
||||
displayName="No Chat Restrictions"
|
||||
displayURL="https://modrinth.com/project/no-chat-restrictions"
|
||||
authors="Aizistral"
|
||||
description="A mod dedicated to removing restrictions around the use of multiplayer features, including in-game chat."
|
||||
|
||||
[[dependencies.nochatrestrictions]]
|
||||
modId="forge"
|
||||
mandatory=true
|
||||
versionRange="[35,)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
[[dependencies.nochatrestrictions]]
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
versionRange="[1.16.4,1.17)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
14
Forge/src/main/resources/nochatrestrictions.mixins.json
Normal file
14
Forge/src/main/resources/nochatrestrictions.mixins.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "com.aizistral.nochatrestrictions.mixins",
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"minVersion": "0.8",
|
||||
"refmap": "nochatrestrictions.refmap.json",
|
||||
"mixins": [],
|
||||
"client": [
|
||||
"MixinMinecraft"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
6
Forge/src/main/resources/pack.mcmeta
Normal file
6
Forge/src/main/resources/pack.mcmeta
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"pack": {
|
||||
"description": "NoChatRestrictions Resources",
|
||||
"pack_format": 6
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user