Sword blocking mechanics and interactoin locks (#1532)

- Fixed #1532 by makingthe blocking correctly reduces damage; per Java 1.8 mechs.
- Fixed an attack going through while blocking.
- Fixed a bug where you could mine while blocking.
- Swing animation while blocking was overrided; per Java 1.8 mechs.
This commit is contained in:
Chase Cooper 2026-04-19 22:56:54 -04:00
parent 0fc2b5aa5b
commit 4b911b09b7
3 changed files with 31 additions and 5 deletions

View file

@ -116,6 +116,8 @@ void MultiPlayerGameMode::startDestroyBlock(int x, int y, int z, int face)
{
if(!minecraft->player->isAllowedToMine()) return;
if(minecraft->player->isBlocking()) return;
if (localPlayerMode->isAdventureRestricted())
{
if (!minecraft->player->mayDestroyBlockAt(x, y, z))
@ -181,6 +183,13 @@ void MultiPlayerGameMode::stopDestroyBlock()
void MultiPlayerGameMode::continueDestroyBlock(int x, int y, int z, int face)
{
if(!minecraft->player->isAllowedToMine()) return;
if(minecraft->player->isBlocking())
{
isDestroying = false;
destroyProgress = 0;
minecraft->level->destroyTileProgress(minecraft->player->entityId, xDestroyBlock, yDestroyBlock, zDestroyBlock, -1);
return;
}
ensureHasSentCarriedItem();
// connection.send(new PlayerActionPacket(PlayerActionPacket.CONTINUE_DESTROY_BLOCK, x, y, z, face));