(feature) disable scroll wheel

This commit is contained in:
kirillsaint 2024-02-04 00:37:05 +06:00
parent 5782748a31
commit 76fb49d7b4
2 changed files with 10 additions and 0 deletions

View File

@ -12,6 +12,7 @@ import net.minecraft.client.settings.GameSettings;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.client.shader.Framebuffer;
import net.minecraft.client.stream.IStream;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemBlock;
import net.minecraft.util.IChatComponent;
@ -33,6 +34,7 @@ import net.silentclient.client.mixin.ducks.MinecraftExt;
import net.silentclient.client.mods.player.ZoomMod;
import net.silentclient.client.mods.render.AnimationsMod;
import net.silentclient.client.mods.settings.FPSBoostMod;
import net.silentclient.client.mods.settings.GeneralMod;
import org.apache.commons.lang3.SystemUtils;
import org.apache.logging.log4j.Logger;
import org.lwjgl.LWJGLException;
@ -242,6 +244,13 @@ public abstract class MinecraftMixin implements MinecraftExt {
event.call();
}
@Redirect(method = "runTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/InventoryPlayer;changeCurrentItem(I)V"))
public void cancelInventoryScroll(InventoryPlayer instance, int direction) {
if(!Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Disable Scroll Wheel").getValBoolean()) {
instance.changeCurrentItem(direction);
}
}
@Redirect(method = "runTick", at = @At(value = "INVOKE", target = "Lorg/lwjgl/input/Mouse;getEventDWheel()I"))
public int cancelScroll() {
if(!Client.getInstance().getModInstances().getZoomMod().isEnabled() || !Client.getInstance().getModInstances().getZoomMod().isActive() || !Client.getInstance().getSettingsManager().getSettingByClass(ZoomMod.class, "Scroll").getValBoolean()) {

View File

@ -42,6 +42,7 @@ public class GeneralMod extends Mod {
}
this.addBooleanSetting("Menu Animations", this, true);
this.addSliderSetting("Menu Animations Speed", this, 300, 100, 500, true);
this.addBooleanSetting("Disable Scroll Wheel", this, false);
}
@Override