Java Edition:Understacked Items

Understacked_Bedrock.png
For items with counts greater than normally allowed, see Overstacked Items.
This article is about items with a negative stack count. For items with negative durability, see Negative Durability.

Understacked items are items with a count of either zero or negative, below the regular minimum of 1. Most items in the game can be made understacked. Understacked items allow for the creation of overstacked items by underflowing the count below -128, and also allow for item duplication. They are indirectly observable before 14w33a (a 1.8 snapshot), as they did not render their item count if it is below one. In all versions after, their item count is rendered as directly observable red text. All understacked item stacks are deleted when updating to 16w32a (a 1.11 snapshot) or later, meaning 1.10.2 is the last version understacked items can be kept in.

Generic Understacking Methods

Destroyed Container GUI Reference

From Indev 0.31 20100124-2310 to 15w40b (a 1.9 snapshot), the player could obtain understacked items by destroying a container while the container's GUI is opened. The most common method is to use TNT to blow up a chest, but any container block (e.g. furnace, chest minecart, brewing stand, etc.) will work. If multiple accounts are available, a second player could also mine the container block instead of using TNT.

The first method works from Indev 0.31 20100124-2310 to Alpha v1.2.6. By destroying a container while the container GUI is opened, the GUI will remain open once the container has been destroyed. The items inside the container GUI become zero stacks due to how the code to drop the items in a container functions. They can be removed and kept. Once the GUI is closed, any items left inside are deleted.

The second method works from Beta 1.0 to 15w40b. This method is identical to the first, but there is only a 1 tick window where the zero stacks can be collected before the GUI is force closed. Often this method is performed by taking the item in and out of the container rapidly to have a chance at succeeding the 1 tick window. If the player is not on a laggy game, or otherwise has a very predictable ticking speed, this process can be timed instead. Using a macro may be desirable to automate the process. An example macro for games running at 20 TPS (the full speed of the game) is to ignite TNT, wait 4025 milliseconds, and then take the item out of the container.

The normal items dropped from destroying the container can cause held zero stack items to return to positive item counts if they are picked up, so picking up the drops too early should be avoided.

Cursor Drop on Inventory Close

In Alpha v1.0.17_02 (singleplayer only), there is a bug where if the player has a stack in the cursor and then closed the current inventory, the dropped stack would be a zero stack. Opening any inventory will show the original item still in the cursor.

Item Drop

From Beta 1.0 to Beta 1.0_01 (multiplayer only), there is a bug that would occasionally turn any dropped item into a zero stack. These servers have the protocol version number (PVN) of 7, which allows any client from Beta 1.0 to Beta 1.1_01 to connect to them. This occurs randomly whenever the player throws an item. The quickest method to get a zero stack is to look straight down and spam the drop button (Q by default) until a zero stack is picked up.

Furnace State Change

From Beta 1.6 Test Build 3 to Beta 1.6.2, furnaces can be used to obtain a zero stack of any item. When a furnace changes from unlit to lit or vice versa, the items inside will drop out of the furnace as if it were broken. However, inside the furnace the items in every slot will become zero stacks. To use this on an item that cannot be cooked, start cooking an item and then put the desired item in before the furnace's fire runs out.

Nether Portal + Crafting Table

From Beta 1.6 Test Build 3 to 12w04a (a 1.2.1 snapshot) (singleplayer only), an interaction between crafting tables and nether portals could create zero stacks. Construct a nether portal, have a method of pushing the player into the portal without player interaction (a delayed piston or water stream works well), and have a crafting table in reach. Jump into the player pusher of choice, and before reaching the portal, place the items to create zero stacks of into the 3x3 crafting grid. Once the player reaches the portal, the item will drop twice. One will be the full stack that was placed into the crafting table, and the other will be a zero stack.

Crafting Table Close

In Beta 1.8 Pre-release (singleplayer only), exiting the crafting table GUI would drop 2 items for each item placed inside the crafting table. One will be the full stack that was placed into the crafting table, and the other will be a zero stack.

Hopper

In 13w01b (a 1.5 snapshot), hoppers had faulty item entity pickup code.[1] Place a slab on top of a hopper. Throw a full stack of the item to be made into a zero stack on top of the slab. When the hopper is filled, pick up the item entity. The last item stack to be picked up inside the hopper will become a zero stack. Note that if the hopper pushes items out into another container, it could unlink the shadowed items and prevent this method from working.

Broken Furnace Inventory

In 14w34a (a 1.8 snapshot), the furnace did not properly handle items placed within, resulting in either their deletion or transformation to zero stacks.[2] The easiest method to obtain a zero stack can be achieved by placing an item into the top furnace slot, and picking it back up into the player's inventory. Upon closing the furnace GUI, the client will be updated on the stack's actual size.

Item Frame

Barrier.png
Warning: Game Crash 
This method can crash the game. Perform at your own risk.

In 15w49a (a 1.9 snapshot), placing a single item into an item frame leaves a zero stack in the player's hotbar.[3]

15w49a is an potentially dangerous version that will crash when an item stack is depleted, such as if a stack of one block is placed. To put down the item frame in this version without crashing, ensure you have a stack of at least 2.

Downgrading

Downgrade2.png
Warning: Downgrading 
This method requires downgrading which can result in crashes, data loss, or corruption, and requires specific versions. Follow the page instructions carefully.

In 24w09a (a 1.20.5 snapshot), the item format was changed to store the item's count in count instead of Count. Downgrading to 24w07a (a 1.20.5 snapshot) and lower typically will result in all items being deleted as the game defaults to reading a value of 0 for any byte tag that is not stored, so the game sees an item with a count of 0 and deletes it. However, if the player downgrades directly to any version between 1.10.2 and 14w03a (a 1.8 snapshot), the item will instead become a zero stack. Note that downgrading any item whose ID does not exist in the version being downgraded to will still be deleted. All components will also be removed.

Specific Item Methods

Sign Placement Crash

Barrier.png
Warning: Game Crash 
This method can crash the game. Perform at your own risk.

From Infdev 20100607 to Infdev 20100630-1835, if a sign is destroyed from neighbor updates produced from its placement, it will crash the game. This crash will avoid the check to remove the sign item when the placement code is processed, so a sign zero stack will be left in the player's inventory upon reloading. This is easily accomplished by placing two non-opaque blocks (e.g. glass, slabs) next to each other and placing a sign on top of each. Placing the second sign will cause the first to be destroyed, which will update the second sign and destroy it, causing the crash.

Sign above the height limit

Barrier.png
Warning: Game Crash 
This method can crash the game. Perform at your own risk.

From Infdev 20100607 to Alpha v1.0.4, placing a sign over the height limit will cause the game to crash, and upon re-entry you will have 0 signs.

Damaged Equipment Drop

In Beta 1.6 and Beta 1.6.1, dropping any equipment that was damaged creates a zero stack. This item can picked up any number of times and fills up the player's inventory quickly. This method only works on tools, armor, and weapons that have durability.

Feeding Animals

In Beta 1.9 Prerelease 2, when breeding was first added, feeding animals would cause the wheat to decrement past 0 if it was the last item in the stack.

Bow Breaking

From RC1 to 13w18c (a 1.6.1 snapshot) and from 15w31a (a 1.9 snapshot) to 1.10.2, shooting from a bow that has 0 durability can cause the bow to become a zero stack.[4][5]. This method was patched for the main hand in 15w37a (a 1.9 snapshot),[6] but it could still be performed in the offhand until the deletion of understacked items.

Thorns

From 12w50a (a 1.4.6 snapshot) to 1.10.2, armor with Thorns could become a zero stack when a player wearing it is attacked by a mob or player. Thorns armor takes additional damage when it does damage to an attacking mob. If this additional damage breaks the armor, then the armor will become a zero stack. The armor will not become a zero stack if it is at zero durability and then the player is hit since this breaks from regular armor damage instead of thorns armor damage. This method works on any armor available at the time enchanted with thorns.

Book Copying

From 1.8.1-pre4 to 16w02a (a 1.9 snapshot), book copying had a bug that could modify the count of the book being copied.[7] This can result to the creation of zero stacks and book duplication in a variety of ways. The easiest way to achieve a zero stack is to place a single stack of two written books and two book and quills into a crafting grid, which will result in the written books being stacked to zero. One of the written books will be returned to the player's inventory.

Off Hand Entity Usage

From 15w31a to 15w32c (1.9 snapshots), using some 1 stack items on an entity from the player's offhand will make it a zero stack.[8] The following items can be made into zero stacks with this method:

  • Lead on any leadable mob
  • Spawn eggs on their respective mob
  • Wheat seeds, pumpkin seeds, melon seeds, and beetroot seeds feeding chickens
  • Carrots, potatoes, and beetroots feeding pigs
  • Wheat feeding sheep or cows
  • Bones taming wolves
  • Raw porkchop, cooked porkchop, raw beef, steak, raw chicken, cooked chicken, rotten flesh, raw rabbit, cooked rabbit, raw mutton, and cooked mutton feeding wolves
  • Raw fish, raw salmon, clownfish, and pufferfish feeding ocelot
  • Apple, golden apple, enchanted golden apple, sugar, wheat, and hay bale feeding baby horse (player will mount adult horses instead)

Map Trim

From 15w44a to 15w44b (1.9 snapshots), after crafting together a filled map and shears, the shears item will remain in the crafting table but will become a zero stack. The understacked shears will always have at least one damage since the crafting recipe also uses one durability on the shears.

Behavior

Moving Understacked Items

Gear.gif
This section is a work in progress. 
Please help in the creation of this article by expanding or improving it.

Understacked items could be moved freely in the inventory in nearly any way in the past, except for a few specific exceptions. Past 1.4.7[test], attempting to drop a zero stack to the side of the inventory screen will delete it. In some 1.5 versions[test], attempting to drop items from a negative stack or the negative stack itself to the side of the inventory screen will delete any dropped items. Past 1.6[test], trying to drop a single item off of a zero stack with right click into a slot will result in its deletion.

Understacked items cannot be moved with shift-click in any version.

After 15w38b, understacked items can only be moved with the number keys into the player's hotbar. Attempting to move them out of the hotbar, or in any other way, results in their deletion.

Methods of Subtraction

From Indev 0.31 20100128 to 1.6[test], holding an understacked item in the cursor and right-clicking a slot in an inventory will try to place one item into that slot. If the item is inserted into the slot, the understacked item will decrease its count by one. Attempting this past 1.6[test] with a zero stack will result in the item's deletion. Negative stacks will not be deleted, but also will not produce an item and will not decrease in count.

From Indev 0.31 20100128 to 15w42a[test], holding an understacked item in the cursor and right-clicking to the side of the inventory will decrease its count by one and drop one item. From 1.5 to 1.6[test], no items will drop, but the count will still be decremented.

From Beta 1.2 to 1.8.3, dispensers and droppers that attempted to dispense an understacked item would decrease its count by one and dispense one item.[9] This was changed in 1.8.4 so that any dispensor or dropper would delete the understacked item after dispensing it.

Count Underflow and Overstacked Items

If the item count goes below -128, it can underflow and become an overstacked item upon saving to disk, as the in memory integer count is cast to a byte when saving. To determine the exact number that will be produced from the cast of the integer to a byte, divide the absolute value of the integer count by 256, take the remainder, and subtract 128. The result is the stack size after reloading.

Examples:

-192: 192 % 256 = 192, 192 - 128 = 64

-255: 255 % 256 = 255, 255 - 128 = 127

-1337: 1337 % 256 = 57, 57 - 128 = -71

Duplication

In memory, an item's count is stored as an integer, or -2,147,483,648 to 2,147,483,647. Using a method to decrement the item count that also creates an item can create billions of items from a single understacked item. However, because an item's count is cast to a byte upon saving, by carefully controlling at what values the understacked item is saved at, it is possible to infinitely roll the count back to a number in the range of 0 to -128, allowing for infinite duplication.

Understacked Item Entities

Understacked item entities are often created as parts of obtaining understacked items. They can also be created if an understacked item is dropped. If the stack count is negative, picking up the item will pick up a stack with the negative stack count and will set the count of the item entity to zero.

Item entities that have a stack count of zero will not be destroyed upon item pickup, and allow for picking up an infinite amount of zero stacks of their item. If the item is normally stackable, the player cannot have any other stacks of that item in their inventory or else they will be unable to pick the zero stack up, as the game merges the zero stack with the already existing stack every tick. If the item is normally unstackable, a zero stack of the item will be picked up every tick.

Hoppers do not interact with understacked item entities.

Gallery

See Also

References

  1. MC-5998. bugs.mojang.com.
  2. MC-67981. bugs.mojang.com.
  3. MC-93597. bugs.mojang.com.
  4. MC-3960. bugs.mojang.com.
  5. MC-101441. bugs.mojang.com.
  6. MC-87851. bugs.mojang.com.
  7. MC-74392. bugs.mojang.com.
  8. MC-83945. bugs.mojang.com.
  9. MC-78495. bugs.mojang.com. Private issue.