Skip to content

Commit 4d3a4bf

Browse files
committed
Block player input detects about menus
1 parent debcca0 commit 4d3a4bf

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/client/java/minicraft/entity/mob/Player.java

+11-6
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ public void tick() {
517517
attack();
518518
}
519519

520-
if (input.inputPressed("menu") && activeItem != null) {
520+
if ((input.inputPressed("menu") || input.inputPressed("craft")) && activeItem != null) {
521521
int returned = inventory.add(0, activeItem);
522522
if (activeItem instanceof StackableItem) {
523523
StackableItem stackable = (StackableItem) activeItem;
@@ -536,14 +536,19 @@ public void tick() {
536536
}
537537

538538
if (Game.getDisplay() == null) {
539-
if (input.inputPressed("menu") && !use()) // !use() = no furniture in front of the player; this prevents player inventory from opening (will open furniture inventory instead)
539+
if (input.inputPressed("menu") && !use()) { // !use() = no furniture in front of the player; this prevents player inventory from opening (will open furniture inventory instead)
540540
Game.setDisplay(new PlayerInvDisplay(this));
541-
if (input.inputPressed("pause"))
541+
return;
542+
} else if (input.inputPressed("pause")) {
542543
Game.setDisplay(new PauseDisplay());
543-
if (input.inputPressed("craft") && !use())
544+
return;
545+
} else if (input.inputPressed("craft") && !use()) {
544546
Game.setDisplay(new CraftingDisplay(Recipes.craftRecipes, "minicraft.displays.crafting", this, true));
545-
546-
if (input.inputDown("info")) Game.setDisplay(new InfoDisplay());
547+
return;
548+
} else if (input.inputDown("info")) {
549+
Game.setDisplay(new InfoDisplay());
550+
return;
551+
}
547552

548553
if (input.inputDown("quicksave") && !Updater.saving) {
549554
Updater.saving = true;

0 commit comments

Comments
 (0)