pmmp / PocketMine-MP

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

Using pick-block on blocks with rotation specific meta values is impossible #879

Closed inxomnyaa closed 7 years ago

inxomnyaa commented 7 years ago

Issue description

Steps to reproduce the issue

  1. Get the latest phar for PMMP
  2. go into creative mode, place some stairs (several directions)
  3. clear your inventory
  4. use pick-block (default:middle mouse click) on the stairs Expected result: What were you expecting to happen? Getting the stair put into the selected hand slot Actual result: What actually happened? The hold slot is resendt and the stair immediately disappears

This was a thing before and still is after the network branch merge. Happens for other blocks too, but i forgot which one.

I think the reason for this is the $meta = 0 definition on __construct in block classes.

OS and versions

dktapps commented 7 years ago

This is due to an issue with the creative mode anti-cheat. Blocks that do not exist in the creative inventory may not be created from thin air (PocketMine-MP will prevent it).

As seen here:

[08:06:21] [Server thread/DEBUG]: Tried to equip Item Spruce Wood Stairs (134:7)x1 but have Item Air (0:0)x0 in target slot

my client is attempting to equip spruce stairs with meta 7, but spruce stairs with that meta value do not exist in the creative inventory.

This issue relates to #431 .

dktapps commented 7 years ago

I believe the meta issue is a client-sided bug. This works correctly with wood logs but not with stairs.

Normal block-picking cannot be distinguished from regular item-equipment server-side, since regular block-picking merely causes the client to automatically equip an item. As far as the server knows, the client simply attempted to equip an item which doesn't exist in the creative inventory.

For clarity's sake: BlockPickRequestPacket is only sent when the client wants to copy some NBT data from a sign onto their held item.

inxomnyaa commented 7 years ago

I was not talking about any packet in specific ;)