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

Spamming Item Stacks crashes user #5653

Closed HBIDamian closed 1 year ago

HBIDamian commented 1 year ago

Issue description

Steps to reproduce the issue

  1. If you got AutoHotKey, use this script. (You may need to modify the X and Y coordinates depending on your screen resolution and GUI size)
    
    Pause::
    SetTimer, test, 1
    return

test: MouseMove, 560, 500, 0 ; Shift Right Click Send, {Shift Down} MouseClick, Right Send, {Shift Up} MouseMove, 564, 500, 0 ; Shift Right Click Send, {Shift Down} MouseClick, Right Send, {Shift Up} if GetKeyState("End", "P") { SetTimer, test, off return } return

2. For this scenario, I used the items "Iron Nuggets" and "Iron Ingots". 
3. Get a few stacks of Iron Ingots, and the rest fill with Iron Nuggets. See video below
4. In the item Search box, type `Iron ` with the included space after the word, just to make it easier for the AHK to click the items. 
5. Run the hotkey script I provided. Pressing `Pause` will spam the autoclicker (Shift-clicking the stacks) every 1ms. Pressing `End` will end it. You will still need to end the task Using Task Manager afterwards though. 

### OS and versions
<!-- try the `version` command | LATEST IS NOT A VALID VERSION -->
* PocketMine-MP: 4.18.0 (git hash: 0e8b28716a09b4837455f8845b6d2f1113403cb8)
* PHP: 8.0.28
* Using JIT: no (delete as appropriate) <!-- look for the giant yellow warning in the log that says you're using JIT -->
* Server OS: Windows 11
* Game version: Win10

### Plugins
<!--- use the `plugins` command and paste the output below -->

Command output | Plugins (2): DevTools v1.16.1, ConsoleTPSLogger v1.0.0



- If you remove all plugins, does the issue still occur?  - Yes
- If the issue is **not** reproducible without plugins:   - N/A
  -  Have you asked for help on our forums before creating an issue?
  - Can you provide sample, *minimal* reproducing code for the issue? If so, paste it in the bottom section

### Crashdump, backtrace or other files
<!--- Submit crashdumps at https://crash.pmmp.io and paste a link -->
<!--- Use gist or anything else to add other files and add links here -->

Screen Recording: https://streamable.com/zhm205 (GH Upload thinks it's audio for some reason, so I uploaded it to Streamable.)
dktapps commented 1 year ago

From what I can tell, what should be happening is this:

1) Clicking on nuggets moves 9 stacks of items into the crafting grid, generating 9 transfer actions (9, ok) 2) Clicking on iron ingots moves 9 stacks out of the crafting grid + 1 stack into the crafting grid (10, ok) 3) Clicking on nuggets again moves 1 stack out of the crafting grid + 9 stacks into the crafting grid (10, ok)

The limit is 20, so I have no idea why this is happening for you. Perhaps it's only possible to trigger this via auto clicker.

dktapps commented 1 year ago

Fixed by 3ee62d84402ec92706defd4132ce137a59f5242b. This is affected by the way the items are arranged in the inventory, and Bedrock's own internal implementation quirks.