mojira.dev
MC-116618

Dropping items rapidly inside the "Survival Inventory" tab in creative mode deletes items

When you hover over stacks of items in the creative inventory and drop them using either ctrl + q over multiple stacks, or press and hold q over single item stacks, some items will be deleted. This does not occur for survival, or adventure mode.

Steps to Reproduce:

  1. Fill your inventory with stacks of items

  2. Hold down either q or ctrl + q

  3. In quick succession, hover over the item stacks in your inventory

Observed Behavior:

A majority of the items will be deleted.

Expected Result:

None of the items would be deleted, and all would be dropped.

Screenshots/Videos:

[media]

Code Analysis:

(by @unknown)
The reason for this appears to be the ServerGamePacketListenerImpl.dropSpamTickCount. If the threshold is reached the server simply does not not drop an item, however it does not inform the client of that.
(24w18a, Mojang mapping names)

public void handleSetCreativeModeSlot(ServerboundSetCreativeModeSlotPacket var1) {
      PacketUtils.ensureRunningOnSameThread(var1, this, (ServerLevel)this.player.serverLevel());
      if (this.player.gameMode.isCreative()) {
         boolean var2 = var1.slotNum() < 0;
         ItemStack var3 = var1.itemStack();
         if (!var3.isItemEnabled(this.player.level().enabledFeatures())) {
            return;
         }

         . . .

         boolean var7 = var1.slotNum() >= 1 && var1.slotNum() <= 45;
         boolean var8 = var3.isEmpty() || var3.getCount() <= var3.getMaxStackSize();
         if (var7 && var8) {
            this.player.inventoryMenu.getSlot(var1.slotNum()).setByPlayer(var3);
            this.player.inventoryMenu.broadcastChanges();

         } else if (var2 && var8 && this.dropSpamTickCount < 200) {
            this.dropSpamTickCount += 20;
            this.player.drop(var3, true);
         }
      }

   }

Original Description:

The bug

When you hover over an item in your creative inventory and hold Q to drop those items (fast drop, because you hold Q), some items disappear, but when you are in survival (gamemode 0) zero items get deleted.

Example

Here is an example in video:

[media]

Code analysis

20w09a, Mojang names

The reason for this appears to be the ServerGamePacketListenerImpl.dropSpamTickCount. If the threshold is reached the server simply does not not drop an item, however it does not inform the client.

Linked issues

MC-128162 Fix the bug with dropping items from creative menu (sometimes disappearing items). MC-132513 When you jump to the location in the item bar and press the "Q" key, picking up will delete the number of items MC-135630 Dropping item with Q deletes item MC-136846 Item stacks lost when tossing quickly in creative mode MC-139232 Stack deleting bug MC-149583 Item stacks get smaller if you hover over them in inv then hold Q MC-157047 Blocks disappearing in creative MC-158415 Deletion of held item while throwing from GUI MC-159021 27 stacks of 64 items when dropped some disappear. MC-159093 Items get deleted or duplicate in bubble elevator MC-159916 Dropping item rapidly in creative mod make some items disappear. MC-161205 objects are deleted when pulled in creative mode MC-165376 Dropping Items Deletes Some/Entire Stack MC-167922 Dropping items out of your inventory deletes the items MC-193657 Items get deleted when using the 'hold down q to drop items quickly' functionality MC-201372 Holding down Q while in the inventory causes you to lose items MC-209126 Items that do not stack randomly despawn in Minecraft. MC-216583 Holding down Q key to drop a item makes less items when you pick them up MC-216650 Dropping many items in quick succession from the inventory UI results in some of those items being lost MC-230737 Items not dropping MC-244966 Items in creative mode disappear if dropped in a certain way MC-255730 Dropping multiple stacks of items from an inventory onto the ground in a short period of time causes some of the stacks to be deleted MC-258531 When ever I have a full inventory filled with items in creative mode, it picks up every item on the ground and makes them disappear MC-258668 items halve when pressing Q on inventory in Creative Mode MC-258716 When dropping a stack of 64 items in creative mode, you can only pick up 13. MC-266515 Ctrl + Q / Long Holding Q dropping Items causes items disappear in Creative Mode MC-267138 Stacks of Items disapear after throwing them on ground very quickly MC-271111 Containers with component labels cannot be copied properly in creative mode MC-271295 Items disappear when picking up MC-274346 Items disappear when you use "CTRL+Q" very quickly MC-274552 When throwing many slots of items out of your inventory is quick succession, some get deleted. WEB-7471 Items are lost when dropping from inventory in creative mode

Attachments

Comments

qwerty23495

Can confirm in 1.13-pre5.

Please keep the ticket up to date.

marcono1234

This "fast drop" might not be a feature, see MC-118107.
I can imagine the reason for this bug being the item throw cooldown of Creative mode, but this is only speculation.

