Fix spamming G (without having changed held block index) causing arm to constantly move down again and again (Thanks Kingoscargames1)

This commit is contained in:
UnknownShadow200 2017-12-23 22:08:43 +11:00
parent 5d8c511472
commit 345438d913
2 changed files with 2 additions and 2 deletions

View File

@ -22,7 +22,7 @@ namespace ClassicalSharp.Mode {
return true;
} else if (key == game.Input.Keys[KeyBind.DropBlock] && !game.ClassicMode) {
Inventory inv = game.Inventory;
if (inv.CanChangeSelected()) {
if (inv.CanChangeSelected() && inv.Selected != Block.Air) {
// Don't assign Selected directly, because we don't want held block
// switching positions if they already have air in their inventory hotbar.
inv[inv.SelectedIndex] = Block.Air;

View File

@ -26,7 +26,7 @@ bool GameMode_HandlesKeyDown(Key key) {
Gui_SetNewScreen(screen);
return true;
} else if (key == KeyBind_Get(KeyBind_DropBlock) && !Game_ClassicMode) {
if (Inventory_CanChangeSelected()) {
if (Inventory_CanChangeSelected() && Inventory_SelectedBlock != BLOCK_AIR) {
/* Don't assign SelectedIndex directly, because we don't want held block
switching positions if they already have air in their inventory hotbar. */
Inventory_Set(Inventory_SelectedIndex, BLOCK_AIR);