Permalink
Browse files

remove special behaviour of air with HoldThis packet

SetClickDistance 0 does a better job of this anyways
  • Loading branch information...
UnknownShadow200 committed Feb 10, 2019
1 parent c00eec5 commit 3e2ec577211180689258e66be647a32e205ed718
Showing with 1 addition and 8 deletions.
  1. +1 −1 src/InputHandler.c
  2. +0 −3 src/Inventory.c
  3. +0 −3 src/Inventory.h
  4. +0 −1 src/PacketHandlers.c
@@ -335,7 +335,7 @@ void InputHandler_PickBlocks(bool cooldown, bool left, bool middle, bool right)
InputHandler_ButtonStateChanged(MOUSE_MIDDLE, middle);
}

if (Gui_GetActiveScreen()->HandlesAllInput || !Inventory.CanUse) return;
if (Gui_GetActiveScreen()->HandlesAllInput) return;

if (left) {
/* always play delete animations, even if we aren't picking a block */
@@ -18,7 +18,6 @@ bool Inventory_CheckChangeSelected(void) {

void Inventory_SetSelectedIndex(int index) {
if (!Inventory_CheckChangeSelected()) return;
Inventory.CanUse = true;
Inventory.SelectedIndex = index;
Event_RaiseVoid(&UserEvents.HeldBlockChanged);
}
@@ -33,7 +32,6 @@ void Inventory_SetSelectedBlock(BlockID block) {
int i;
if (!Inventory_CheckChangeSelected()) return;
/* Swap with the current, if the new block is already in the hotbar */
Inventory.CanUse = true;

for (i = 0; i < INVENTORY_BLOCKS_PER_HOTBAR; i++) {
if (Inventory_Get(i) != block) continue;
@@ -105,7 +103,6 @@ void Inventory_Remove(BlockID block) {
static void Inventory_Reset(void) {
Inventory_ApplyDefaultMapping();
Inventory.CanChangeSelected = true;
Inventory.CanUse = true;
}

static void Inventory_Init(void) {
@@ -25,9 +25,6 @@ CC_VAR extern struct _InventoryData {
int Offset;
/* Whether the user is allowed to change selected/held block. */
bool CanChangeSelected;
/* Whether the user can use the inventory at all. */
/* NOTE: false prevents the user from deleting/picking/placing blocks. */
bool CanUse;
} Inventory;

/* Gets the block at the nth index in the current hotbar. */
@@ -949,7 +949,6 @@ static void CPE_HoldThis(uint8_t* data) {
Inventory.CanChangeSelected = true;
Inventory_SetSelectedBlock(block);
Inventory.CanChangeSelected = canChange;
Inventory.CanUse = block != BLOCK_AIR;
}

static void CPE_SetTextHotkey(uint8_t* data) {

0 comments on commit 3e2ec57

Please sign in to comment.