Fixed walking while Inventory is open.

This commit is contained in:
peytonplayz585 2023-07-27 09:26:05 -07:00
parent 621ac46ae3
commit 8b15690879
2 changed files with 34 additions and 22 deletions

View File

@ -75,6 +75,8 @@ public final class Minecraft implements Runnable {
private int prevFrameTime;
public boolean inGameHasFocus;
public static Minecraft mc;
public Minecraft(int var3, int var4) {
new ModelBiped(0.0F);
this.objectMouseOver = null;
@ -93,6 +95,7 @@ public final class Minecraft implements Runnable {
this.displayWidth = var3;
this.displayHeight = var4;
this.fullscreen = false;
mc = this;
}
public final void setServer(String var1, int var2) {
@ -487,6 +490,7 @@ public final class Minecraft implements Runnable {
}
if(this.playerController instanceof PlayerControllerCreative) {
if(this.inventoryScreen) {
if(GL11.getEventKey() == this.options.keyBindLoad.keyCode) {
this.thePlayer.preparePlayerToSpawn();
}
@ -496,6 +500,7 @@ public final class Minecraft implements Runnable {
this.thePlayer.preparePlayerToSpawn();
}
}
}
if(GL11.getEventKey() == 33 && GL11.isKeyDown(6)) {
this.options.thirdPersonView = !this.options.thirdPersonView;
@ -505,7 +510,7 @@ public final class Minecraft implements Runnable {
this.displayGuiScreen(new GuiInventory(this.thePlayer.inventory));
}
if(GL11.getEventKey() == this.options.keyBindDrop.keyCode) {
if(GL11.getEventKey() == this.options.keyBindDrop.keyCode && this.inventoryScreen) {
this.thePlayer.dropPlayerItemWithRandomChoice(this.thePlayer.inventory.decrStackSize(this.thePlayer.inventory.currentItem, 1), false);
}
}
@ -516,7 +521,7 @@ public final class Minecraft implements Runnable {
}
}
if(GL11.getEventKey() == this.options.keyBindToggleFog.keyCode) {
if(GL11.getEventKey() == this.options.keyBindToggleFog.keyCode && this.inventoryScreen) {
this.options.setOptionValue(4, !GL11.isKeyDown(42) && !GL11.isKeyDown(54) ? 1 : -1);
}
}
@ -646,4 +651,8 @@ public final class Minecraft implements Runnable {
System.gc();
}
public static Minecraft getMinecraft() {
return mc;
}
}

View File

@ -1,6 +1,7 @@
package net.minecraft.client.player;
import net.minecraft.client.GameSettings;
import net.minecraft.client.Minecraft;
public final class MovementInputFromOptions extends MovementInput {
private boolean[] movementKeyStates = new boolean[10];
@ -12,6 +13,7 @@ public final class MovementInputFromOptions extends MovementInput {
public final void checkKeyForMovementInput(int var1, boolean var2) {
byte var3 = -1;
if(Minecraft.getMinecraft().inventoryScreen) {
if(var1 == this.gameSettings.keyBindForward.keyCode) {
var3 = 0;
}
@ -31,6 +33,7 @@ public final class MovementInputFromOptions extends MovementInput {
if(var1 == this.gameSettings.keyBindJump.keyCode) {
var3 = 4;
}
}
if(var3 >= 0) {
this.movementKeyStates[var3] = var2;