Added NoCommandSuggestions to NoRender

Taken from an unmerged pr

https://github.com/MeteorDevelopment/meteor-client/pull/1347
This commit is contained in:
Stormybytes
2021-08-07 17:26:02 +07:00
parent 4c788e3cb0
commit 25a294c213
5 changed files with 60 additions and 5 deletions

View File

@@ -0,0 +1,17 @@
package cloudburst.rejects.mixin;
import cloudburst.rejects.modules.modifier.NoRenderModifier;
import net.minecraft.client.gui.screen.CommandSuggestor;
import net.minecraft.client.util.math.MatrixStack;
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;
@Mixin(CommandSuggestor.class)
public class CommandSuggestorMixin {
@Inject(method = "render", at = @At(value = "HEAD"), cancellable = true)
public void onRenderCommandSuggestion(MatrixStack matrices, int mouseX, int mouseY, CallbackInfo info) {
if (NoRenderModifier.noCommandSuggestions()) info.cancel();
}
}

View File

@@ -0,0 +1,12 @@
package cloudburst.rejects.mixin.meteor.modules;
import meteordevelopment.meteorclient.settings.SettingGroup;
import meteordevelopment.meteorclient.systems.modules.render.NoRender;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(NoRender.class)
public interface NoRenderAccessor {
@Accessor("sgOverlay")
SettingGroup getSgOverlay();
}

View File

@@ -0,0 +1,23 @@
package cloudburst.rejects.modules.modifier;
import cloudburst.rejects.mixin.meteor.modules.NoRenderAccessor;
import meteordevelopment.meteorclient.settings.BoolSetting;
import meteordevelopment.meteorclient.settings.Setting;
import meteordevelopment.meteorclient.settings.SettingGroup;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.systems.modules.render.NoRender;
public class NoRenderModifier {
static SettingGroup sgOverlay = ((NoRenderAccessor) Modules.get().get(NoRender.class)).getSgOverlay();
public static final Setting<Boolean> noCommandSuggestions = sgOverlay.add(new BoolSetting.Builder()
.name("command-suggestions")
.description("Disables command suggestions in chat.")
.defaultValue(false)
.build()
);
public static boolean noCommandSuggestions() {
return Modules.get().get(NoRender.class).isActive() && noCommandSuggestions.get();
}
}

View File

@@ -2,10 +2,12 @@
"required": true, "required": true,
"package": "cloudburst.rejects.mixin.meteor", "package": "cloudburst.rejects.mixin.meteor",
"compatibilityLevel": "JAVA_16", "compatibilityLevel": "JAVA_16",
"mixins": [ ], "mixins": [
"modules.NoRenderAccessor"
],
"client": [ "client": [
"ConfigTabMixin", "ConfigTabMixin",
"GuiRendererAccessor", "GuiRendererAccessor",
"HttpMixin" "HttpMixin"
] ]
} }

View File

@@ -3,16 +3,17 @@
"package": "cloudburst.rejects.mixin", "package": "cloudburst.rejects.mixin",
"compatibilityLevel": "JAVA_16", "compatibilityLevel": "JAVA_16",
"mixins": [ "mixins": [
"CommandSuggestorMixin"
], ],
"client": [ "client": [
"CustomPayloadS2CPacketMixin", "CustomPayloadS2CPacketMixin",
"Deadmau5FeatureRendererMixin", "Deadmau5FeatureRendererMixin",
"EntityAccessor", "EntityAccessor",
"StructureVoidBlockMixin", "GameRendererMixin",
"TitleScreenMixin",
"LivingEntityRendererMixin", "LivingEntityRendererMixin",
"MinecraftClientMixin", "MinecraftClientMixin",
"GameRendererMixin", "StructureVoidBlockMixin",
"TitleScreenMixin",
"ToastManagerMixin" "ToastManagerMixin"
], ],
"injectors": { "injectors": {