I was pulling items from the creative inventory to fill chests for making fireworks. When I filled up the survival inventory and exited out, to store them in the chest, I had an item duplicated in the hot bar.
What I expected to happen was...:
there to be a full survival inventory and nothing in the hot bar when I opened the chest.
What actually happened was...:
I had a full survival inventory with a duplicate of the item in the hot bar.
Steps to Reproduce:
1. Open up creative inventory and put any item(I tried it with quite a few items) in your hot bar.
2. Switch to the survival inventory by clicking the chest icon
3. Move the item(s) from the hot bar to the survival inventory
4. Exit out of your inventory.
5. Open a chest
6. There should be a duplicate of the item, that you placed into the survival inventory, in your hot bar.
Notes:
-Moving a block in any direction after exiting from the inventory before opening a chest breaks the bug.
-Where you place the item in the survival inventory has no affect.
-It seems to only duplicate the first item moved from the hot bar to the survival inventory. For example, move a stack of diamonds then a stack of gunpowder to the inventory and only the diamonds will duplicate.
-The location of the item on the hot bar before moving it to the inventory also has no affect.
-Shift clicking or dragging still produces the same bug.
-I know there are other bugs reported for duplicating but they all required repeatedly pushing buttons.
(Old 1.5) code analysis by @unknown: link
Related issues
is duplicated by
relates to
Attachments
Comments


Cannot reproduce.
Confirmed.
placed new chest
Cleared inventory with /clear
moved grass block to hotbar
moved grass block from hotbar to survival inventory without closing the interface
closed interface
opened chest
-->no grass block in the chestGrass block in the hot bar and in the slot above.
See screenshots

What mods do you have installed ?

Please do not mark issues as private, unless your bug report is a security issue containing information that may compromise your server/client.
The duplicated block shows up in the hot bar, not the chest. I apologize for not making that more clear. If you didn't move the grass block after the first screenshot then you shouldn't have had the grass block in your hot bar and inventory in the second screen shot.
As for the mods I had rei's minimap installed then I did a forced update and it still happened.

OMG. Sorry not seeing that bug.
Of course is the grass block duplicated in my inventory, one in the hot bar, one above.
I'd always looked in the chest.
Yea it's strange. I've also tried it in survival but i couldn't replicate it there. It only happens when pulling from the creative inventory.
Unable to reproduce
I've reproduced it on 3 separate computers and [Mod] Kumasasa reproduced it.
The only thing you could've done to not be able to reproduce it is move a block in any direction, after exiting the inventory, before opening the chest.
Or you just didn't follow my directions right.
Also confirmed, made a youtube video of it..
Thank you Richard.
Ah, now I got it to work. thanks, richard!
Can't get it to work in 13w01b.
May be fixed.

Can still reproduce with 13w01b.
Stick to my steps above. (edit: swapped the first two steps)
Works with all blocks with a GUI except Minecart with Chest. I first found this while enchanting and using enchanted books, as I was about to report. I've always needed 5 items in the hotbar and needed to shift click them before opening a chest/beacon block/anvil etc...
Minecraft 1.4.7
**Edit: This doesn't only occur when opening a GUI block. While testing this bug, I found that instead of opening the chest (for example) reopen your inventory and close it. It works sometimes.
Therefor, this might even work when opening villager GUI. I believe there are already some bugs on the bug tracker reported with villagers.

