The Bug:
The "minecraft:item.bundle.remove_one" sound, otherwise known as the "Item unpacked" sound, plays even when no items are unpacked from bundles.
Steps to Reproduce:
- Give yourself a bundle by using the command provided below.
/give @s minecraft:bundle
- Open your inventory, hold the bundle with your mouse cursor, right-click, and listen closely as you do this.
- Take note as to whether or not the "minecraft:item.bundle.remove_one" sound plays even when no items are unpacked from bundles.
Observed Behavior:
A sound can be heard even when not unpacking items.
Expected Behavior:
A sound would only be heard when items are unpacked.
Code Analysis:
Tentative code analysis by Avoma can be found below.
The following is based on a decompiled version of Minecraft 1.18.1 using MCP-Reborn.
public class BundleItem extends Item { ... public boolean overrideStackedOnOther(ItemStack $is, Slot $s, ClickAction $ca, Player $p) { if ($ca != ClickAction.SECONDARY) { return false; } else { ItemStack itemstack = $s.getItem(); if (itemstack.isEmpty()) { this.playRemoveOneSound($p); ...
If we look at the above class, we can see that if you were to attempt to right-click on an empty inventory slot whilst holding a bundle with your mouse cursor, the playRemoveOneSound() method would be called. This method plays the "minecraft:item.bundle.remove_one" sound and since no checks are carried out to see whether or not the bundle held by the mouse cursor has items inside of it, this results in the sound being played even when items aren't unpacked from bundles.