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

@ -74,6 +74,8 @@ public final class Minecraft implements Runnable {
public boolean inventoryScreen;
private int prevFrameTime;
public boolean inGameHasFocus;
public static Minecraft mc;
public Minecraft(int var3, int var4) {
new ModelBiped(0.0F);
@ -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,13 +490,15 @@ public final class Minecraft implements Runnable {
}
if(this.playerController instanceof PlayerControllerCreative) {
if(GL11.getEventKey() == this.options.keyBindLoad.keyCode) {
this.thePlayer.preparePlayerToSpawn();
}
if(this.inventoryScreen) {
if(GL11.getEventKey() == this.options.keyBindLoad.keyCode) {
this.thePlayer.preparePlayerToSpawn();
}
if(GL11.getEventKey() == this.options.keyBindSave.keyCode) {
this.theWorld.setSpawnLocation((int)this.thePlayer.posX, (int)this.thePlayer.posY, (int)this.thePlayer.posZ, this.thePlayer.rotationYaw);
this.thePlayer.preparePlayerToSpawn();
if(GL11.getEventKey() == this.options.keyBindSave.keyCode) {
this.theWorld.setSpawnLocation((int)this.thePlayer.posX, (int)this.thePlayer.posY, (int)this.thePlayer.posZ, this.thePlayer.rotationYaw);
this.thePlayer.preparePlayerToSpawn();
}
}
}
@ -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,24 +13,26 @@ public final class MovementInputFromOptions extends MovementInput {
public final void checkKeyForMovementInput(int var1, boolean var2) {
byte var3 = -1;
if(var1 == this.gameSettings.keyBindForward.keyCode) {
var3 = 0;
}
if(Minecraft.getMinecraft().inventoryScreen) {
if(var1 == this.gameSettings.keyBindForward.keyCode) {
var3 = 0;
}
if(var1 == this.gameSettings.keyBindBack.keyCode) {
var3 = 1;
}
if(var1 == this.gameSettings.keyBindBack.keyCode) {
var3 = 1;
}
if(var1 == this.gameSettings.keyBindLeft.keyCode) {
var3 = 2;
}
if(var1 == this.gameSettings.keyBindLeft.keyCode) {
var3 = 2;
}
if(var1 == this.gameSettings.keyBindRight.keyCode) {
var3 = 3;
}
if(var1 == this.gameSettings.keyBindRight.keyCode) {
var3 = 3;
}
if(var1 == this.gameSettings.keyBindJump.keyCode) {
var3 = 4;
if(var1 == this.gameSettings.keyBindJump.keyCode) {
var3 = 4;
}
}
if(var3 >= 0) {