mojira.dev
MC-5415

Creative Mode Item Duplication into hotbar

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

MC-6789 Inventory restores partly upon opening chest in creative. MC-6832 Dropping items by hovering over an item and pressing the "drop" key duplicates the item on the ground in creative MC-8546 Creative mode item dupe MC-8638 Pressing Q then E in creative makes you drop an item without the count going down MC-9761 New Inventory feature in 1.5 duplicate items. (Action-bar Bug) MC-11303 Hopper "regenerating" items MC-11756 Item duplication in creative mode. MC-12053 Creative: Items dropped from hotbar slot 1 don't stack with slot 1 MC-14950 Creative Duplication MC-19398 If you press CONTROL + Q in creative mode you duplicate the items when they're dropped MC-19637 item dupe bug MC-22670 Item Duplication (control-Q) MC-27069 Double-Click , Delete not working MC-28370 Dropped Items Duplication MC-29301 Dropping Bug MC-30978 In the creative inventory, the items dropped pressing "q" are duplicated MC-37311 Inventory Item Duplication possible MC-44611 Duplication bug while trading with villager MC-46600 Dupelicating Villager Items MC-53161 creative item duplication MC-54339 Duplication - drop item MC-54868 Glitchy blocks MC-58039 Duplication in creative inventory MC-66540 In Superflat Tunnelers Dream Creative mode, quick swaping items then placing duplicated them in creative. MC-68113 Item duplication when dropped from creative inventory MC-71597 item duplication MC-81596 Creative item duplication MC-82451 Duplicated in Creative Mode MC-84795 Dropped items from survival inventory in creative are picked up twice MC-85745 Under some conditions items can duplicate into offhand without updating the GUI MC-86549 Duplicate when dropping items MC-87325 Creative Inventory Duplication MC-88840 duplication bug MC-89503 Duplication glitch with chests MC-89732 Dropping item from inventory will duplicate it (creative mode) MC-89982 Dropping an item by pressing Q on inventory gives you double the items when picking them up MC-90023 Right click to equip armor in creative mode shortly makes the item disappear MC-90643 Creative dupe Glitch MC-90931 Pressing 'Q' in inventory does not update testfor output MC-91012 Server item duplication MC-92039 1 BUG (enchant command) MC-92818 Creative Item Duplication MC-94058 Duplication of items MC-95912 Duplicating and disappearing items on Creative Mode. MC-98741 Items duplicate in creative when right clicking with a food item MC-100675 Creative mode item duplication (drop, then open external inventory) MC-101534 Holding "Q" and scrolling hotbar "Temporarily" drops items until opening chest MC-102216 Duplication Bug MC-103666 Player renders wearing armour despite no longer weared MC-105632 Item duplication by throwing off-hand item in creative MC-105722 Creative Inventory Duplicates After Opening Chest MC-106718 63 items duplicate bug MC-109552 Bug duplication of items in creative.

Attachments

Comments

migrated
[media][media]
kumasasa

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 chest Grass block in the hot bar and in the slot above.
    See screenshots

kumasasa

What mods do you have installed ?

kumasasa

Please do not mark issues as private, unless your bug report is a security issue containing information that may compromise your server/client.

Alex Jennings

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.

Alex Jennings

As for the mods I had rei's minimap installed then I did a forced update and it still happened.

kumasasa

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.

Alex Jennings

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.

Dean Baset

Unable to reproduce

Alex Jennings

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.

Richard Harvey

Also confirmed, made a youtube video of it..

http://www.youtube.com/watch?v=JcDRiPGADiA

Alex Jennings

Thank you Richard.

Dean Baset

Ah, now I got it to work. thanks, richard!

FireHunterX

Can't get it to work in 13w01b.
May be fixed.

kumasasa

Can still reproduce with 13w01b.
Stick to my steps above. (edit: swapped the first two steps)

Andrew Mancini

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.

bugi74

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.

Apocalypsing

Affects 1.6 as well, right up to 1.6.2.

WolfieMario

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.

majaha

Still effects 1.7 prerelease

Itouch2

Yep, still an issue in 14w08a (and 1.7.4)

Tokes

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.

majaha

Actually, you can use pick block (bound by default to middle click) on an item to duplicate it, enchantments and all.

Why is this Necceccary?

Yeah, all creative duplication methods could probably be resolved as invalid: you can middle-click it to dupe a full stack of identical copies.

majaha

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.

qmagnet

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

marcono1234

Confirmed for:

  • Minecraft 1.8-pre 2 also the duplication qmagnet is discribing

Sonicwave

Confirmed for 1.8.

Immaterialise

Confirmed for 1.9-pre1

TheTamedWolf

@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!

FaRo1

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

FaRo1

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

FaRo1

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.

SunCat

Still in 1.10-pre2

FaRo1

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

bemoty

Cannot reproduce in 1.12 & 1.12.1, fixed?

Kraif

Cannot reproduce for 1.13.1.

kumasasa

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

Alex Jennings

(Unassigned)

Confirmed

creative, creative-inventory, drop, duplication, hotbar, inventory, item, slot

Minecraft 1.4.6, Minecraft 1.4.7, Snapshot 13w01b, Snapshot 13w07a, Snapshot 13w10b, ..., Minecraft 1.11.2, Minecraft 1.12 Pre-Release 6, Minecraft 1.12.1, Minecraft 1.12.2, Minecraft 18w03b

Minecraft 1.13.1

Retrieved