pmmp / PocketMine-MP

A server software for Minecraft: Bedrock Edition in PHP
https://pmmp.io
GNU Lesser General Public License v3.0
3.27k stars 1.54k forks source link

Using a bucket of water in creative mode will generate an empty bucket #5635

Open GH-PM opened 1 year ago

GH-PM commented 1 year ago

Issue description

Steps to reproduce the issue

  1. Grab a bucket of water in creative mode
  2. Use it anywhere
  3. See how for every click you make with the cube, an empty cube is generated in your inventory

OS and versions

Plugins

No plugins

Crashdump, backtrace or other files

dktapps commented 1 year ago

This happens because of the following code: https://github.com/pmmp/PocketMine-MP/blob/b8f6b66e42e830539e5b24d532710d536bbdb8c2/src/player/Player.php#L1510

Unfortunately, the fix isn't as simple as adding a creative mode check, since we need to ensure that modified items (e.g. dyed/undyed shulker boxes) are returned properly here: https://github.com/pmmp/PocketMine-MP/blob/33140482bb66242c6ae6dc6e89fc0b61ea1ed930/src/block/WaterCauldron.php#L163

Ideally we would modify the $item directly for the shulker box case, but we're not currently able to do that, unless I make a BC break.

dktapps commented 1 year ago

This behaviour is quite a pain in the ass.

When used on a cauldron, buckets and bottles are both returned to the player empty. However, using a bucket on the ground doesn't have the same result. This behaviour is confusing and inconsistent, so I'm not sure what the correct behaviour should be.