diff --git a/Minecraft.Client/Common/UI/UIController.cpp b/Minecraft.Client/Common/UI/UIController.cpp index ffcc293..7e7eb79 100644 --- a/Minecraft.Client/Common/UI/UIController.cpp +++ b/Minecraft.Client/Common/UI/UIController.cpp @@ -777,11 +777,11 @@ void UIController::tickInput() } - int wheel = g_KBMInput.GetMouseWheel(); - if (wheel > 0) - handleKeyPress(0, ACTION_MENU_UP); - else if (wheel < 0) - handleKeyPress(0, ACTION_MENU_DOWN); + //int wheel = g_KBMInput.GetMouseWheel(); + //if (wheel > 0) + //handleKeyPress(0, ACTION_MENU_UP); + //else if (wheel < 0) + //handleKeyPress(0, ACTION_MENU_DOWN); } #endif handleInput(); @@ -1049,6 +1049,17 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) if (g_KBMInput.IsMouseButtonReleased(KeyboardMouseInput::MOUSE_LEFT)) { released = true; down = false; } if (!pressed && !released && g_KBMInput.IsMouseButtonDown(KeyboardMouseInput::MOUSE_LEFT)) { down = true; } } + + // scroll + if (!g_KBMInput.IsMouseGrabbed()) + { + int wheel = g_KBMInput.GetMouseWheel(); + if ((key == ACTION_MENU_OTHER_STICK_UP && wheel >0) || (key == ACTION_MENU_OTHER_STICK_DOWN && wheel < 0)) + { + pressed = true; + down = true; + } + } } #endif diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index 5631d90..865f8a9 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -3295,6 +3295,67 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) } } +#ifdef _WINDOWS64 // allows for the player to get the block they are looking at in creative by middle clicking. + if (iPad == 0 && player->abilities.instabuild && g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_MIDDLE) && hitResult != NULL && hitResult->type == HitResult::TILE) + { + //printf("MIDDLE CLICK TEST!!"); + int tileId = level->getTile(hitResult->x, hitResult->y, hitResult->z); + Tile *tile = (tileId > 0 && tileId < Tile::TILE_NUM_COUNT) ? Tile::tiles[tileId] : NULL; + + if (tile != NULL) + { + int cloneId = tile->cloneTileId(level, hitResult->x, hitResult->y, hitResult->z); + + if (cloneId > 0 && cloneId < Item::ITEM_NUM_COUNT && Item::items[cloneId] != NULL) + { + int cloneData = tile->cloneTileData(level, hitResult->x, hitResult->y, hitResult->z); + bool checkData = Item::items[cloneId]->isStackedByData(); + + int quickbarSlot = -1; + + for (int slot = 0; slot < Inventory::getSelectionSize(); ++slot) + { + shared_ptr quickbarItem = player->inventory->items[slot]; + if (quickbarItem == NULL || quickbarItem->id != cloneId) + { + continue; + } + + if (!checkData || quickbarItem->getAuxValue() == cloneData) + { + quickbarSlot = slot; + break; + } + } + + if (quickbarSlot >= 0) + { + player->inventory->selected = quickbarSlot; + } + else + { + player->inventory->grabTexture(cloneId, cloneData, checkData, true); + } + + // should prevent ghost items/blocks + shared_ptr selctedItem = player->inventory->getSelected(); + if (gameMode != NULL && selctedItem != NULL) + { + const int creativeHotbarSlotStart = 36; + gameMode->handleCreativeModeItemAdd(selctedItem, creativeHotbarSlotStart + player->inventory->selected); + } + + if (gameMode != NULL && gameMode->getTutorial() != NULL) + { + gameMode->getTutorial()->onSelectedItemChanged(player->inventory->getSelected()); + } + + player->updateRichPresence(); + } + } + } +#endif + if( gameMode->isInputAllowed(MINECRAFT_ACTION_ACTION) ) { if((player->ullButtonsPressed&(1LL<