diff --git a/src/client/Minecraft.cpp b/src/client/Minecraft.cpp index e8f040d..0cc8e44 100755 --- a/src/client/Minecraft.cpp +++ b/src/client/Minecraft.cpp @@ -879,6 +879,13 @@ void Minecraft::tickInput() { if (!bai.isRemoveContinue()) handleBuildAction(&bai); } +#ifdef __ANDROID__ + bool isTryingToDestroyBlock = (options.useMouseForDigging + ? (Mouse::isButtonDown(MouseAction::ACTION_LEFT) && mouseDiggable) + : Keyboard::isKeyDown(options.keyDestroy.key)) + || (buildHandled && bai.isRemove()); + handleMouseDown(MouseAction::ACTION_LEFT, isTryingToDestroyBlock || (buildHandled && bai.isInteract())); +#endif } else { // Desktop: left mouse = destroy/attack if (Mouse::isButtonDown(MouseAction::ACTION_LEFT)) { @@ -921,6 +928,32 @@ void Minecraft::tickInput() { TIMER_POP(); #endif } +void Minecraft::handleMouseDown(int button, bool down) { +#ifndef STANDALONE_SERVER +#ifndef RPI + if(player->isUsingItem()) { + if(!down && !Keyboard::isKeyDown(options.keyUse.key)) { + gameMode->releaseUsingItem(player); + } + return; + } +#endif + if(player->isSleeping()) { + return; + } + if (button == MouseAction::ACTION_LEFT && missTime > 0) return; + if (down && hitResult.type == TILE && button == MouseAction::ACTION_LEFT && !hitResult.indirectHit) { + int x = hitResult.x; + int y = hitResult.y; + int z = hitResult.z; + gameMode->continueDestroyBlock(x, y, z, hitResult.f); + particleEngine->crack(x, y, z, hitResult.f); + player->swing(); + } else { + gameMode->stopDestroyBlock(); + } +#endif +} void Minecraft::handleBuildAction(BuildActionIntention* action) { #ifndef STANDALONE_SERVER diff --git a/src/client/Minecraft.h b/src/client/Minecraft.h index cd9dcce..1a90b12 100755 --- a/src/client/Minecraft.h +++ b/src/client/Minecraft.h @@ -109,6 +109,8 @@ public: bool isLevelGenerated(); + void handleMouseDown(int button, bool down); + void audioEngineOn(); void audioEngineOff();