#include #include #include #include #include // Enable Touch GUI static int32_t Minecraft_isTouchscreen_injection(__attribute__((unused)) Minecraft *minecraft) { return 1; } // IngameBlockSelectionScreen Memory Allocation Override static unsigned char *operator_new_IngameBlockSelectionScreen_injection(__attribute__((unused)) uint32_t size) { return (unsigned char *) ::operator new(sizeof(Touch_IngameBlockSelectionScreen)); } // Improved Button Hover Behavior static int32_t Button_hovered_injection(__attribute__((unused)) Button *button, __attribute__((unused)) Minecraft *minecraft, __attribute__((unused)) int32_t click_x, __attribute__((unused)) int32_t click_y) { // Get Mouse Position int32_t x = Mouse::getX() * Gui::InvGuiScale; int32_t y = Mouse::getY() * Gui::InvGuiScale; // Get Button Position int32_t button_x1 = button->x; int32_t button_y1 = button->y; int32_t button_x2 = button_x1 + button->width; int32_t button_y2 = button_y1 + button->height; // Check return x >= button_x1 && x < button_x2 && y >= button_y1 && y < button_y2; } static void LargeImageButton_render_GuiComponent_drawCenteredString_injection(GuiComponent *component, Font *font, std::string *text, int32_t x, int32_t y, int32_t color) { // Change Color On Hover if (color == 0xe0e0e0 && Button_hovered_injection((Button *) component, nullptr, 0, 0)) { color = 0xffffa0; } // Call Original Method component->drawCenteredString(font, text, x, y, color); } // Create Button int touch_gui = 0; template static Button *create_button(int id, std::string text) { T *button = new T; ALLOC_CHECK(button); button->constructor(id, &text); return (Button *) button; } Button *touch_create_button(int id, std::string text) { if (touch_gui) { return create_button(id, text); } else { return create_button