Issue Description:
The Copper Golem's item sorting behavior is broken in Minecraft Java Edition 1.21.11. When sorting an item that has no corresponding "whitelist" chests and no empty chests are available, the Golem enters an infinite loop of checking chests.
Steps to Reproduce
Summon a Copper Golem by placing a carved pumpkin on top of a copper block structure.
Place a Copper Chest and fill it with a mix of items, including one specific item for which there are no dedicated "whitelist" chests nearby.
Place multiple chests in the area, all of which are either:
a) Filled with other items (acting as whitelists for those items), or
b) Completely full with no empty slots.
Ensure there are no empty chests available.Observe the Copper Golem as it attempts to sort the unwhitelisted item.
Expected Result:
The Copper Golem should either return the unrecognized item to the Copper Chest or idle in place after a short period of time, as there are no valid destinations for it.
Actual Result:
The Copper Golem picks up the unwhitelisted item and continuously walks from one chest to another, opening each chest to check its contents. It does this in a loop, never placing the item into any chest (because none are valid) and never returning the item to the Copper Chest. This creates an infinite, unresponsive loop.
Additional Notes:
The initial sorting of whitelisted items works correctly. The bug only occurs when an unwhitelisted item is encountered and no empty chests are available.
This occurs in a vanilla environment with no mods, resource packs, or shaders enabled.
Environment
Operating System: Windows 10 Pro for Workstations 22H2 (64-bit) - CPU: Intel 12th Gen i5-12400F (6-core) - RAM: 16GB DDR4 3200MHz (Kingston) - GPU: NVIDIA GeForce GTX 1650 (4GB) - Storage: KINGSTON SNV3S500G (500GB) - Java Version: JDK21.0.8 - No mods, resource packs, or shaders; vanilla 1.21.11 environment
Thank you for helping us improve Minecraft! We saved your files: