mirror of
https://github.com/Aizistral-Studios/No-Chat-Restrictions.git
synced 2026-02-04 05:38:24 +00:00
Add mixins to NeoForge project
This commit is contained in:
@@ -33,6 +33,7 @@ runs {
|
|||||||
// "REGISTRIES": For firing of registry events.
|
// "REGISTRIES": For firing of registry events.
|
||||||
// "REGISTRYDUMP": For getting the contents of all registries.
|
// "REGISTRYDUMP": For getting the contents of all registries.
|
||||||
systemProperty 'forge.logging.markers', 'REGISTRIES'
|
systemProperty 'forge.logging.markers', 'REGISTRIES'
|
||||||
|
systemProperty 'mixin.env.disableRefMap', 'true'
|
||||||
|
|
||||||
// Recommended logging level for the console
|
// Recommended logging level for the console
|
||||||
// You can set various levels here.
|
// You can set various levels here.
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
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.WrappedUserApiService;
|
||||||
|
import com.mojang.authlib.minecraft.UserApiService;
|
||||||
|
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 = { "m_193585_", "createUserApiService" }, at = @At("RETURN"), cancellable = true)
|
||||||
|
public void onCreateUserApi(YggdrasilAuthenticationService authService, GameConfig gameConfig,
|
||||||
|
CallbackInfoReturnable<UserApiService> info) {
|
||||||
|
UserApiService returnedService = info.getReturnValue();
|
||||||
|
assert returnedService != null;
|
||||||
|
info.setReturnValue(new WrappedUserApiService(returnedService));
|
||||||
|
|
||||||
|
NCRCore.LOGGER.info("Successfully supplanted UserApiService with a wrapped version.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = { "m_294837_", "isNameBanned" }, at = @At("HEAD"), cancellable = true)
|
||||||
|
public void onCheckNameBan(CallbackInfoReturnable<Boolean> info) {
|
||||||
|
info.setReturnValue(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -24,3 +24,6 @@ description="A mod dedicated to removing restrictions around the use of multipla
|
|||||||
versionRange="1.20.2"
|
versionRange="1.20.2"
|
||||||
ordering="NONE"
|
ordering="NONE"
|
||||||
side="BOTH"
|
side="BOTH"
|
||||||
|
|
||||||
|
[[mixins]]
|
||||||
|
config="nochatrestrictions.mixins.json"
|
||||||
|
|||||||
14
NeoForge/src/main/resources/nochatrestrictions.mixins.json
Normal file
14
NeoForge/src/main/resources/nochatrestrictions.mixins.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"required": true,
|
||||||
|
"package": "com.aizistral.nochatrestrictions.mixins",
|
||||||
|
"compatibilityLevel": "JAVA_17",
|
||||||
|
"minVersion": "0.8",
|
||||||
|
"refmap": "nochatrestrictions.refmap.json",
|
||||||
|
"mixins": [],
|
||||||
|
"client": [
|
||||||
|
"MixinMinecraft"
|
||||||
|
],
|
||||||
|
"injectors": {
|
||||||
|
"defaultRequire": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user