diff --git a/src/main/java/net/silentclient/client/mixin/mixins/MinecraftMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/MinecraftMixin.java index 2c11666..c901c6a 100644 --- a/src/main/java/net/silentclient/client/mixin/mixins/MinecraftMixin.java +++ b/src/main/java/net/silentclient/client/mixin/mixins/MinecraftMixin.java @@ -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()) { diff --git a/src/main/java/net/silentclient/client/mods/settings/GeneralMod.java b/src/main/java/net/silentclient/client/mods/settings/GeneralMod.java index aa848fe..d9a9a88 100644 --- a/src/main/java/net/silentclient/client/mods/settings/GeneralMod.java +++ b/src/main/java/net/silentclient/client/mods/settings/GeneralMod.java @@ -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