Possible fix
Caveat, working on mostly obfuscated 1.5 code, so I might easily miss something important... Also, difficult to show the fixed code as there is no (good) common MCP naming to refer to at this point. Identifier names now used are my quick and very narrow interpretations/guesses.
GuiContainerCreative
// func_74191_a(Slot p_74191_1_, int p_74191_2_, int p_74191_3_, int p_74191_4_)
protected void handleMouseClick(Slot slot, int slotNumber, int shiftPressed, int clickType) {
...
if (selectedTabIndex == CreativeTabs.tabSurvivalInventory.getTabIndex()) {
if (slot == this.trashSlot) {
this.minecraft.player.inventory.setSomeStack((ItemStack) null);
} else if (clickType == 4 && slot != null && slot.hasStack()) {
//stack2 = slot.decStackSize(shiftPressed_maybe == 0 ? 1 : slot.getStack().getMaxStackSize());
//this.minecraft.player.dropExternalStack(stack2);
//this.minecraft.playerController.setSomeCreativeDefaultSlot(stack2);
// FIX? Adapted from GuiContainer (normal survival mode operation)
// obfuscated method name 'func_78753_a'
this.minecraft.playerController.atLeastContainerEventsUse(this.container.windowId, slotNumber, shiftPressed, 4, this.minecraft.player);
} ...
}
// func_74227_b(CreativeTabs p_74227_1_)
private void setCreativeTab(CreativeTabs tab) {
...
if (tab == CreativeTabs.tabSurvivalInventory) {
...
creativeContainer.slots = new ArrayList();
for (int pfcSlotIndex = 0; pfcSlotIndex < playersFullContainer.slots.size(); ++pfcSlotIndex) {
SlotCreativeInventory specialSlot = new SlotCreativeInventory(this, (Slot) playersFullContainer.slots.get(pfcSlotIndex), pfcSlotIndex);
creativeContainer.slots.add(specialSlot);
// FIX? Adapted from Container.addSlotToContainer() (or func_75146_a())
specialSlot.slotNumber = pfcSlotIndex;
...
}
Changes tested on 1.5, and seems to work as expected. Didn't look for side-effects, and didn't test full multiplayer.
While at it, I'd give another look at the code right below the now fixed part, as they are also manipulating the survival inventory, yet use that same method that leaves slot to '-1', or seem to use slot number (while it is always 0). (Who knows, maybe some of those are behind the duplication issues during merchant access.)
Background
The problem had two parts.
First one was that the server is sent a packet which does not reveal which slot is being pointed (so it can not adjust its own idea of quantity) while client-side happily adjusts its own local stack and throws out a new item (which is apparently registered both on client and server sides). Once another operation is done, the server will send back data based on its own, unmodified quantity, and client updates its quantity to the server's one. Duplication achieved. With various funny side-effects (as illustrated by the many duplicates etc.)
The second part was part of the fixing process. The relevant method was receiving incorrect slot numbers, as they were not initialized properly. Getting the correct slot number is needed so that it can be sent to the server.
Affects 1.6 as well, right up to 1.6.2.
Considering all methods of creative item duplication have been closed as "duplicates" of this, I'll just throw this one out there:
If you're in the survival inventory tab, in Creative mode, and you Ctrl+Q to drop the item you're hovering over, you'll seem to drop the stack, but in reality you just dropped a duplicate stack. When your inventory updates (e.g. from picking up an item or relogging), you'll see the original stack is still there, and the dropped stack is real and can be picked up.
This is most easily demonstrated by looking straight down and Ctrl+Q-ing items. You'll pick up the duplicate stacks, and it will seem as though you dropped the whole stack and picked up twice as many items.
This bug can also cause inventory desynchronization, where entire stacks in your inventory remain invisible until you re-log.
Still effects 1.7 prerelease
Yep, still an issue in 14w08a (and 1.7.4)
If anyone is looking to INTENTIONALLY duplicate items in creative (for example if you have armor/weapons that have just the right enchantments) try one of the following 2 methods (both intentional features rather than bugs):
1) Putting something into an item frame while in creative causes the item to appear in the frame but still be in your hand at the same time (the one in the frame is a dupe). To get it back out of the frame you have to switch back to survival, however you can do this with a bunch of frames so that you're not switching gamemodes back and forth constantly for large numbers of items.
2) The second way is using the feature that lets you put armor into your hotbar and click on it there to equip it. You make it the currently selected item in the hotbar and hit the mouse button. Doing this in creative equips a duplicate of the armor while keeping the original in your hotbar. Doesn't work with non-armor items of course.
Actually, you can use pick block (bound by default to middle click) on an item to duplicate it, enchantments and all.
Yeah, all creative duplication methods could probably be resolved as invalid: you can middle-click it to dupe a full stack of identical copies.
I think the point is that there's a mismatch between what you think you've done to the inventory, and what has actually happened to it, rather than an exploit you could use in survival to cheat.

Confirmed for 14w32d. This also works
Go into Creative Mode
Give yourself 1 item
Press E and view Survival Inventory
Press Q on the item
It drops, but when you pick it up, you always get double
This may be related to MC-23039

Confirmed for:
Minecraft 1.8-pre 2 also the duplication qmagnet is discribing

Confirmed for 1.8.
Confirmed for 1.9-pre1

@Kumasasa I can confirm for 1.9.1 pre 3.
What I have noticed: I continued this until it wouldn't show anymore items in my inventory even though I would pick up items, they don't appear in the inventory. Clearing my inventory /clear @p it said removed 2112 items even though there was nothing there. Pressing ctrl+q hovering the item then picking it up does indeed double it. It will attempt to double a FULL stack which causes the "Invisible entity" items to take up room in the inventory. shift clicking the delete item button gets rid of them as well as /clear @p. Yes only happens in Creative mode, not survival or adventure. IF you remove your visible items, then "invisible" items are gone. The "invisible" items will remain in the inventory until all visible items are deleted or removed. (This means that the game possibly thinks its all ONE stack of items) Happens when viewing inventory in said creative mode. ALSO ctrl+q hovering over the item, then picking back up, then entering a chest, the "invisible" items will appear!!
CONCLUSION: The bug is caused by an attempt to duplicate a FULL stack of items, this includes a water/lava bucket/minecart etc. Since it cannot go above 64, it glitches out and causes these "ghost" entities. Hope this helps!
EDIT: I actually find this glitch useful in that it helps me duplicate items faster than pressing pick block on a single stack. Just saying, it could be turned into a sort of useful feature, in my opinion!

Confirmed for 1.9.2 and 1.9.1, some people may just search for them (as I did).

It's not necessary to have the items in the hotbar first.

Also works the other way around: Take something from the creative inventory (list), don't put it somewhere, but throw it out (hover over the list and press the drop key or click on an item and click outside UI). Pick the item up (doesn't matter if you close the inventory in the meantime). Then switch to the "survival inventory" (still in creative): The item is not there. Open an external inventory, item appears in your inventory.

Still in 1.10-pre2

I've just reproduced the second method mentioned in the description in 1.10.2 and also made a video about some more weirdness connected to it:
https://www.dropbox.com/s/akgxf1iqve2pbda/2016-06-25%2022-48-24.mp4
Cannot reproduce in 1.12 & 1.12.1, fixed?
Cannot reproduce for 1.13.1.

Since there are no new reports for this issue coming in, assuming fixed.