diff --git a/src/main/java/cloudburst/rejects/mixin/CommandSuggestorMixin.java b/src/main/java/cloudburst/rejects/mixin/CommandSuggestorMixin.java new file mode 100644 index 00000000..c215e86f --- /dev/null +++ b/src/main/java/cloudburst/rejects/mixin/CommandSuggestorMixin.java @@ -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(); + } +} diff --git a/src/main/java/cloudburst/rejects/mixin/meteor/modules/NoRenderAccessor.java b/src/main/java/cloudburst/rejects/mixin/meteor/modules/NoRenderAccessor.java new file mode 100644 index 00000000..496b0527 --- /dev/null +++ b/src/main/java/cloudburst/rejects/mixin/meteor/modules/NoRenderAccessor.java @@ -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(); +} diff --git a/src/main/java/cloudburst/rejects/modules/modifier/NoRenderModifier.java b/src/main/java/cloudburst/rejects/modules/modifier/NoRenderModifier.java new file mode 100644 index 00000000..4a3cbbd2 --- /dev/null +++ b/src/main/java/cloudburst/rejects/modules/modifier/NoRenderModifier.java @@ -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 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(); + } +} diff --git a/src/main/resources/meteor-rejects-meteor.mixins.json b/src/main/resources/meteor-rejects-meteor.mixins.json index 1f150b46..ad661edb 100644 --- a/src/main/resources/meteor-rejects-meteor.mixins.json +++ b/src/main/resources/meteor-rejects-meteor.mixins.json @@ -2,10 +2,12 @@ "required": true, "package": "cloudburst.rejects.mixin.meteor", "compatibilityLevel": "JAVA_16", - "mixins": [ ], + "mixins": [ + "modules.NoRenderAccessor" + ], "client": [ "ConfigTabMixin", "GuiRendererAccessor", "HttpMixin" ] -} \ No newline at end of file +} diff --git a/src/main/resources/meteor-rejects.mixins.json b/src/main/resources/meteor-rejects.mixins.json index 4cf088a1..8e147925 100644 --- a/src/main/resources/meteor-rejects.mixins.json +++ b/src/main/resources/meteor-rejects.mixins.json @@ -3,16 +3,17 @@ "package": "cloudburst.rejects.mixin", "compatibilityLevel": "JAVA_16", "mixins": [ + "CommandSuggestorMixin" ], "client": [ "CustomPayloadS2CPacketMixin", "Deadmau5FeatureRendererMixin", "EntityAccessor", - "StructureVoidBlockMixin", - "TitleScreenMixin", + "GameRendererMixin", "LivingEntityRendererMixin", "MinecraftClientMixin", - "GameRendererMixin", + "StructureVoidBlockMixin", + "TitleScreenMixin", "ToastManagerMixin" ], "injectors": {