Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block interactions are not executed when sneaking #5193

Open
ColinHDev opened this issue Jul 26, 2022 · 6 comments
Open

Block interactions are not executed when sneaking #5193

ColinHDev opened this issue Jul 26, 2022 · 6 comments
Labels
Category: Gameplay Related to Minecraft gameplay experience Status: Debugged Cause of the bug has been found, but not fixed

Comments

@ColinHDev
Copy link
Contributor

Issue description

  • Expected result: In Vanilla, it does not matter if you sneak while interacting with bone meal on a grass block. Flowers, grass, etc. should grow either way.
  • Actual result: All block interactions are cancelled when the player is sneaking due to this. Therefore, you can't use bone meal when sneaking.

Steps to reproduce the issue

  1. Take some bone meal
  2. Sneak
  3. Interact with grass blocks

OS and versions

  • PocketMine-MP: 4.6.0 and 5.0.0
    Tested on both test.pmmp.io:19133 and test.pmmp.io:19132
  • PHP: 8.0.19
  • Using JIT: no
  • Server OS: linux
  • Game version: Win10

Plugins

---

Crashdump, backtrace or other files

---

@dktapps
Copy link
Member

dktapps commented Jul 26, 2022

This sounds like a bug in vanilla to me.

@ColinHDev
Copy link
Contributor Author

That's what I also thought at first. But it's the same in Java Edition. And it's not limited to bone meal. It's the same case with "shovels and pathways" and "compass and lodestones" (although that's not implemented in PM anyway).

I've dug a bit around this in Java Edition's source (I'm not that experienced with IDA and more familiar with Java). Both Java and PM have use methods in item and block classes and those of the block classes are only called if the player is not sneaking. But, unlike PM, they implemented the fertilizer or "shovel" logic not in the GrassBlock class like PM, but in the respective item class, which would explain this behaviour.

@dktapps
Copy link
Member

dktapps commented Aug 12, 2022

If this is correct, I'd also expect paintings, spawn eggs and other items to work while sneaking too.

@dktapps dktapps added Category: Gameplay Related to Minecraft gameplay experience Status: Unconfirmed Bug has not yet been reproduced by a maintainer labels Aug 12, 2022
@ColinHDev
Copy link
Contributor Author

It does. While sneaking, you can also spawn mobs with spawn eggs or place e.g. either paintings or item frames.

@IvanCraft623 IvanCraft623 changed the title Fertilizers not working when sneaking Block interactions are not executed when sneaking Jun 22, 2024
@IvanCraft623
Copy link
Member

Happens thanks to this line.

This is also causing players to be unable to interact with copper doors/trapdoors to wax/unwax them or remove oxidation (They need to be sneaking to do this)

Change the line to

if((!$player->isSneaking() || $item->isNull() || !$item instanceof ItemBlock) && $blockClicked->onInteract($item, $face, $clickVector, $player, $returnedItems)){

seems to fixe it.

@IvanCraft623 IvanCraft623 added Status: Debugged Cause of the bug has been found, but not fixed and removed Status: Unconfirmed Bug has not yet been reproduced by a maintainer labels Jun 22, 2024
@dktapps
Copy link
Member

dktapps commented Nov 29, 2024

In minor-next it should be enough to change this:

$ev->setUseItem(false);

Fixing the other stuff like shovels on grass will be a bit more awkward though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Gameplay Related to Minecraft gameplay experience Status: Debugged Cause of the bug has been found, but not fixed
Projects
None yet
Development

No branches or pull requests

3 participants