auto_pickup.sc Stopping At 2 Items Per Stack
Opened this issue · 4 comments
Describe the bug
When using auto_pickup.sc multiple stacks of 2 will be created and if there are no more empty slots will drop on the ground.
To Reproduce
Steps to reproduce the behavior:
- Use /script download survival/auto_pickup.sc to download and enable the script
- Have 3 blocks of the same type in world to break
- Fill all inventory slots except 1 with something other than the block you're going to break
- Break the 3 blocks
- The first 2 will be automatically moved to your inventory in that empty slot, the third will drop as if there is no more room
Expected behavior
Items should continue filling the inventory until stacks are full. I have tested this with multiple items, such as wooden planks and redstone dust.
Environment
- Carpet version: 1.4.141+v240429
- Minecraft version: 1.20.6
Additional context
I noticed this first in a modded server, then tested with a fresh install of 1.20.6 and only carpet-fabric installed.
I just started using Carpet mod yesterday, so I'm not familiar with the syntax for scarpet, but I feel like the if ( current:1+count <= stack_limit(item_name) && current:2 == item_nbt,
line may be the problem
You are correct about the problematic line. I solved this on discord already, but unfortunately we haven't decided on how to update scripts to keep them backwards compatible.
Update line 47 to
if ( current:1+count <= stack_limit(item_name) && current:2:'components' == item_nbt:'components',
https://discord.com/channels/882822986795716608/894811484062892095/1246920279020671089
Thank you for the fix! I'll join the discord to check for some more fixes on other scripts then.
I updated the script with that fix, and it works fine now in 1.21. Thanks for the update.