-
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added NoCommandSuggestions to NoRender
Taken from an unmerged pr MeteorDevelopment/meteor-client#1347
- Loading branch information
Showing
5 changed files
with
60 additions
and
5 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
src/main/java/cloudburst/rejects/mixin/CommandSuggestorMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/cloudburst/rejects/mixin/meteor/modules/NoRenderAccessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/cloudburst/rejects/modules/modifier/NoRenderModifier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters