mojira.dev
MC-2912

Creative Mode Hotbar Glitch when using Number Key to exchange items slots

In creative mode, when I place a water bucket (for example) in Hotbar slot, hover above it and press a numberkey to move the it (i.e. to swap it with a dirt block) and then place the water bucket (which is now where the dirt block was and vice versa), it will place dirt. Not water. Placing dirt works as expected. Also works vice versa.

Steps to reproduce:

Example using water bucket
1. Put a water bucket in your hotbar. (i.e. 1st slot)
2. Press any number key (1-9) while hovering over water bucket, except its own slot number. (In this case 1.) Example : Dirt is in 2nd slot so press '2' and swap dirt and water bucket.
3. Place water bucket.
4. Water bucket is seems to be placed and is instantly replaced by dirt.
5. Open inventory to fix problem. If you are holding the water bucket in your hand it will be animated as if it was beeing swapped.

This apparently happens with all blocks. I haven't fully tested yet. It also works with having nothing instead of dirt, then water is placed for a short moment and instantly replaced by air. Also works with potions.


Code analysis by @unknown can be found in this comment

Linked issues

MC-3161 Block disappears when placed in creative Resolved MC-4541 Items in hotbar disapears after rightclicking dispensers Resolved MC-5138 Number Clicking Resolved MC-6543 Item Duplication Resolved MC-6667 Blocks are disappearing after being placed in creative mode when using some inventory-management shortcuts Resolved

Comments 66

Can confirm.

Confirmed also for 1.4.4

When I do it it replaces the current inventory slot with the other one I switched.
EDIT- Doesn't require to to place the block, just right-click (or whatever button you may have it set to.)
EDIT again-I was able to successfully do this in survival, duplicating Emeralds. It took a while, so it may be a phantom glitch.

Found a reliable way to reproduce in 1.5.1 creative singleplayer.

If you are viewing the survival inventory in creative mode (the bottom-right tab, with the chest icon), using number keys in the hotbar works as expected.

In any other tab of the creative inventory, switching items in the hotbar with number keys causes the following behavior: After exiting the creative inventory, selecting the hotbar slot corresponding to the pressed number key and attempting to use that item (by right-clicking) causes whatever item is in that slot to be replaced with what was in there previously (i.e. before switching). The contents of the slots do not matter (edit: see below), for example if "2" is pressed over an empty hotbar slot, right-clicking with slot 2 selected will effectively "delete" the contents.
Edit: Further testing has shown that hotbar slots 3 and 7 (i.e. pressing the number keys "3" and "7") seem to be unaffected by this bug for whatever reason.
Edit: If a number key is pressed corresponding to a slot, and the item in that slot is a potion or splash potion, the behavior becomes unpredictable, appearing to depend on many different factors: The item is duplicated as described above, but the behavior on right-clicking varies in complicated ways. Items other than (splash) potions in the affected slot seem to follow the rules above.

After switching hotbar items in this manner (using number keys, on any tab other than survival inventory), the following actions will cancel the effect and revert to normal behavior:
-Exiting and re-opening the inventory.
-Further manipulation of items in the inventory, by any means, including mouse action or number keys; however the latter may trigger the bug anew in addition to canceling the previous effect, if not done on the survival inventory tab.

Pressing the same number key on the same slot twice (or any even number of times) will behave as expected, doing nothing to the items.

Example:
In the creative mode inventory, place a lever in hotbar slot 1, and redstone in hotbar slot 2. Open the creative mode inventory and go to the "Building Blocks" tab (top left, with bricks icon; any tab other than the survival inventory will work.) Put the cursor on the redstone and press "1". Visually, the items will appear to have been switched; there will now appear to be a lever in slot 2 and redstone in slot 1. Exit the inventory screen.

Trying to place a lever (now in slot 2) works as expected.
Trying to place redstone (in slot 1) causes a lever to appear in the hotbar in place of the redstone (effectively duplicating the lever), and for all intents and purposes the game acts as if you had a lever in that slot.
Attempting to drop the redstone (by default with Q) drops a lever instead.

My theory is that it's caused by whatever code makes items not disappear (i.e. be "copied" instead of "moved") when picked up from the upper part of the creative inventory. For some reason, this code is applying to the hotbar slots on these screens too, but only when number keys are used.

Normally, when you are in one of the category tabs in the creative inventory, pressing a number key on a slot in the upper, scrollable part copies a full stack of whatever was selected into the corresponding hotbar slot.

For some reason, when a number key is used on a hotbar slot, the same code is running, causing the item to be duplicated into the specified slot; however, unlike the above behavior, this copies the quantity of the item too, instead of giving a full stack. The client switches the items on the screen, but on the server side what actually took place was a duplication; this doesn't become visible to the player until the client recieves an inventory update.

As for why slots 3 and 7 are unaffected, I have no clue.

56 more comments

Number keys exchange slots. That's what this bug is about. 1, 2, 3 and 4 are number keys.
I just tested and was able to duplicate/delete so much that 3 of 4 slots contained the same item at the end.

Also cannot reproduce. @unknown, does MC-341 describe your issue?

Ok, apparently this is fixed. I was confused by buggy weirdness.
I can't confirm the fix myself, because apparently this is something I never encountered. But if other people say that this is fixed, it apparently is.

I think this bug has returned in as a deadlier strain, so to speak. Since around 16w40a, I've experienced (albeit rarely) a similar bug in survival. Here's a video I stumbled across of this bug occuring: https://www.youtube.com/watch?v=Oupg58gOiZk (skip to 21:49s). This could possibly be a very detrimental bug, as, as you can see in the video, the block you're trying to place is consumed despite not being placed, and the block that is actually placed is not consumed. If this could be consistently reproduced, this could be a very bad duplication bug. For example, we could "try" to place a block of dirt and instead have a block of diamond placed, with the dirt being taken from the hotbar and the block of diamond not, basically turning dirt to diamond.

@unknown, that looks like MC-5694.

Hinata

LBBO

Agnes Larsson

Confirmed

block, hotbar, numberkey

Minecraft 1.4.2, Minecraft 1.4.4, Snapshot 12w50a, Minecraft 1.4.6, Minecraft 1.4.7, ..., Minecraft 16w33a, Minecraft 16w35a, Minecraft 16w38a, Minecraft 16w39b, Minecraft 16w40a

Minecraft 16w41a

Retrieved