InventoryMove: Fix AAC kick from pitch overflows

This commit is contained in:
ionar2 2020-05-05 15:06:10 -04:00 committed by GitHub
parent 68603c2e6e
commit af83850ec8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.gui.rgui.component.Component;
import me.zeroeightsix.kami.gui.rgui.component.container.use.Frame;
import me.zeroeightsix.kami.module.modules.ClickGUI;
import me.zeroeightsix.kami.module.modules.movement.InventoryMove;
import me.zeroeightsix.kami.util.Wrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
@ -109,6 +110,14 @@ public class DisplayGuiScreen extends GuiScreen {
}
}
@Override
public boolean doesGuiPauseGame() {
if (MODULE_MANAGER.getModule(InventoryMove.class).isEnabled())
return false;
return super.doesGuiPauseGame();
}
public static int getScale() {
int scaleFactor = 0;
int scale = Wrapper.getMinecraft().gameSettings.guiScale;

View File

@ -9,6 +9,7 @@ import org.lwjgl.input.Keyboard
/**
* @author dominikaaaa
* Created by dominikaaaa on 06/04/20
* updated on 04/05/20 by ionar2
* @see me.zeroeightsix.kami.mixin.client.MixinMovementInputFromOptions
*/
@Module.Info(
@ -24,6 +25,7 @@ class InventoryMove : Module() {
override fun onUpdate() {
if (mc.player == null || mc.currentScreen == null || mc.currentScreen is GuiChat) return
// pitch can not exceed 90 degrees nor -90 degrees, otherwise AAC servers will flag this and kick you.
if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) {
mc.player.rotationYaw = mc.player.rotationYaw - speed.value
}
@ -31,10 +33,10 @@ class InventoryMove : Module() {
mc.player.rotationYaw = mc.player.rotationYaw + speed.value
}
if (Keyboard.isKeyDown(Keyboard.KEY_UP)) {
mc.player.rotationPitch = mc.player.rotationPitch - speed.value
mc.player.rotationPitch = (mc.player.rotationPitch - speed.value).coerceAtLeast(-90f)
}
if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) {
mc.player.rotationPitch = mc.player.rotationPitch + speed.value
mc.player.rotationPitch = (mc.player.rotationPitch + speed.value).coerceAtMost(90f)
}
}
}