tomudding

@marcono1234 In creative when you have a stack of items in your hand (not looking in your inventory) and start throwing them by holding 'Q' no items are deleted (tested this in 1.13 PRE-8). It is just that when you are inside the inventory the items somehow get deleted (by holding 'Q' to throw them).

marcono1234

@@unknown, thanks for pointing that out, I created MC-134399 for that.

By the way, you can create user "mentions" (they are no real mentions but just show the username properly) by writing the username (not "Full name") like this:

[~marcono1234]

See also the Jira help.

tomudding

@@unknown I always have problems with mentions, sometimes they work and sometimes they don't and that time it didn't work, tried it like 4 times with no success (and now it works of course). 

pulpetti

Still in 20w29a

jonthesquirrel

Still in 1.16.2. This was pretty frustrating, thinking my redstone was somehow deleting items until I figured out it was this creative mode bug...

Nojash

Still exists in 1.16.4. 

user-1fdda

Can confirm it hasn't been fixed, made a report of my own, but this still does not happen in survival luckily.

TeamArvv

Can confirm in 1.18.2, 1.18.1 and 1.18 - Other players can see the items but the player that throwed it cannot.

Server hosters such has aternos and more hasn't fixed this but mojang is already working on it.

batbrain1998

Can confirm in 23w07a.

xpxxy

still on latest snapshot

batbrain1998

Can confirm in 1.20.5 pre4.

batbrain1998

Can confirm in 1.20.5.

[Mod] Jingy

I've written a new description to better describe this issue:

When you hover over stacks of items in the creative inventory and drop them using either {{ctrl + q}} over multiple stacks or press and hold {{q}} over single stacks, some items will be deleted. 
This does not occur for survival, or adventure mode.

h3. Steps to Reproduce:
 # (In creative) Fill your inventory with stacks of items
 # Hold down either {{q}} or {{ctrl + q}} 
 # In quick succession, hover over all the items in your inventory

h3. Observed Behavior:
A majority of the items dropped will be deleted.

h3. Expected Result:
None of the items would be deleted, and all would be dropped.

h3. Screenshots/Videos:
 [^Minecraft_116618.mp4] 

h3. Code analysis
The reason for this appears to be the ServerGamePacketListenerImpl.dropSpamTickCount. If the threshold is reached the server simply does not not drop an item, however it does not inform the client.
(24w18a, Mojang mapping names)
{code:java}
   public void handleSetCreativeModeSlot(ServerboundSetCreativeModeSlotPacket var1) {
      PacketUtils.ensureRunningOnSameThread(var1, this, (ServerLevel)this.player.serverLevel());
      if (this.player.gameMode.isCreative()) {
         boolean var2 = var1.slotNum() < 0;
         ItemStack var3 = var1.itemStack();
         if (!var3.isItemEnabled(this.player.level().enabledFeatures())) {
            return;
         }

         CustomData var4 = (CustomData)var3.getOrDefault(DataComponents.BLOCK_ENTITY_DATA, CustomData.EMPTY);
         if (var4.contains("x") && var4.contains("y") && var4.contains("z")) {
            BlockPos var5 = BlockEntity.getPosFromTag(var4.getUnsafe());
            if (this.player.level().isLoaded(var5)) {
               BlockEntity var6 = this.player.level().getBlockEntity(var5);
               if (var6 != null) {
                  var6.saveToItem(var3, this.player.level().registryAccess());
               }
            }
         }

         boolean var7 = var1.slotNum() >= 1 && var1.slotNum() <= 45;
         boolean var8 = var3.isEmpty() || var3.getCount() <= var3.getMaxStackSize();
         if (var7 && var8) {
            this.player.inventoryMenu.getSlot(var1.slotNum()).setByPlayer(var3);
            this.player.inventoryMenu.broadcastChanges();
         } else if (var2 && var8 && this.dropSpamTickCount < 200) {
            this.dropSpamTickCount += 20;
            this.player.drop(var3, true);
         }
      }

   }
{code}
[Mod] Jingy

Considering the original reporter has not touched the issue in three years, I would like to request ownership of it to add the new description I've outlined in my last comment, and also add future affected versions.

tomudding

This appears to have been fixed in 24w38a through MC-276373.

Tom Udding

[Mod] Jingy

(Unassigned)

Confirmed

Gameplay

Normal

Inventory

creative-inventory, drop, drop-item, dropping, inventory, item

Minecraft 1.11.2, Minecraft 17w16b, Minecraft 1.12 Pre-Release 1, Minecraft 1.12 Pre-Release 2, Minecraft 1.12 Pre-Release 3, ..., 1.20.5, 1.20.6, 24w19b, 24w21b, 1.21

24w38a

Retrieved